-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Change directory structure (not verified yet) - arn/ - arn/device/ - arn/device/mngr.lua - arn/device/uhf.lua - arn/device/hal/ - arn/device/hal/hal_raw.lua - arn/utils/ - arn/utils/cache.lua - arn/utils/ccff.lua - arn/utils/debug.lua - arn/utils/rarp.lua - arn/utils/serialize.lua * Update ARN-Mngr * Upgrade for "ARN OMC Agent", add function ccff.file.exists() * Try Makefile * 2017.10.19 Continue ARN-Scripts (v2.0) - Add "radio query lock"; - Handle "dead-lock"; - Add "banner"; - No error on GWS5Kv2, need more tests. * Co-work with ARN-Proto (+arn-agent-omc) * Import "JSON.Encode()" * Assign default region value, and check its type before compare * "rarp": return ip only; let cache valid in next hour
- Loading branch information
Showing
20 changed files
with
432 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# 6Harmonics Inc | ||
# maintainer: Qige Zhao <qigezhao@gmail.com> | ||
# updated on: 2017.10.19 | ||
|
||
all: | ||
|
||
clean: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
================= FAILSAFE MODE active =================== | ||
Thank you for choosing | ||
__ _ _ _ | ||
/ /_ | | | | __ _ _ __ _ __ ___ ___ _ __ (_) ___ ___ | ||
| '_ \| |_| |/ _` | '__| '_ ` _ \ / _ \| '_ \| |/ __/ __| | ||
| (_) | _ | (_| | | | | | | | | (_) | | | | | (__\__ \ | ||
\___/|_| |_|\__,_|_| |_| |_| |_|\___/|_| |_|_|\___|___/ | ||
|
||
--------------------------------------------------------- | ||
ARN Beijing Firmware | ||
--------------------------------------------------------- | ||
* Kernel Dawen Zhang, Yaoyang Wang | ||
* Application Yu Zhou, Qige Zhao | ||
--------------------------------------------------------- | ||
========================================================== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Thank you for choosing | ||
__ _ _ _ | ||
/ /_ | | | | __ _ _ __ _ __ ___ ___ _ __ (_) ___ ___ | ||
| '_ \| |_| |/ _` | '__| '_ ` _ \ / _ \| '_ \| |/ __/ __| | ||
| (_) | _ | (_| | | | | | | | | (_) | | | | | (__\__ \ | ||
\___/|_| |_|\__,_|_| |_| |_| |_|\___/|_| |_|_|\___|___/ | ||
|
||
--------------------------------------------------------- | ||
ARN Beijing Firmware | ||
--------------------------------------------------------- | ||
* Kernel Dawen Zhang, Yaoyang Wang | ||
* Application Yu Zhou, Qige Zhao | ||
--------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
--[[ | ||
Note: | ||
Although GWS4K share the same methods and functions, | ||
this copy will let maintainer handle 2 types of hardware. | ||
by Qige <qigezhao@gmail.com> | ||
2017.08.16 update_rt | ||
]]-- | ||
|
||
local DBG = print | ||
--local function DBG(msg) end | ||
|
||
local ccff = require 'arn.utils.ccff' | ||
local uhf = require 'arn.device.uhf' | ||
|
||
local exec = ccff.execute | ||
local vint = ccff.val.n | ||
local sfmt = string.format | ||
local ssub = string.sub | ||
local slen = string.len | ||
|
||
local gws_radio = {} | ||
|
||
gws_radio.conf = {} | ||
gws_radio.conf.val_length_max = 8 | ||
|
||
gws_radio.cmd = {} | ||
gws_radio.cmd.rfinfo_clean = 'echo > /tmp/.GWS4Kv2.tmp' | ||
gws_radio.cmd.rfinfo_lock = '/tmp/.GWS4Kv2.lock' | ||
gws_radio.cmd.rfinfo_wait = 'sleep 2' | ||
gws_radio.cmd.rfinfo = 'rfinfo 2>/dev/null > /tmp/.GWS4K.tmp' | ||
gws_radio.cmd.region = 'cat /tmp/.GWS4K.tmp 2> /dev/null | grep Region -A1 | grep [01]* -o' | ||
gws_radio.cmd.channel = 'cat /tmp/.GWS4K.tmp 2> /dev/null | grep Channel -A1 | grep [0-9]* -o' | ||
gws_radio.cmd.txpower = 'cat /tmp/.GWS4K.tmp 2> /dev/null | grep ^Tx | grep Power | grep [0-9\.]* -o' | ||
gws_radio.cmd.chanbw = 'uci get wireless.radio0.chanbw' | ||
|
||
gws_radio.cmd.region_set = 'setregion %s 2> /dev/null ' | ||
gws_radio.cmd.channel_set = 'setchan %s 2> /dev/null ' | ||
gws_radio.cmd.txpower_set = 'settxpwr %s 2> /dev/null ' | ||
gws_radio.cmd.chanbw_set = 'setchanbw %s 2> /dev/null ' | ||
gws_radio.cmd.rxgain_set = 'setrxgain %s 2> /dev/null ' | ||
|
||
function gws_radio.update_init() | ||
DBG(sfmt("GWS4K----> update_init()")) | ||
-- v2.0 2017.10.19 enable read lock | ||
rfinfo_lock = fread(gws_radio.cmd.rfinfo_lock) | ||
if (rfinfo_lock ~= 'lock' and rfinfo_lock ~= 'lock\n') then | ||
print(sfmt('%80s', '> updating radio <')) | ||
DBG('note> updating device < lock:', rfinfo_lock) | ||
fwrite(gws_radio.cmd.rfinfo_lock, 'lock') | ||
exec(gws_radio.cmd.rfinfo) | ||
fwrite(gws_radio.cmd.rfinfo_lock, 'unlock') | ||
DBG('note> updated') | ||
else | ||
print(sfmt('%80s', '> device busy <')) | ||
lock_counts = 3 | ||
while(rfinfo_lock == 'lock' or rfinfo_lock == 'lock\n') do | ||
exec(gws_radio.cmd.rfinfo_wait) | ||
rfinfo_lock = fread(gws_radio.cmd.rfinfo_lock) | ||
lock_counts = lock_counts - 1 | ||
if (lock_counts < 0) then | ||
print(sfmt('%80s', 'solving dead-lock')) | ||
break | ||
end | ||
end | ||
fwrite(gws_radio.cmd.rfinfo_lock, 'unlock') -- FIXME | ||
end | ||
--print(exec(gws_radio.cmd.rfinfo_all)) | ||
end | ||
|
||
function gws_radio.rfinfo_clean() | ||
exec(gws_radio.cmd.rfinfo_clean) | ||
end | ||
|
||
--[[ | ||
Tasks: | ||
1. Return each value by key; | ||
2. If result is too long, return first 8 chars. | ||
]]-- | ||
function gws_radio.update_item(key) | ||
local result | ||
if (key == 'region') then | ||
result = exec(gws_radio.cmd.region) | ||
elseif (key == 'channel' or key == 'channo') then | ||
result = exec(gws_radio.cmd.channel) | ||
elseif (key == 'txpower' or key == 'txpwr') then | ||
result = exec(gws_radio.cmd.txpower) | ||
elseif (key == 'chanbw') then | ||
result = exec(gws_radio.cmd.chanbw) | ||
end | ||
-- limit return length | ||
local lmax = gws_radio.conf.val_length_max | ||
if (result and slen(result) > lmax) then | ||
result = ssub(result, 1, lmax) | ||
end | ||
return vint(result) | ||
end | ||
|
||
--[[ | ||
Tasks: | ||
1. Do cli call; | ||
2. Fetch each parameters from tmp file. | ||
]]-- | ||
function gws_radio.UPDATE_RT() | ||
DBG(sfmt("GWS4K> update_rt (@%d)", os.time())) | ||
local result = {} | ||
|
||
gws_radio.update_init() | ||
|
||
DBG(sfmt("GWS4K----> update_item() region")) | ||
result.region = gws_radio.update_item('region') | ||
|
||
DBG(sfmt("GWS4K----> update_item() channel")) | ||
result.channo = gws_radio.update_item('channel') | ||
result.freq = uhf.channel_to_freq(result.region, result.channo) | ||
|
||
DBG(sfmt("GWS4K----> update_item() txpower")) | ||
result.txpwr = gws_radio.update_item('txpower') | ||
|
||
DBG(sfmt("GWS4K----> update_item() chanbw")) | ||
result.chanbw = gws_radio.update_item('chanbw') | ||
|
||
--result.ts = os.time() | ||
return result | ||
end | ||
|
||
function gws_radio.SET_RT(key, value) | ||
local result = true | ||
DBG(sfmt("GWS4K> set_rt k=%s,value=%s (@%d)", key or '-', value or '-', os.time())) | ||
if (key == 'region') then | ||
exec(sfmt(gws_radio.cmd.region_set, value)) | ||
result = false | ||
elseif (key == 'channel' or key == 'channo') then | ||
exec(sfmt(gws_radio.cmd.channel_set, value)) | ||
result = false | ||
elseif (key == 'txpower' or key == 'txpwr') then | ||
exec(sfmt(gws_radio.cmd.txpower_set, value)) | ||
result = false | ||
elseif (key == 'rxgain') then | ||
exec(sfmt(gws_radio.cmd.rxgain_set, value)) | ||
result = false | ||
end | ||
gws_radio.rfinfo_clean() | ||
return result | ||
end | ||
|
||
return gws_radio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--[[ | ||
Note: | ||
Although GWS5Kv1 & GWS5Kv2 share the same methods and functions, | ||
this copy will let maintainer handle 2 types of hardware. | ||
by Qige <qigezhao@gmail.com> | ||
almost same as GWS5Kv2, it's a wrapper | ||
]]-- | ||
|
||
--local DBG = print | ||
local function DBG(msg) end | ||
|
||
local gws_radio = require 'arn.device.hal.gws_5kv2' | ||
return gws_radio |
Oops, something went wrong.