OSDN Git Service

add check on phy80211 directory as well. Some drivers does not create wireless directory
authorYi Sun <beyounn@gmail.com>
Thu, 30 Jul 2009 21:00:35 +0000 (14:00 -0700)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 4 Sep 2009 19:10:58 +0000 (03:10 +0800)
wifi/wifi.c

index d94ac38..8f619d0 100644 (file)
@@ -136,9 +136,12 @@ static int get_driver_info() {
             int cnt;
             if ((!strcmp(de->d_name,".")) || (!strcmp(de->d_name,"..")))
                 continue;
-            snprintf(path, SYSFS_PATH_MAX,SYSFS_CLASS_NET"/%s/wireless",de->d_name);
-            if (access(path, F_OK))
-                continue;
+            snprintf(path, SYSFS_PATH_MAX,SYSFS_CLASS_NET"/%s/phy80211",de->d_name);
+            if (access(path, F_OK)) {
+                snprintf(path, SYSFS_PATH_MAX,SYSFS_CLASS_NET"/%s/wireless",de->d_name);
+                if (access(path, F_OK))
+                    continue;
+            }
             snprintf(path,SYSFS_PATH_MAX,SYSFS_CLASS_NET"/%s/%s",de->d_name,SYS_MOD_NAME_DIR);
             cnt = readlink(path, link,SYSFS_PATH_MAX-1);
             if (cnt > 0 ) {
@@ -446,6 +449,7 @@ int wifi_send_command(struct wpa_ctrl *ctrl, const char *cmd, char *reply, size_
     if (strncmp(cmd, "PING", 4) == 0) {
         reply[*reply_len] = '\0';
     }
+
     return 0;
 }