Re: [OpenWrt-Devel] iwinfo lua scanlist issue

2015-06-29 Thread Jo-Philipp Wich
Hi Peter,

I suspect the culprit is nl80211_wait() which calls nl_recvmsgs()
internally.

To overcome this problem we need to restructure the nl80211 code to use
nonblocking sockets and then extend the nl80211_wait() implementation to
have a timeout.

~ Jow
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] iwinfo lua scanlist issue

2015-06-29 Thread Jo-Philipp Wich
Not really as the core issue is always within the same C code, however
you access it.

~ Jow
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] iwinfo lua scanlist issue

2015-06-29 Thread Peter Uithoven
Should we maybe switch to using iwinfo though ubus in our Lua code? Can we
use that to scan for networks?
Could that be a more robust solution?
http://wiki.openwrt.org/doc/techref/ubus#lua_module_for_ubus
https://forum.openwrt.org/viewtopic.php?id=57554

If I understand the following two pages correctly the new luci (LuCI2) will
also use ubus, over http.
http://wiki.openwrt.org/doc/techref/luci2
http://wiki.openwrt.org/doc/techref/ubus#access_to_ubus_over_http

On Mon, Jun 29, 2015 at 11:59 AM, Jo-Philipp Wich j...@openwrt.org wrote:

 Hi Peter,

 I suspect the culprit is nl80211_wait() which calls nl_recvmsgs()
 internally.

 To overcome this problem we need to restructure the nl80211 code to use
 nonblocking sockets and then extend the nl80211_wait() implementation to
 have a timeout.

 ~ Jow
 ___
 openwrt-devel mailing list
 openwrt-devel@lists.openwrt.org
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] iwinfo lua scanlist issue

2015-06-29 Thread Peter Uithoven
Hi OpenWRT dev's,

It looks like the scanlist method of the iwinfo lua binding hangs when the
wifi stack is restarted.

This happens when my init script is called, which attempts to perform a
scan, but the wifi stack is restarted because the country and channel is
changed (according to the wireless configuration in uci). With hanging I
mean that Lua doesn't get past this function call, there is no timeout. And
not being able to make this non blocking makes this pretty problematic.
The only solution thus far was adding a 5 seconds sleep in my init script.

The only traces of info I could find are here:
http://wiki.openwrt.org/doc/howto/wireless.utilities#iwconfig
http://git.openwrt.org/?p=project/iwinfo.git;a=tree;hb=HEAD

This happens in the 14.07 version of OpenWRT.

I can reproduce this after boot with the following lua script:

 local io = require('io')
 local file = assert(io.open('/tmp/scan.log', a+))
 local function logger(message)
   print(message)
   file:write(message .. \n)
   file:flush()
 end

 logger(init)

 logger(starting wifi restart)
 local handler = io.popen(wifi)

 local iwinfo = require('iwinfo')
 local deviceName = 'wlan0'
 local deviceID = iwinfo.type(deviceName)

 if not deviceID then
   logger(wireless device ' .. deviceName .. ' not found)
 else
   logger(found wireless device ' .. deviceName .. ')
 end

 local wifiDevice = iwinfo[deviceID]
 if not wifiDevice then
   logger('iwinfo. .. deviceID .. ' interface not found)
 else
   logger(found 'iwinfo. .. deviceID .. ' interface)
 end

 logger(calling scanlist)
 local scanList = wifiDevice.scanlist(deviceName)
 logger(scanlist completed)
 logger(scanlist:)
 for _,sn in ipairs(scanList) do
   logger(  -  .. (sn.ssid or nil))
 end

 logger(finished)


Isn't there a more specific project site, issue queue or mailinglist?

Thanks in advance,
Peter Uithoven
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel