[libiwinfo]
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 27 Sep 2010 15:38:35 +0000 (15:38 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 27 Sep 2010 15:38:35 +0000 (15:38 +0000)
- fix compilation of WL backend
- conditionally compile backends according to selected wifi drivers

contrib/package/iwinfo/Makefile
contrib/package/iwinfo/src/Makefile
contrib/package/iwinfo/src/include/broadcom.h
contrib/package/iwinfo/src/iwinfo_wl.c

index b9c41e42628e86ddb2bb7f13e40b0ea2c696f9f0..4ea94028bff621179c5adb3dd7a35f7f8a53e2fc 100644 (file)
@@ -19,7 +19,7 @@ define Package/libiwinfo
   CATEGORY:=LuCI
   SUBMENU:=Libraries
   TITLE:=Generalized Wireless Information Library (iwinfo)
-  DEPENDS:=+libnl-tiny +liblua +lua
+  DEPENDS:=+PACKAGE_kmod-mac80211:libnl-tiny +liblua +lua
 endef
 
 define Package/libiwinfo/description
@@ -35,6 +35,11 @@ endef
 define Build/Configure
 endef
 
+IWINFO_BACKENDS := \
+       $(if $(CONFIG_PACKAGE_kmod-brcm-wl),wl) \
+       $(if $(CONFIG_PACKAGE_kmod-madwifi),madwifi) \
+       $(if $(CONFIG_PACKAGE_kmod-mac80211),nl80211)
+
 TARGET_CFLAGS += \
        -I$(STAGING_DIR)/usr/include \
        -I$(STAGING_DIR)/usr/include/libnl-tiny
@@ -42,7 +47,8 @@ TARGET_CFLAGS += \
 MAKE_FLAGS += \
        FPIC="$(FPIC)" \
        CFLAGS="$(TARGET_CFLAGS)" \
-       LDFLAGS="$(TARGET_LDFLAGS)"
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+       BACKENDS="$(IWINFO_BACKENDS)"
 
 define Package/libiwinfo/install
        $(INSTALL_DIR) $(1)/usr/bin
index 1d4319fb001920337ed063884fe39eec251e7487..40b720ab93cdee03e7a77cbc2a8ababc6f52675e 100644 (file)
@@ -1,8 +1,25 @@
-IWINFO_LDFLAGS    = $(LDFLAGS) -shared -llua $(if $(CRAP),,-lnl-tiny)
-IWINFO_CFLAGS     = $(CFLAGS) -std=gnu99 -fstrict-aliasing $(if $(CRAP),-DUSE_WL,-DUSE_MADWIFI -DUSE_NL80211)
+IWINFO_BACKENDS   = $(if $(BACKENDS),$(BACKENDS),madwifi nl80211)
+IWINFO_LDFLAGS    = $(LDFLAGS) -shared -llua
+IWINFO_CFLAGS     = $(CFLAGS) -std=gnu99 -fstrict-aliasing
 IWINFO_SO         = iwinfo.so
-IWINFO_OBJ        = $(if $(CRAP),iwinfo_wl.o,iwinfo_madwifi.o iwinfo_nl80211.o) \
-       iwinfo_wext.o iwinfo_wext_scan.o iwinfo_lualib.o
+IWINFO_OBJ        = iwinfo_wext.o iwinfo_wext_scan.o iwinfo_lualib.o
+
+ifneq ($(filter wl,$(IWINFO_BACKENDS)),)
+       IWINFO_CFLAGS  += -DUSE_WL
+       IWINFO_OBJ     += iwinfo_wl.o
+endif
+
+ifneq ($(filter madwifi,$(IWINFO_BACKENDS)),)
+       IWINFO_CFLAGS  += -DUSE_MADWIFI
+       IWINFO_OBJ     += iwinfo_madwifi.o
+endif
+
+ifneq ($(filter nl80211,$(IWINFO_BACKENDS)),)
+       IWINFO_CFLAGS  += -DUSE_NL80211
+       IWINFO_LDFLAGS += -lnl-tiny
+       IWINFO_OBJ     += iwinfo_nl80211.o
+endif
+
 
 %.o: %.c
        $(CC) $(IWINFO_CFLAGS) $(LUA_CFLAGS) $(FPIC) -c -o $@ $< 
index ae7ae531dc3e09c655a50dfc720089b9df557f9c..9652d74333dc73730708d3253eb94edf208dd26c 100644 (file)
@@ -29,6 +29,7 @@
 #define WLC_GET_MAGIC                          0
 #define WLC_GET_RATE                           12
 #define WLC_GET_INFRA                          19
+#define WLC_GET_AUTH                           21
 #define WLC_GET_BSSID                          23
 #define WLC_GET_SSID                           25
 #define WLC_GET_CHANNEL                                29
index 1c292948988abcb95721b9f730ee70aff6a3edb0..7c1904bf1d8269aa202ff62c07943a9b9182956b 100644 (file)
@@ -265,7 +265,7 @@ int wl_get_encryption(const char *ifname, char *buf)
                                c->auth_algs |= IWINFO_AUTH_SHARED;
 
                        /* ToDo: evaluate WEP key lengths */
-                       c->auth_ciphers = IWINFO_CIPHER_WEP40 | IWINFO_CIPHER_WEP104;
+                       c->pair_ciphers = IWINFO_CIPHER_WEP40 | IWINFO_CIPHER_WEP104;
                        c->auth_suites |= IWINFO_KMGMT_NONE;
                        break;