Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-libhardware_legacy: 提交

hardware/libhardware_legacy


Commit MetaInfo

修订版0f04d645eecf6a9c81214fa2b66870d433ae4650 (tree)
时间2010-04-16 19:47:44
作者Yi Sun <beyounn@gmai...>
Commiter黃志偉

Log Message

changes based on review feedback

更改概述

差异

--- 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,21 +175,21 @@ 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/wireless", de->d_name);
184+ snprintf(path, SYSFS_PATH_MAX, "%s/%s/wireless", SYSFS_CLASS_NET, de->d_name);
186185 if (access(path, F_OK)) {
187- snprintf(path, SYSFS_PATH_MAX,SYSFS_CLASS_NET"/%s/phy80211", de->d_name);
186+ snprintf(path, SYSFS_PATH_MAX, "%s/%s/phy80211", 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);
192- cnt = readlink(path, link,SYSFS_PATH_MAX-1);
193- if (cnt > 0 ) {
190+ snprintf(path,SYSFS_PATH_MAX, "%s/%s/%s", SYSFS_CLASS_NET, de->d_name, SYS_MOD_NAME_DIR);
191+ cnt = readlink(path, link, SYSFS_PATH_MAX-1);
192+ if (cnt > 0) {
194193 char *mod = NULL, *mod1 = NULL;
195194 link[cnt] = '\0';
196195 strtok(link,"/");
@@ -202,8 +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)
206- {
204+ if ((cnt = get_driver_path(link, path, SYSFS_PATH_MAX)) > 0) {
207205 property_set("wlan.modpath",path);
208206 } else {
209207 LOGE("%s can not locate wifi driver, you will not be able to reinstall driver",
Show on old repository browser