From e3570b7b0d04205b53f45c8e6ad29379fb2674db Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 29 Sep 2010 08:27:16 +0000 Subject: [libiwinfo] fixup ccode in wl_get_country() --- contrib/package/iwinfo/Makefile | 2 +- contrib/package/iwinfo/src/iwinfo_wl.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/contrib/package/iwinfo/Makefile b/contrib/package/iwinfo/Makefile index 5a39dc5cf..c2b0456da 100644 --- a/contrib/package/iwinfo/Makefile +++ b/contrib/package/iwinfo/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libiwinfo -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/contrib/package/iwinfo/src/iwinfo_wl.c b/contrib/package/iwinfo/src/iwinfo_wl.c index 1a7d586d9..2dac12b1a 100644 --- a/contrib/package/iwinfo/src/iwinfo_wl.c +++ b/contrib/package/iwinfo/src/iwinfo_wl.c @@ -482,8 +482,23 @@ int wl_get_freqlist(const char *ifname, char *buf, int *len) 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 -1; } -- cgit v1.2.3