From 5f48f4c97c336df6cdf7c83852f3d223cd893323 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Karsten=20B=C3=B6ddeker?= <freifunk@kb-light.de>
Date: Wed, 23 Nov 2016 20:10:52 +0100
Subject: [PATCH] ffho-ath9k-blackout-workaround: fix script

---
 .../luasrc/usr/sbin/ath9k-blackout-workaround     | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/ffho/ffho-ath9k-blackout-workaround/luasrc/usr/sbin/ath9k-blackout-workaround b/ffho/ffho-ath9k-blackout-workaround/luasrc/usr/sbin/ath9k-blackout-workaround
index 53cf71b..d6c6b1b 100755
--- a/ffho/ffho-ath9k-blackout-workaround/luasrc/usr/sbin/ath9k-blackout-workaround
+++ b/ffho/ffho-ath9k-blackout-workaround/luasrc/usr/sbin/ath9k-blackout-workaround
@@ -14,17 +14,18 @@ function time2file (file)
 end
 
 function devOk (iface)
-  local data = uci:get_all('wireless', iface)
-  if data.disabled then
+  local radio = uci:get_all('wireless', iface, 'radio')
+  local disabled = uci:get_bool('wireless', iface, 'disabled') or uci:get_bool('wireless', radio, 'disabled')
+  if disabled then
     return null
   end
-  local radio = uci:get_all('wireless', data.radio)
-  if not radio.hwmode == '11g' or radio.disabled then
+  local hwmode = uci:get_all('wireless', radio, 'hwmode')
+  if not hwmode == '11g' then
     return null
   end
-  local wifitype = iwinfo.type(data.radio)
-  local iw = iwinfo[wifitype]
-  if iw.assoclist(iface) then
+  local wifitype = iwinfo.type(radio)
+  local assoclist = iwinfo[wifitype].assoclist(iface)
+  if assoclist and #assoclist > 0 then
     return true
   end
   return false
-- 
GitLab