[libiwinfo] fixup ccode in wl_get_country()
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 29 Sep 2010 08:27:16 +0000 (08:27 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 29 Sep 2010 08:27:16 +0000 (08:27 +0000)
contrib/package/iwinfo/Makefile
contrib/package/iwinfo/src/iwinfo_wl.c

index 5a39dc5..c2b0456 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libiwinfo
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libiwinfo
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 
index 1a7d586..2dac12b 100644 (file)
@@ -482,8 +482,23 @@ int wl_get_freqlist(const char *ifname, char *buf, int *len)
 
 int wl_get_country(const char *ifname, char *buf)
 {
 
 int wl_get_country(const char *ifname, char *buf)
 {
-       if( !wl_ioctl(ifname, WLC_GET_COUNTRY, buf, WLC_CNTRY_BUF_SZ) )
+       char ccode[WLC_CNTRY_BUF_SZ];
+
+       if( !wl_ioctl(ifname, WLC_GET_COUNTRY, ccode, WLC_CNTRY_BUF_SZ) )
+       {
+               /* IL0 -> World */
+               if( !strcmp(ccode, "IL0") )
+                       sprintf(buf, "00");
+
+               /* YU -> RS */
+               else if( !strcmp(ccode, "YU") )
+                       sprintf(buf, "RS");
+
+               else
+                       memcpy(buf, ccode, 2);
+
                return 0;
                return 0;
+       }
 
        return -1;
 }
 
        return -1;
 }