Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-libhardware_legacy: Commit

hardware/libhardware_legacy


Commit MetaInfo

Revisionaf40e83f1fcf57a51114b3d529528251cd319459 (tree)
Time2009-09-05 04:10:58
AuthorYi Sun <beyounn@gmai...>
CommiterChih-Wei Huang

Log Message

changes based on review feedback

Change Summary

Incremental Difference

--- a/wifi/wifi.c
+++ b/wifi/wifi.c
@@ -54,10 +54,9 @@ static char iface[PROPERTY_VALUE_MAX];
5454 #endif
5555 #define WIFI_TEST_INTERFACE "sta"
5656 #define SYSFS_PATH_MAX 256
57-#define SYSFS_CLASS_NET "/sys/class/net"
58-#define MODULE_DEFAULT_DIR "/lib/modules"
5957 #define PARSE_BUF_SIZE 4096 /* Should be long enough */
60-static const char SYS_FS_NET_DIR[] = "/sys/class/net";
58+static const char SYSFS_CLASS_NET[] = "/sys/class/net";
59+static const char MODULE_DEFAULT_DIR[] = "/lib/modules";
6160 static const char SYS_MOD_NAME_DIR[] = "device/driver/module";
6261 static const char IFACE_DIR[] = "/data/system/wpa_supplicant";
6362 static const char FIRMWARE_LOADER[] = WIFI_FIRMWARE_LOADER;
@@ -126,7 +125,7 @@ const char *get_dhcp_error_string() {
126125 return dhcp_lasterror();
127126 }
128127
129-static int get_driver_path( char *path, char *mname,int len) {
128+static int get_driver_path( const char *mname,char *path, unsigned int len) {
130129 struct utsname un;
131130 FILE *fd;
132131 int ret = 0, cnt;
@@ -176,19 +175,19 @@ static int get_driver_info() {
176175 char link[SYSFS_PATH_MAX];
177176 int ret = 0;
178177
179- if ((netdir = opendir(SYS_FS_NET_DIR)) != NULL) {
178+ if ((netdir = opendir(SYSFS_CLASS_NET)) != NULL) {
180179 while((de = readdir(netdir))!=NULL) {
181180 struct dirent **namelist = NULL;
182181 int cnt;
183182 if ((!strcmp(de->d_name,".")) || (!strcmp(de->d_name,"..")))
184183 continue;
185- snprintf(path, SYSFS_PATH_MAX,SYSFS_CLASS_NET"/%s/phy80211",de->d_name);
184+ snprintf(path, SYSFS_PATH_MAX,"%s/%s/phy80211",SYSFS_CLASS_NET,de->d_name);
186185 if (access(path, F_OK)) {
187- snprintf(path, SYSFS_PATH_MAX,SYSFS_CLASS_NET"/%s/wireless",de->d_name);
186+ snprintf(path, SYSFS_PATH_MAX,"%s/%s/wireless",SYSFS_CLASS_NET,de->d_name);
188187 if (access(path, F_OK))
189188 continue;
190189 }
191- snprintf(path,SYSFS_PATH_MAX,SYSFS_CLASS_NET"/%s/%s",de->d_name,SYS_MOD_NAME_DIR);
190+ snprintf(path,SYSFS_PATH_MAX,"%s/%s/%s",SYSFS_CLASS_NET,de->d_name,SYS_MOD_NAME_DIR);
192191 cnt = readlink(path, link,SYSFS_PATH_MAX-1);
193192 if (cnt > 0 ) {
194193 char *mod = NULL, *mod1 = NULL;
@@ -202,7 +201,7 @@ static int get_driver_info() {
202201 property_set(DRIVER_PROP_NAME,"ok");
203202 property_set("wlan.modname",mod1);
204203 snprintf(link,SYSFS_PATH_MAX,"%s.ko",mod1);
205- if ( (cnt = get_driver_path(path, link, SYSFS_PATH_MAX)) > 0)
204+ if ( (cnt = get_driver_path(link,path,SYSFS_PATH_MAX)) > 0)
206205 {
207206 property_set("wlan.modpath",path);
208207 } else {
Show on old repository browser