finally fix wl0_distance setting for client mode
authorFelix Fietkau <[email protected]>
Wed, 1 Mar 2006 16:40:31 +0000 (16:40 +0000)
committerFelix Fietkau <[email protected]>
Wed, 1 Mar 2006 16:40:31 +0000 (16:40 +0000)
SVN-Revision: 3293

openwrt/package/wificonf/wificonf.c

index 5ac28762ef154b5fcb54069d24b30e7bb9176863..b24663c7cb8dbc925d82e4a1c3eecae7fa980e46 100644 (file)
@@ -217,21 +217,14 @@ static void stop_bcom(int skfd, char *ifname)
 
 }
 
-static void start_bcom(int skfd, char *ifname)
+static inline void set_distance(int skfd, char *ifname)
 {
+       rw_reg_t reg;
+       uint32 shm;
        int val = 0;
        char *v;
        
-       if (bcom_ioctl(skfd, ifname, WLC_GET_MAGIC, &val, sizeof(val)) < 0)
-               return;
-
-       bcom_ioctl(skfd, ifname, WLC_UP, &val, sizeof(val));
-       set_wext_ssid(skfd, ifname);
-
        if (v = nvram_get(wl_var("distance"))) {
-               rw_reg_t reg;
-               uint32 shm;
-               
                val = atoi(v);
                val = 9+(val/150)+((val%150)?1:0);
                
@@ -246,6 +239,18 @@ static void start_bcom(int skfd, char *ifname)
        }
 }
 
+static void start_bcom(int skfd, char *ifname)
+{
+       int val = 0;
+
+       if (bcom_ioctl(skfd, ifname, WLC_GET_MAGIC, &val, sizeof(val)) < 0)
+               return;
+
+       bcom_ioctl(skfd, ifname, WLC_UP, &val, sizeof(val));
+       set_wext_ssid(skfd, ifname);
+       set_distance(skfd, ifname);
+}
+
 static int setup_bcom_wds(int skfd, char *ifname)
 {
        char buf[8192];
@@ -356,6 +361,9 @@ void start_watchdog(int skfd, char *ifname)
                        setup_bcom_wds(skfd, ifname);
                        sleep(wdstimeout);
                }
+
+               /* refresh the distance setting - the driver might change it */
+               set_distance(skfd, ifname);
        }
 }