Thanks for your testing, answer below Le 25/12/2012 13:35, Stefan Hellermann a écrit : > oops :-) > > here the output with wlan0 as parameter and no client: > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].channel('wlan0')) > 1 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].frequency('wlan0')) > 2412 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].txpower('wlan0')) > 17 > # lua -l iwinfo -e local b = > iwinfo[iwinfo.type('wlan0')].bitrate('wlan0'); print(b or '0') > 0 > # lua -l iwinfo -e local s = > iwinfo[iwinfo.type('wlan0')].signal('wlan0'); print(s or '-255') > -255 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].noise('wlan0')) > -95 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].quality('wlan0')) > 0 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].quality_max('wlan0')) > 70 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].mode('wlan0')) > Master > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].ssid('wlan0')) > zuhause2 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].bssid('wlan0')) > F4:EC:38:F0:F1:C9 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].country('wlan0')) > DE > # lua -l iwinfo -e print(#iwinfo[iwinfo.type('wlan0')].assoclist('wlan0')) > 0 lua -l iwinfo -e "n = 0; for _,_ in pairs(iwinfo[iwinfo.type('wlan0')].assoclist('wlan0')) do n = n + 1 end; print(n)"
> # lua -l iwinfo -e local e = > iwinfo[iwinfo.type('wlan0')].encryption('wlan0'); print(e and > e.description or 'None') > WPA2 PSK (CCMP) > # lua -l iwinfo -e local > x=iwinfo[iwinfo.type('wlan0')].hwmodelist('wlan0'); print((x.a and 'a' > or '')..(x.b and 'b' or '')..(x.g and 'g' or '')..(x.n and 'n' or '')) > bgn > > > > and with two clients: > > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].channel('wlan0')) > 1 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].frequency('wlan0')) > 2412 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].txpower('wlan0')) > 17 > # lua -l iwinfo -e local b = > iwinfo[iwinfo.type('wlan0')].bitrate('wlan0'); print(b or '0') > 30000 > # lua -l iwinfo -e local s = > iwinfo[iwinfo.type('wlan0')].signal('wlan0'); print(s or '-255') > -46 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].noise('wlan0')) > -95 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].quality('wlan0')) > 63 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].quality_max('wlan0')) > 70 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].mode('wlan0')) > Master > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].ssid('wlan0')) > zuhause2 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].bssid('wlan0')) > F4:EC:38:F0:F1:C9 > # lua -l iwinfo -e print(iwinfo[iwinfo.type('wlan0')].country('wlan0')) > DE > # lua -l iwinfo -e print(#iwinfo[iwinfo.type('wlan0')].assoclist('wlan0')) > 0 > # lua -l iwinfo -e local e = > iwinfo[iwinfo.type('wlan0')].encryption('wlan0'); print(e and > e.description or 'None') > WPA2 PSK (CCMP) > # lua -l iwinfo -e local > x=iwinfo[iwinfo.type('wlan0')].hwmodelist('wlan0'); print((x.a and 'a' > or '')..(x.b and 'b' or '')..(x.g and 'g' or '')..(x.n and 'n' or '')) > bgn > > > so only assoclist seems to be wrong, 0 instead of 2. > > # iwinfo wlan0 info > wlan0 ESSID: "zuhause2" > Access Point: F4:EC:38:F0:F1:C9 > Mode: Master Channel: 1 (2.412 GHz) > Tx-Power: 17 dBm Link Quality: 63/70 > Signal: -47 dBm Noise: -95 dBm > Bit Rate: 29.5 MBit/s > Encryption: WPA2 PSK (CCMP) > Type: nl80211 HW Mode(s): 802.11bgn > Hardware: 168C:002B 168C:A091 [Atheros AR9285] > TX power offset: none > Frequency offset: none > Supports VAPs: yes > > # iwinfo wlan0 assoclist > 00:1F:3A:52:AA:23 -76 dBm / -95 dBm (SNR 19) 0 ms ago > RX: 18.0 MBit/s, MCS 0, 20MHz 1492 Pkts. > TX: 12.0 MBit/s, MCS 0, 20MHz 954 Pkts. > > 00:25:56:88:07:6C -18 dBm / -95 dBm (SNR 77) 40140 ms ago > RX: 54.0 MBit/s, MCS 0, 20MHz 1115 Pkts. > TX: 48.0 MBit/s, MCS 0, 20MHz 530 Pkts. > > > Regards, > Stefan Hellermann > > > 2012/12/24 Etienne CHAMPETIER <etienne.champet...@free.fr>: >> Hi >> >> Use wlan0 instead of radio0 >> >> Joyeux noel, >> Etienne >> >> Stefan Hellermann <ste...@the2masters.de> a écrit : >> >>> Hi, >>> >>>> -i don't use {#DEV}, and it's a uci bug, i should just suppress it? >>> Ok, I don't know how to use it, either. >>> >>>> -for the wifi.discovery i'm always using phy instead of macaddress in >>>> wireless config (so i can flash a spare router quickly). you can suppress >>>> the {#PHY} part, or find another way? (don't use it i think) >>> I changed my wifi config to use phy0 instead of the macaddress, then >>> your script is fine. But the default config uses the macaddress, so we >>> should support this. Just removing the phy part of your script works >>> with both configs. Like this one: >>> lua -l uci -l iwinfo -e 'x = uci.cursor(nil, "/var/state");list = >>> "{\"data\":[";x:foreach("wireless", "wifi-iface", function(s) >>> list=list.."{\"{#IF}\":\""..s.ifname.."\", >>> \"{#SSID}\":\""..s.ssid.."\", \"{#NET}\":\""..s.network.."\", >>> \"{#DEV}\":\""..s.device.."\", >>> \"{#TYPE}\":\""..x:get("wireless",s.device,"type").."\", >>> \"{#HWMODE}\":\""..x:get("wireless",s.device,"hwmode").."\", >>> \"{#CHANNEL}\":\""..x:get("wireless",s.device,"channel").."\", >>> \"{#BSSID}\":\""..iwinfo[iwinfo.type(s.ifname)].bssid(s.ifname).."\"}," >>> end); list=string.gsub(list,",$",""); print(list.."]}")' >>> >>> {"data":[{"{#IF}":"wlan0", "{#SSID}":"zuhause2", "{#NET}":"lan", >>> "{#DEV}":"radio0", "{#TYPE}":"mac80211", "{#HWMODE}":"11ng", >>> "{#CHANNEL}":"1", "{#BSSID}":"F4:EC:38:F0:F1:C9"}]} >>> >>> >>>> -for the txpower i may use the same trick as with bitrate >>>> -for bitrate if there is no client value is nil, so i put 0 for default >>>> value. >>>> >>>> I will check later for the other value (you're getting too many nil for me) >>> Thanks! I did a new measurement with a notebook connected to the wifi. >>> >>> # lua -l iwinfo -e print(iwinfo[iwinfo.type('radio0')].channel('radio0')) >>> 1 >>> # lua -l iwinfo -e print(iwinfo[iwinfo.type('radio0')].frequency('radio0')) >>> 2412 >>> # lua -l iwinfo -e print(iwinfo[iwinfo.type('radio0')].txpower('radio0')) >>> nil >>> # lua -l iwinfo -e local b = >>> iwinfo[iwinfo.type('radio0')].bitrate('radio0'); print(b or '0') >>> 0 >>> # lua -l iwinfo -e local s = >>> iwinfo[iwinfo.type('radio0')].signal('radio0'); print(s or '-255') >>> -255 >>> # lua -l iwinfo -e print(iwinfo[iwinfo.type('radio0')].noise('radio0')) >>> nil >>> # lua -l iwinfo -e print(iwinfo[iwinfo.type('radio0')].quality('radio0')) >>> 0 >>> # lua -l iwinfo -e >>> print(iwinfo[iwinfo.type('radio0')].quality_max('radio0')) >>> 70 >>> # lua -l iwinfo -e print(iwinfo[iwinfo.type('radio0')].mode('radio0')) >>> Unknown >>> # lua -l iwinfo -e print(iwinfo[iwinfo.type('radio0')].ssid('radio0')) >>> nil >>> # lua -l iwinfo -e print(iwinfo[iwinfo.type('radio0')].bssid('radio0')) >>> nil >>> # lua -l iwinfo -e print(iwinfo[iwinfo.type('radio0')].country('radio0')) >>> DE >>> # lua -l iwinfo -e print(#iwinfo[iwinfo.type('radio0')].assoclist('radio0')) >>> 0 >>> # lua -l iwinfo -e local e = >>> iwinfo[iwinfo.type('radio0')].encryption('radio0'); print(e and >>> e.description or 'None') >>> None >>> # lua -l iwinfo -e local >>> x=iwinfo[iwinfo.type('radio0')].hwmodelist('radio0'); print((x.a and >>> 'a' or '')..(x.b and 'b' or '')..(x.g and 'g' or '')..(x.n and 'n' or >>> '')) >>> bgn >>> >>> I would say something is clearly wrong here? I double checked, that >>> the notebook is really connected to this router. >>> >>>> what's your wifi router? >>> It's a tp-link tl-wr741, a really cheap ar71xx device with ath9k wifi. >>> >>> Thanks, >>> Stefan _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel