From: Samuel Ortiz Date: Thu, 14 Oct 2010 22:36:20 +0000 (+0200) Subject: rtnl: Detect non cfg80211 based WiFi drivers X-Git-Tag: 2.0_alpha~2282 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d8db41a79c9e84260afca853715e0856245882a;p=framework%2Fconnectivity%2Fconnman.git rtnl: Detect non cfg80211 based WiFi drivers Those don't come with a proper uevent DEVTYPE label. ConnMan looks for a sysfs wireless directory in that case. --- diff --git a/src/rtnl.c b/src/rtnl.c index 87f4945..95663db 100644 --- a/src/rtnl.c +++ b/src/rtnl.c @@ -104,6 +104,7 @@ static connman_bool_t ether_blacklisted(const char *name) static void read_uevent(struct interface_data *interface) { char *filename, line[128]; + connman_bool_t found_devtype; FILE *f; if (ether_blacklisted(interface->name) == TRUE) { @@ -124,6 +125,7 @@ static void read_uevent(struct interface_data *interface) if (f == NULL) return; + found_devtype = FALSE; while (fgets(line, sizeof(line), f)) { char *pos; @@ -135,6 +137,8 @@ static void read_uevent(struct interface_data *interface) if (strncmp(line, "DEVTYPE=", 8) != 0) continue; + found_devtype = TRUE; + if (strcmp(line + 8, "wlan") == 0) { interface->service_type = CONNMAN_SERVICE_TYPE_WIFI; interface->device_type = CONNMAN_DEVICE_TYPE_WIFI; @@ -154,6 +158,22 @@ static void read_uevent(struct interface_data *interface) } fclose(f); + + if (found_devtype) + return; + + /* We haven't got a DEVTYPE, let's check if it's a wireless device */ + filename = g_strdup_printf("/sys/class/net/%s/wireless/", + interface->name); + + f = fopen(filename, "re"); + + g_free(filename); + + if (f != NULL) { + interface->service_type = CONNMAN_SERVICE_TYPE_WIFI; + interface->device_type = CONNMAN_DEVICE_TYPE_WIFI; + } } enum connman_device_type __connman_rtnl_get_device_type(int index)