Iwinfo doesn't recognize the device

on a fresh boot with OpenWrt 25.12.1 for Generic x86/64 built with:
(default options)
apk-mbedtls base-files ca-bundle dnsmasq dropbear e2fsprogs firewall4 fstools grub2-bios-setup kmod-button-hotplug kmod-nft-offload libc libgcc libustream-mbedtls logd mkf2fs mtd netifd nftables odhcp6c odhcpd-ipv6only partx-utils ppp ppp-mod-pppoe procd-ujail uci uclient-fetch urandom-seed urngd kmod-amazon-ena kmod-amd-xgbe kmod-bnx2 kmod-dwmac-intel kmod-e1000e kmod-e1000 kmod-forcedeth kmod-fs-vfat kmod-igb kmod-igc kmod-ixgbe kmod-r8169 kmod-tg3 kmod-drm-i915 luci
(added custom options)
pciutils usbutils kmod-iwlwifi kmod-usb-net-rtl8152 wpad-openssl iwlwifi-firmware-ax210

/etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option path 'pci0000:00/0000:00:02.2/0000:03:00.0'
        option band '6g'
        option channel '1'
        option htmode 'HE80'
        option country '00'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'owe'
        option disabled '1'

when I run:
iwinfo radio0 scan
I get:

Usage:
        iwinfo <device> info
        iwinfo <device> scan
        iwinfo <device> txpowerlist
        iwinfo <device> freqlist
        iwinfo <device> assoclist
        iwinfo <device> countrylist
        iwinfo <device> htmodelist
        iwinfo nl80211 phyname <section>

as if radio0 not recognized as a device

iw dev radio0 scan
returns:
command failed: No such device (-19)

I can ran scan on this device using LuCI with no problem,
I can create access point using this device (radio0) that works fine, after changing wireless to:

config wifi-device 'radio0'
        option type 'mac80211'
        option path 'pci0000:00/0000:00:02.2/0000:03:00.0'
        option htmode 'VHT40'
        option country 'US'
        option cell_density '0'

but I still can't use iwinfo radio0 scan in the terminal

lspci returns:
03:00.0 Network controller: Intel Corporation Wi-Fi 6E(802.11ax) AX210/AX1675* 2x2 [Typhoon Peak] (rev 1a)

Any ideas what I'm doing wrong? How do I make iwinfo work?

Thank you!

Trying to use an Intel card as AP.

Try 802.11n @ 2.4GHz, you might get lucky.

Need to set a country too.

AP works fine. STA works fine. LuCI has no problem doing the scan on this device and showing me all wifi in the area. The only thing that doesn't appear to work is calling iwinfo from terminal.

I checked network.js that LuCI uses, it appears to use iwinfo scan as well,

const callIwinfoScan=rpc.declare({object:'iwinfo',method:'scan',params:['device'],nobatch:true,expect:{results:[]}});

what does it use for 'device', in LuCI interface it shows 'radio0'?

I had country set when created AP, and running in 2.4Ghz mode (see last config version in original post):
option htmode 'VHT40'
option country 'US'
iwinfo radio0 scan still doesn't work. LuCI didn't have problem with original config

From LuCI:
Generic MAC80211 802.11ac/ax/b/g/n
Channel: 1 (2.412 GHz) | Bitrate: 26 Mbit/s

for dev in $(iw dev | grep Interface | awk '{ print $2 }'); do iw dev $dev scan; done

radio0 is the uci section name.
iwinfo expects the ifname, not the uci section name, but you have not set the ifname option.
Therefore it will default to an ifname of, most likely phy0-ap0

You can however just run iwinfo with no arguments and it will list information by ifname.

Here is an example from my test system:

root@meshnode-8ecb:~# iwinfo
m-11s-0 ESSID: "92d490daf46cfe534c56ddd669297e"
         Access Point: 96:83:c4:a3:8e:cb
         Mode: Mesh Point  Channel: 1 (2.412 GHz)  HT Mode: HE40
         Center Channel 1: 1 2: unknown
         Tx-Power: 20 dBm  Link Quality: 70/70
         Signal: -33 dBm  Noise: -90 dBm
         Bit Rate: 96.2 MBit/s
         Encryption: none
         Type: nl80211  HW Mode(s): 802.11ax/n/g/b
         Hardware: embedded [MediaTek MT7986]
         TX power offset: none
         Channel offset: none
         Supports VAPs: yes  PHY name: phy0

phy0-ap0 ESSID: "MeshGate-2g-8ecb"
         Access Point: 96:83:c4:a5:8e:cb
         Mode: Master  Channel: 1 (2.412 GHz)  HT Mode: HE40
         Center Channel 1: 3 2: unknown
         Tx-Power: 20 dBm  Link Quality: 70/70
         Signal: 0 dBm  Noise: -91 dBm
         Bit Rate: unknown
         Encryption: OWE (CCMP)
         Type: nl80211  HW Mode(s): 802.11ax/n/g/b
         Hardware: embedded [MediaTek MT7986]
         TX power offset: none
         Channel offset: none
         Supports VAPs: yes  PHY name: phy0

phy1-ap1 ESSID: "MeshGate-5g-8ecb"
         Access Point: 96:83:c4:a6:8e:cb
         Mode: Master  Channel: 36 (5.180 GHz)  HT Mode: HE80
         Center Channel 1: 42 2: unknown
         Tx-Power: 23 dBm  Link Quality: 70/70
         Signal: 0 dBm  Noise: -92 dBm
         Bit Rate: unknown
         Encryption: OWE (CCMP)
         Type: nl80211  HW Mode(s): 802.11ax/ac/n
         Hardware: embedded [MediaTek MT7986]
         TX power offset: none
         Channel offset: none
         Supports VAPs: yes  PHY name: phy1

vxradio0 ESSID: "VTunnel-2g-8ecb"
         Access Point: 96:83:c4:a7:8e:cb
         Mode: Master  Channel: 1 (2.412 GHz)  HT Mode: HE40
         Center Channel 1: 3 2: unknown
         Tx-Power: 20 dBm  Link Quality: 70/70
         Signal: 0 dBm  Noise: -90 dBm
         Bit Rate: unknown
         Encryption: OWE (CCMP)
         Type: nl80211  HW Mode(s): 802.11ax/n/g/b
         Hardware: embedded [MediaTek MT7986]
         TX power offset: none
         Channel offset: none
         Supports VAPs: yes  PHY name: phy0

vxradio1 ESSID: "VTunnel-5g-8ecb"
         Access Point: 96:83:c4:a8:8e:cb
         Mode: Master  Channel: 36 (5.180 GHz)  HT Mode: HE80
         Center Channel 1: 42 2: unknown
         Tx-Power: 23 dBm  Link Quality: 70/70
         Signal: 0 dBm  Noise: -92 dBm
         Bit Rate: unknown
         Encryption: OWE (CCMP)
         Type: nl80211  HW Mode(s): 802.11ax/ac/n
         Hardware: embedded [MediaTek MT7986]
         TX power offset: none
         Channel offset: none
         Supports VAPs: yes  PHY name: phy1

root@meshnode-8ecb:~# 

So then I can get a scan:

root@meshnode-8ecb:~# iwinfo phy0-ap0 scan
Cell 01 - Address: 96:83:C4:62:2A:52
	  ESSID: "VTunnel-2g-2a52"
	  Mode: Master  Frequency: 2.412 GHz  Band: 2.4 GHz  Channel: 1
	  Signal: -81 dBm  Quality: 29/70
	  Encryption: OWE (CCMP)
	  HT Operation:
		Primary Channel: 1
		Secondary Channel Offset: above
		Channel Width: 40 MHz or higher

Cell 02 - Address: 96:83:C4:2F:C5:24
	  ESSID: "MeshGate-2g-c524"
	  Mode: Master  Frequency: 2.412 GHz  Band: 2.4 GHz  Channel: 1
	  Signal: -23 dBm  Quality: 70/70
	  Encryption: OWE (CCMP)
	  HT Operation:
		Primary Channel: 1
		Secondary Channel Offset: above
		Channel Width: 40 MHz or higher

Cell 03 - Address: 96:83:C4:31:C5:24
	  ESSID: "VTunnel-2g-c524"
	  Mode: Master  Frequency: 2.412 GHz  Band: 2.4 GHz  Channel: 1
	  Signal: -22 dBm  Quality: 70/70
	  Encryption: OWE (CCMP)
	  HT Operation:
		Primary Channel: 1
		Secondary Channel Offset: above
		Channel Width: 40 MHz or higher

Cell 04 ......... etc.
1 Like

this only works if interface was already created, not on fresh install without any interfaces and only device being created by default or by running 'wifi config'
there is no phy0-ap0 yet. iwinfo by itself returns nothing

the reason I want to do iwinfo scan is to find AP to which to connect my router and create interface. Somehow I can do it via LuCI but not via terminal/script.

on my other router (gl-inet) i can run iwinfo on the uci wifi-device name and it works fine, for example
/etc/config/wireless

config wifi-device 'mt798111'
        option type 'mtk'
        option band '2g'
        option htmode 'HE40'
        option channel 'auto'
        option txpower '100'
        option country 'US'
        option random_bssid '1'
        option disabled '0'
        option legacy_rates '0'
        option noscan '0'
        option hwmode '11g'

iwinfo mt798111 scan returns expected result, list of wifi networks
mt798111 doesn't appear in 'ip a' output like phy0-ap0 would

To do that, you need to create a STA interface and scan on that. AFAIK that is what Luci does in the background.

For a STA, the default ifname would probably be phy0-sta0 or similar.

That is running the Gl-inet customised fork of OpenWrt and the proprietary mtk wireless API. Very likely the version of iwinfo is custom too.

The official OpenWrt version of iwinfo expects the ifname of the radio.

you are right, it appears LuCI creates tmp.radio0 physical interface while executing the scan. it also does it without modifying /etc/config/wireless

it seems the solution would be to create an interface in /etc/config/wireless

config wifi-iface 'default_radio0'
        option device 'radio0'
        option mode 'sta'

restart network and then find associated phy interface and run iwinfo on it.

is there a way to do it like LuCI does it only via terminal? without changing config file or restarting network?

Sure. But you are going to need a STA virtual interface anyway....

You could use the iw utility.
Create the interface:

iw phy <phyname> interface add <name> type <type> 

Scan using the interface name (ifname)

iw dev <ifname> scan dump

It is great to figure this out for yourself, but the hard work has been done in an OpenWrt package specially for the purpose. Not exactly your use case but pretty much identical if you think about it:

thank you! this was very helpful and saves me a lot of time!