diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/iwinfo/Makefile | 4 | ||||
-rw-r--r-- | libs/iwinfo/src/iwinfo.h | 8 | ||||
-rw-r--r-- | libs/iwinfo/src/iwinfo_lualib.c | 22 | ||||
-rw-r--r-- | libs/iwinfo/src/iwinfo_lualib.h | 9 |
4 files changed, 37 insertions, 6 deletions
diff --git a/libs/iwinfo/Makefile b/libs/iwinfo/Makefile index 573dcae5a5..f9ce36abf4 100644 --- a/libs/iwinfo/Makefile +++ b/libs/iwinfo/Makefile @@ -7,10 +7,10 @@ include standalone.mk endif IWINFO_LDFLAGS = -IWINFO_CFLAGS = -fstrict-aliasing +IWINFO_CFLAGS = -fstrict-aliasing $(if $(CRAP),-DUSE_WL,-DUSE_MADWIFI) IWINFO_SO = iwinfo.so IWINFO_LUA = iwinfo.lua -IWINFO_OBJ = src/iwinfo_wl.o src/iwinfo_madwifi.o \ +IWINFO_OBJ = $(if $(CRAP),src/iwinfo_wl.o,src/iwinfo_madwifi.o) \ src/iwinfo_wext.o src/iwinfo_wext_scan.o src/iwinfo_lualib.o %.o: %.c diff --git a/libs/iwinfo/src/iwinfo.h b/libs/iwinfo/src/iwinfo.h index f15e38327f..cbb9b69a30 100644 --- a/libs/iwinfo/src/iwinfo.h +++ b/libs/iwinfo/src/iwinfo.h @@ -18,9 +18,15 @@ #include <net/if.h> #include <errno.h> +#include "iwinfo_wext.h" + +#ifdef USE_WL #include "iwinfo_wl.h" +#endif + +#ifdef USE_MADWIFI #include "iwinfo_madwifi.h" -#include "iwinfo_wext.h" +#endif #define IWINFO_BUFSIZE 24 * 1024 diff --git a/libs/iwinfo/src/iwinfo_lualib.c b/libs/iwinfo/src/iwinfo_lualib.c index 61ad5d325f..5509f4b6ae 100644 --- a/libs/iwinfo/src/iwinfo_lualib.c +++ b/libs/iwinfo/src/iwinfo_lualib.c @@ -23,13 +23,19 @@ static int iwinfo_L_type(lua_State *L) { const char *ifname = luaL_checkstring(L, 1); +#ifdef USE_MADWIFI if( madwifi_probe(ifname) ) lua_pushstring(L, "madwifi"); + else +#endif - else if( wl_probe(ifname) ) +#ifdef USE_WL + if( wl_probe(ifname) ) lua_pushstring(L, "wl"); + else +#endif - else if( wext_probe(ifname) ) + if( wext_probe(ifname) ) lua_pushstring(L, "wext"); else @@ -244,6 +250,7 @@ static int iwinfo_L_freqlist(lua_State *L, int (*func)(const char *, char *, int return 1; } +#ifdef USE_WL /* Broadcom */ LUA_WRAP_INT(wl,channel) LUA_WRAP_INT(wl,frequency) @@ -261,7 +268,9 @@ LUA_WRAP_LIST(wl,assoclist) LUA_WRAP_LIST(wl,txpwrlist) LUA_WRAP_LIST(wl,scanlist) LUA_WRAP_LIST(wl,freqlist) +#endif +#ifdef USE_MADWIFI /* Madwifi */ LUA_WRAP_INT(madwifi,channel) LUA_WRAP_INT(madwifi,frequency) @@ -279,6 +288,7 @@ LUA_WRAP_LIST(madwifi,assoclist) LUA_WRAP_LIST(madwifi,txpwrlist) LUA_WRAP_LIST(madwifi,scanlist) LUA_WRAP_LIST(madwifi,freqlist) +#endif /* Wext */ LUA_WRAP_INT(wext,channel) @@ -298,6 +308,7 @@ LUA_WRAP_LIST(wext,txpwrlist) LUA_WRAP_LIST(wext,scanlist) LUA_WRAP_LIST(wext,freqlist) +#ifdef USE_WL /* Broadcom table */ static const luaL_reg R_wl[] = { LUA_REG(wl,channel), @@ -318,7 +329,9 @@ static const luaL_reg R_wl[] = { LUA_REG(wl,mbssid_support), { NULL, NULL } }; +#endif +#ifdef USE_MADWIFI /* Madwifi table */ static const luaL_reg R_madwifi[] = { LUA_REG(madwifi,channel), @@ -339,6 +352,7 @@ static const luaL_reg R_madwifi[] = { LUA_REG(madwifi,mbssid_support), { NULL, NULL } }; +#endif /* Wext table */ static const luaL_reg R_wext[] = { @@ -371,17 +385,21 @@ static const luaL_reg R_common[] = { LUALIB_API int luaopen_iwinfo(lua_State *L) { luaL_register(L, IWINFO_META, R_common); +#ifdef USE_WL luaL_newmetatable(L, IWINFO_WL_META); luaL_register(L, NULL, R_wl); lua_pushvalue(L, -1); lua_setfield(L, -2, "__index"); lua_setfield(L, -2, "wl"); +#endif +#ifdef USE_MADWIFI luaL_newmetatable(L, IWINFO_MADWIFI_META); luaL_register(L, NULL, R_madwifi); lua_pushvalue(L, -1); lua_setfield(L, -2, "__index"); lua_setfield(L, -2, "madwifi"); +#endif luaL_newmetatable(L, IWINFO_WEXT_META); luaL_register(L, NULL, R_wext); diff --git a/libs/iwinfo/src/iwinfo_lualib.h b/libs/iwinfo/src/iwinfo_lualib.h index bf7568a653..72697983ff 100644 --- a/libs/iwinfo/src/iwinfo_lualib.h +++ b/libs/iwinfo/src/iwinfo_lualib.h @@ -28,9 +28,16 @@ #define IWINFO_META "iwinfo" +#define IWINFO_WEXT_META "iwinfo.wext" + +#ifdef USE_WL #define IWINFO_WL_META "iwinfo.wl" +#endif + +#ifdef USE_MADWIFI #define IWINFO_MADWIFI_META "iwinfo.madwifi" -#define IWINFO_WEXT_META "iwinfo.wext" +#endif + #define LUA_REG(type,op) \ { #op, iwinfo_L_##type##_##op } |