Updated connman to version 1.35
[platform/upstream/connman.git] / src / device.c
old mode 100644 (file)
new mode 100755 (executable)
index a563f46..3ec8f71
@@ -1042,6 +1042,73 @@ void connman_device_regdom_notify(struct connman_device *device,
        __connman_technology_notify_regdom_by_device(device, result, alpha2);
 }
 
+#if defined TIZEN_EXT
+static int device_specific_scan(enum connman_service_type type,
+                               struct connman_device *device,
+                               int scan_type, GSList *specific_scan_list)
+{
+       if (!device->driver || !device->driver->specific_scan)
+               return -EOPNOTSUPP;
+
+       if (!device->powered)
+               return -ENOLINK;
+
+       return device->driver->specific_scan(type, device, scan_type,
+                       specific_scan_list, NULL);
+}
+
+int __connman_device_request_specific_scan(enum connman_service_type type,
+                               int scan_type, GSList *specific_scan_list)
+{
+       bool success = false;
+       int last_err = -ENOSYS;
+       GSList *list;
+       int err;
+
+       switch (type) {
+       case CONNMAN_SERVICE_TYPE_UNKNOWN:
+       case CONNMAN_SERVICE_TYPE_SYSTEM:
+       case CONNMAN_SERVICE_TYPE_ETHERNET:
+       case CONNMAN_SERVICE_TYPE_BLUETOOTH:
+       case CONNMAN_SERVICE_TYPE_CELLULAR:
+       case CONNMAN_SERVICE_TYPE_GPS:
+       case CONNMAN_SERVICE_TYPE_VPN:
+       case CONNMAN_SERVICE_TYPE_GADGET:
+               return -EOPNOTSUPP;
+       case CONNMAN_SERVICE_TYPE_WIFI:
+       case CONNMAN_SERVICE_TYPE_P2P:
+               break;
+       }
+
+       for (list = device_list; list; list = list->next) {
+               struct connman_device *device = list->data;
+               enum connman_service_type service_type =
+                       __connman_device_get_service_type(device);
+
+               if (service_type != CONNMAN_SERVICE_TYPE_UNKNOWN) {
+                       if (type == CONNMAN_SERVICE_TYPE_P2P) {
+                               if (service_type != CONNMAN_SERVICE_TYPE_WIFI)
+                                       continue;
+                       } else if (service_type != type)
+                               continue;
+               }
+
+               err = device_specific_scan(type, device, scan_type, specific_scan_list);
+               if (err == 0 || err == -EINPROGRESS) {
+                       success = true;
+               } else {
+                       last_err = err;
+                       DBG("device %p err %d", device, err);
+               }
+       }
+
+       if (success)
+               return 0;
+
+       return last_err;
+}
+#endif
+
 int __connman_device_request_scan(enum connman_service_type type)
 {
        bool success = false;
@@ -1078,7 +1145,15 @@ int __connman_device_request_scan(enum connman_service_type type)
                }
 
                err = device_scan(type, device);
+#if defined TIZEN_EXT
+               /* When Scan is already in progress then return Error so that
+                * wifi-manager can block the scan-done signal to be sent to
+                * application and start requested scan after scan already in progress
+                * is completed then notify to application about the scan event */
+               if (err == 0 || err == -EINPROGRESS) {
+#else
                if (err == 0 || err == -EALREADY || err == -EINPROGRESS) {
+#endif
                        success = true;
                } else {
                        last_err = err;
@@ -1108,7 +1183,11 @@ int __connman_device_request_hidden_scan(struct connman_device *device,
                                        passphrase, security, user_data);
 }
 
+#if defined TIZEN_EXT
+char *index2ident(int index, const char *prefix)
+#else
 static char *index2ident(int index, const char *prefix)
+#endif
 {
        struct ifreq ifr;
        struct ether_addr eth;
@@ -1154,7 +1233,11 @@ static char *index2ident(int index, const char *prefix)
        return str;
 }
 
+#if defined TIZEN_EXT
+char *index2addr(int index)
+#else
 static char *index2addr(int index)
+#endif
 {
        struct ifreq ifr;
        struct ether_addr eth;
@@ -1394,6 +1477,9 @@ static void cleanup_devices(void)
 
                DBG("cleaning up %s index %d", interfaces[i], index);
 
+#if defined TIZEN_EXT
+               if (strcmp(interfaces[i], "wlan0") != 0)
+#endif
                connman_inet_ifdown(index);
 
                /*