summaryrefslogtreecommitdiff
path: root/src/rtnl.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-10-15 00:36:20 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-10-15 00:38:25 +0200
commit6d8db41a79c9e84260afca853715e0856245882a (patch)
tree6052cc1c2d1aa0760a5c776dc6e45593fcb6fda0 /src/rtnl.c
parent2766eed8b364475972cb0f2e306b6c3188877e1e (diff)
downloadconnman-6d8db41a79c9e84260afca853715e0856245882a.tar.gz
connman-6d8db41a79c9e84260afca853715e0856245882a.tar.bz2
connman-6d8db41a79c9e84260afca853715e0856245882a.zip
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.
Diffstat (limited to 'src/rtnl.c')
-rw-r--r--src/rtnl.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/rtnl.c b/src/rtnl.c
index 87f49454..95663dbe 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)