Related to all this, as well as being interesting, for wifi status on my dev/test system, I get:
{
"radio0": {
"up": true,
"pending": false,
"autostart": true,
"disabled": false,
"retry_setup_failed": false,
"config": {
"disabled": false,
"type": "mac80211",
"band": "2g",
"beacon_int": 50,
"channel": "1",
"country": "AD",
"htmode": "HE40",
"log_level": 3,
"noscan": true,
"path": "platform/soc/18000000.wifi"
},
"interfaces": [
{
"section": "default_radio0",
"config": {
"network": [
"lan"
],
"device": [
"radio0"
],
"mode": "ap",
"disabled": false,
"encryption": "owe",
"ifname": "phy0-ap0",
"key": "owe_null_key",
"macaddr": "96:83:c4:a5:8e:cb",
"ssid": "MeshGate-2g-8ecb",
"radios": [
]
},
"ifname": "phy0-ap0",
"vlans": [
],
"stations": [
]
},
{
"section": "vxradio0",
"config": {
"network": [
"vtunlan"
],
"device": [
"radio0"
],
"mode": "ap",
"disabled": false,
"encryption": "owe",
"ifname": "vxradio0",
"key": "owe_null_key",
"macaddr": "96:83:c4:a7:8e:cb",
"ssid": "VTunnel-2g-8ecb",
"radios": [
]
},
"ifname": "vxradio0",
"vlans": [
],
"stations": [
]
},
{
"section": "m11s0",
"config": {
"network": [
"lan"
],
"device": [
"radio0"
],
"mode": "mesh",
"disabled": false,
"dtim_period": 2,
"encryption": "sae",
"ifname": "m-11s-0",
"key": "78c8068012f8481fec118451e1041b3751801a24ab3e222643a0a6a4424b82a1",
"macaddr": "96:83:c4:a3:8e:cb",
"mesh_id": "92d490daf46cfe534c56ddd669297e",
"mesh_rssi_threshold": -68,
"radios": [
]
},
"ifname": "m-11s-0",
"vlans": [
],
"stations": [
]
}
]
},
"radio1": {
"up": true,
"pending": false,
"autostart": true,
"disabled": false,
"retry_setup_failed": false,
"config": {
"disabled": false,
"type": "mac80211",
"band": "5g",
"channel": "36",
"country": "AD",
"htmode": "HE80",
"log_level": 3,
"path": "platform/soc/18000000.wifi+1"
},
"interfaces": [
{
"section": "default_radio1",
"config": {
"network": [
"lan"
],
"device": [
"radio1"
],
"mode": "ap",
"disabled": false,
"encryption": "owe",
"ifname": "phy1-ap1",
"key": "owe_null_key",
"macaddr": "96:83:c4:a6:8e:cb",
"ssid": "MeshGate-5g-8ecb",
"radios": [
]
},
"ifname": "phy1-ap1",
"vlans": [
],
"stations": [
]
},
{
"section": "vxradio1",
"config": {
"network": [
"vtunlan"
],
"device": [
"radio1"
],
"mode": "ap",
"disabled": false,
"encryption": "owe",
"ifname": "vxradio1",
"key": "owe_null_key",
"macaddr": "96:83:c4:a8:8e:cb",
"ssid": "VTunnel-5g-8ecb",
"radios": [
]
},
"ifname": "vxradio1",
"vlans": [
],
"stations": [
]
}
]
}
}
But your "grist for the mill" gives me:
root@meshnode-8ecb:~# #!/bin/sh
root@meshnode-8ecb:~#
root@meshnode-8ecb:~# eval $(ubus call iwinfo devices | jsonfilter -e 'devices=$.devices[*]')
root@meshnode-8ecb:~# for device in $devices; do
> eval $(wifi status | jsonfilter -e 'radio=$[*].interfaces[@.ifname = "'$device'"].config.device[*]')
> printf "device=%s radio=%s\n" "$device" "$radio"
> done
device=phy1-ap1 radio=radio1
device=vxradio0 radio=radio0
device=phy0-ap0 radio=radio0
device=vxradio1 radio=radio1
device=m-11s-0 radio=radio0
root@meshnode-8ecb:~#
root@meshnode-8ecb:~# eval $(wifi status | jsonfilter -e 'radios=$')
root@meshnode-8ecb:~# for radio in $radios; do
> eval $(wifi status \
> | jsonfilter -e '$.'$radio'.interfaces[0]' \
> | jsonfilter \
> -e 'device=$.config.device[*]' \
> -e 'ifname=$.ifname' \
> -e 'section=$.section' \
> )
> printf "radio=%s device=%s ifname=%s section=%s\n" "$radio" "$device" "$ifname" "$section"
> done
radio=radio0 device=radio0 ifname=phy0-ap0 section=default_radio0
radio=radio1 device=radio1 ifname=phy1-ap1 section=default_radio1
root@meshnode-8ecb:~#
I have numerous ifnames, something not right...