From 232d7bf6b21fc0493e2f3db3e3c76abeebb1e572 Mon Sep 17 00:00:00 2001 From: dman776 Date: Thu, 6 May 2021 00:05:57 -0500 Subject: [PATCH] api enhancement: convert getFreq to use lib-iwinfo (#101) --- files/usr/lib/lua/aredn/info.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/files/usr/lib/lua/aredn/info.lua b/files/usr/lib/lua/aredn/info.lua index 996d3651..d224e3eb 100755 --- a/files/usr/lib/lua/aredn/info.lua +++ b/files/usr/lib/lua/aredn/info.lua @@ -229,11 +229,10 @@ end ------------------------------------- function model.getFreq() local wlanInf=get_ifname('wifi') - local freq="" - freq=os.capture("iwinfo " .. wlanInf .. " info | egrep 'Mode:'") - freq=freq:gsub("^%s*(.-)%s*$", "%1") - freq=string.match(freq, "%((.-)%)") - return freq + local api=iwinfo.type(wlanInf) + local iw = iwinfo[api] + local freq = iw.frequency(wlanInf) + return tostring(freq) end -------------------------------------