meta-oe: fix refactor to a better layout
[scm/bb/meta-tizen.git] / meta-tizen-adaptation / meta-oe / recipes-connectivity / connman / connman / 0020-Tethering-Add-open-access-point-support-in-technolog.patch
1 From d0fcec2219e62723f4ed4e67e1724b8dc2c1cd96 Mon Sep 17 00:00:00 2001
2 From: Chengyi Zhao <chengyi1.zhao@archermind.com>
3 Date: Thu, 11 Jul 2013 09:12:01 +0800
4 Subject: [PATCH 20/32] Tethering: Add open access point support in technology
5
6 Change-Id: I86f4a22567f5df2fbd5d0c0c03c6cc5b6fc24a2d
7 ---
8  src/technology.c | 36 +++++++++++++++++++++++-------------
9  1 file changed, 23 insertions(+), 13 deletions(-)
10
11 diff --git a/src/technology.c b/src/technology.c
12 index a06efd3..be66c3a 100644
13 --- a/src/technology.c
14 +++ b/src/technology.c
15 @@ -245,8 +245,7 @@ static int set_tethering(struct connman_technology *technology,
16         if (!bridge)
17                 return -EOPNOTSUPP;
18  
19 -       if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
20 -           (!ident || !passphrase))
21 +       if (technology->type == CONNMAN_SERVICE_TYPE_WIFI && (!ident))
22                 return -EINVAL;
23  
24         for (tech_drivers = technology->driver_list; tech_drivers;
25 @@ -912,19 +911,30 @@ static DBusMessage *set_property(DBusConnection *conn,
26                 if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
27                         return __connman_error_not_supported(msg);
28  
29 -               if (strlen(str) < 8 || strlen(str) > 63)
30 -                       return __connman_error_passphrase_required(msg);
31 +               if (strlen(str) < 8 || strlen(str) > 63) {
32 +                       if (g_str_equal(str, "")) {
33 +                               technology->tethering_passphrase = NULL;
34  
35 -               if (g_strcmp0(technology->tethering_passphrase, str) != 0) {
36 -                       g_free(technology->tethering_passphrase);
37 -                       technology->tethering_passphrase = g_strdup(str);
38 -                       technology_save(technology);
39 +                               connman_dbus_property_changed_basic(technology->path,
40 +                                               CONNMAN_TECHNOLOGY_INTERFACE,
41 +                                               "TetheringPassphrase",
42 +                                               DBUS_TYPE_STRING,
43 +                                               &str);
44 +                       }
45 +                       else
46 +                               return __connman_error_passphrase_required(msg);
47 +               } else {
48 +                       if (g_strcmp0(technology->tethering_passphrase, str) != 0) {
49 +                               g_free(technology->tethering_passphrase);
50 +                               technology->tethering_passphrase = g_strdup(str);
51 +                               technology_save(technology);
52  
53 -                       connman_dbus_property_changed_basic(technology->path,
54 -                                       CONNMAN_TECHNOLOGY_INTERFACE,
55 -                                       "TetheringPassphrase",
56 -                                       DBUS_TYPE_STRING,
57 -                                       &technology->tethering_passphrase);
58 +                               connman_dbus_property_changed_basic(technology->path,
59 +                                               CONNMAN_TECHNOLOGY_INTERFACE,
60 +                                               "TetheringPassphrase",
61 +                                               DBUS_TYPE_STRING,
62 +                                               &technology->tethering_passphrase);
63 +                       }
64                 }
65         } else if (g_str_equal(name, "Powered")) {
66                 dbus_bool_t enable;
67 -- 
68 1.8.1.4
69