USB radio <WORK IN PROGRESS>

To use USB radios kmod-ath9k-htc is needed, when an USB radio is plugged a folder is created in /sys/devices/platform/ehci-platform/usb1/*/*/ieee80211/ like /sys/devices/platform/ehci-platform/usb1/1-1/1-1\:1.0/ieee80211/phy2

OpenWrt wifi detect not detect this kind of devices, but if an entry is created in /etc/config/wireless describing the hardware and in particular specifing the path relative to /sys/devices it will capable of manage the device

cd /sys/devices/
for physPath in platform/ehci-platform/usb*/*/*/ieee80211/*
do
    phyName="$(basename ${physPath})" 
    phyIndex="$(echo ${phyName} | grep -o '[0-9]*')" 

    uci batch <<BATCH
delete wireless.radio${phyIndex}

set wireless.radio${phyIndex}=wifi-device
set wireless.radio${phyIndex}.type=mac80211
set wireless.radio${phyIndex}.hwmode=11ng
set wireless.radio${phyIndex}.path="$(echo ${physPath} | awk -F"ieee80211" '{print $1}')" 
add_list wireless.radio${phyIndex}.ht_capab="LDPC" 
add_list wireless.radio${phyIndex}.ht_capab="SHORT-GI-20" 
add_list wireless.radio${phyIndex}.ht_capab="SHORT-GI-40" 
add_list wireless.radio${phyIndex}.ht_capab="TX-STBC" 
add_list wireless.radio${phyIndex}.ht_capab="RX-STBC1" 
add_list wireless.radio${phyIndex}.ht_capab="DSSS_CCK-40" 
set wireless.radio${phyIndex}.htmode=HT20
set wireless.radio${phyIndex}.disabled=0

commit
BATCH

done