On a linux system you can get details about the wifi adapter using commands like iw, iwconfig, iwlist, ethtool etc. However if you are a usb wifi adapter then it can be tricky.
When you plug a usb wifi adapter on your system, linux will not show the details of the device in the lspci command output. Even the lshw command will show limited details.
List all wifi devices
The following is a quick and simple command that lists out all the wifi devices along with their logical network names assigned to each one, making it easier to identify. The logical name is used other commands to perform various actions on the specific wifi device:
inxi -n
The output typically looks like the following. I have 1 ethernet card and 2 wifi usb adapters connected to this system.
$ inxi -n Network: Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169 IF: enp1s0 state: up speed: 1000 Mbps duplex: full mac: 1c:1b:0d:c8:82:4d Device-2: Edimax EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS] type: USB driver: rtl8xxxu IF: wlx74da38e88bd7 state: up mac: 74:da:38:e8:8b:d7 Device-3: Realtek RTL8192EU 802.11b/g/n WLAN Adapter type: USB driver: rtl8xxxu IF: wlx7898e8fda005 state: up mac: 78:98:e8:fd:a0:05 $
Note that for each network device, the brand name, model name, mac address, device driver and logical names are reported properly. This makes it vary easy to track down each device incase there are multiple devices involved. Most other commands will report either the brand/model name of the usb adapter or just the logical name, making it difficult to identify which one it is.
Further details about the bus id number and chip id can be found using the x option for extra information
inxi -nxx inxi -nxxx
Another command that can list out the details of all connected network adapters is this:
hwinfo --netcard
It will print out a lot more information compared to inxi, so be prepared to read.
If you just want to list out all the wifi devices, then use the iw dev command:
$ iw dev phy#7 Interface wlx7898e8fda005 ifindex 13 wdev 0x700000001 addr 78:98:e8:fd:a0:05 type managed channel 1 (2412 MHz), width: 20 MHz, center1: 2412 MHz txpower 1.00 dBm multicast TXQ: qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets 0 0 0 0 0 0 0 0 0 phy#6 Interface wlx74da38e88bd7 ifindex 12 wdev 0x600000001 addr 74:da:38:e8:8b:d7 type managed txpower 20.00 dBm multicast TXQ: qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets 0 0 0 0 0 0 0 0 0 $
The wireless interface which is actively connected will show channel information, and otherwise if its disconnected it will not show any channel information
Testing multiple usb wifi adapters
In this article we shall be testing a few usb wifi adapters and try extracting their hardware details using commands. Here is a list of the commands we shall be using:
- iw - super command to check details and modify settings of wireless devices
- lsusb - show details of usb connected devices
- iwlist - get deeper information about wireless devices, like freq band, transmission power etc
- iwconfig - configure various settings of a wireless device
- ethtool - check driver and hardware details of any network interface
- lshw - show all kinds of hardware details
The usb wifi adapters that we shall be using include, TP-Link WN722N, Edimax EW-7811Un, D-Link DWA-131.
1. TP-Link WN722N
This is a 150mbps Wifi4 adapter with an external antenna. USB Wifi adapter devices like these will not be shown in the output of lspci command as can be seen below.
$ lspci | grep -i network 0000:00:14.3 Network controller: Intel Corporation Wi-Fi 6 AX201 (rev 20) $
It just shows the internal wifi adapter and not the usb connected one. The reason is that its a usb connected device, and not a pci device.
The lshw command will detect and show the device.
sudo lshw -class network *-network description: Wireless interface product: Wi-Fi 6 AX201 vendor: Intel Corporation physical id: 14.3 bus info: pci@0000:00:14.3 logical name: wlp0s20f3 version: 20 serial: 90:cc:df:fd:97:c4 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=iwlwifi driverversion=5.19.0-26-generic firmware=71.058653f6.0 QuZ-a0-hr-b0-71.u latency=0 link=no multicast=yes wireless=IEEE 802.11 resources: iomemory:600-5ff irq:16 memory:601f274000-601f277fff *-network description: Wireless interface physical id: 11 bus info: usb@3:2 logical name: wlx1027f5995a8a serial: 10:27:f5:99:5a:8a capabilities: ethernet physical wireless configuration: broadcast=yes driver=r8188eu driverversion=5.19.0-26-generic ip=192.168.1.69 multicast=yes wireless=IEEE 802.11bgn $
The second network interface is the usb wifi adapter and there is very information about it. It does tell us the name of driver being used. Further details about the driver are given by the lsmod and modinfo command, as shown later.
Instead you have to use the lsusb command to view proper details.
$ lsusb Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 005: ID 1c7a:0575 LighTuning Technology Inc. EgisTec EH575 Bus 003 Device 004: ID 04f2:b6dd Chicony Electronics Co., Ltd HD User Facing Bus 003 Device 003: ID 04ca:00a8 Lite-On Technology Corp. Dell Wireless Mouse WM118 Bus 003 Device 010: ID 2357:010c TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS] Bus 003 Device 006: ID 8087:0026 Intel Corp. AX201 Bluetooth Bus 003 Device 009: ID 413c:2113 Dell Computer Corp. KB216 Wired Keyboard Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub $
Note the TP-Link TL-WN722N usb wifi adapter which is plugged into the system. Further details can be fetched with the "-v" verbose flag.
Note down the bus and device number which in this case is 003 and 010. Specify that with the "-s" flag to show only that particular device.
$ lsusb -s 003:010 Bus 003 Device 010: ID 2357:010c TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS] $
Now use the verbose flag
$ lsusb -s 003:010 -v Bus 003 Device 010: ID 2357:010c TP-Link TL-WN722N v2/v3 [Realtek RTL8188EUS] Couldn't open device, some information will be missing Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x2357 TP-Link idProduct 0x010c TL-WN722N v2/v3 [Realtek RTL8188EUS] bcdDevice 0.00 iManufacturer 1 Realtek iProduct 2 802.11n NIC iSerial 3 00E04C0001 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 0x0027 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 500mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 255 Vendor Specific Subclass bInterfaceProtocol 255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 bytes bInterval 0 $
The driver information can be fetched using the ethtool command
$ sudo ethtool -i wlx1027f5995a8a driver: r8188eu version: 5.19.0-26-generic firmware-version: expansion-rom-version: bus-info: 3-2:1.0 supports-statistics: no supports-test: no supports-eeprom-access: no supports-register-dump: no supports-priv-flags: no $
The drive in use over here is r8188eu. The loaded module for the respective driver can be checked with the lsmod command
$ lsmod | grep -i r8188eu r8188eu 438272 0 libarc4 16384 2 mac80211,r8188eu $
Now we can get more information about the driver using the modinfo command:
$ modinfo r8188eu filename: /lib/modules/5.19.0-26-generic/kernel/drivers/staging/r8188eu/r8188eu.ko version: v4.1.4_6773.20130222 author: Realtek Semiconductor Corp. description: Realtek Wireless Lan Driver license: GPL srcversion: 5972E20F50A68035A4FF79F ...
The iw command does not detect this particular usb wifi adapter. Because it is not compiled with CFG80211 support.
$ iw dev phy#0 Unnamed/non-netdev interface wdev 0x2 addr 90:cc:df:fd:97:c5 type P2P-device txpower 0.00 dBm Interface wlp0s20f3 ifindex 2 wdev 0x1 addr 90:cc:df:fd:97:c4 type managed channel 7 (2442 MHz), width: 20 MHz, center1: 2442 MHz txpower 21.00 dBm multicast TXQ: qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets 0 0 0 0 0 0 0 0 0 $
$ iw wlx1027f5995a8a link Not connected. $
It will keep saying not connected and will not be able to fetch any information about it.
The iw command will not be able to fetch information if the driver is not compiled with CFG80211 support. This can be verified by checking if the CFG80211 module is being used by the wifi driver.
$ lsmod | grep -i CFG80211 cfg80211 1040384 5 iwlmvm,rtlwifi,iwlwifi,mac80211,rtl8xxxu $
In the above output the modules on the right are using the "cfg80211" module. In this case, the driver r8188eu is not in the list.
$ iwlist wlx1027f5995a8a freq wlx1027f5995a8a 11 channels in total; available frequencies : Channel 01 : 2.412 GHz Channel 02 : 2.417 GHz Channel 03 : 2.422 GHz Channel 04 : 2.427 GHz Channel 05 : 2.432 GHz Channel 06 : 2.437 GHz Channel 07 : 2.442 GHz Channel 08 : 2.447 GHz Channel 09 : 2.452 GHz Channel 10 : 2.457 GHz Channel 11 : 2.462 GHz Current Frequency:2.442 GHz (Channel 7)
$ sudo iwlist wlx1027f5995a8a auth wlx1027f5995a8a Authentication capabilities : WPA WPA2 CIPHER-TKIP CIPHER-CCMP
$ sudo iwlist wlx1027f5995a8a rate wlx1027f5995a8a 4 available bit-rates : 1 Mb/s 2 Mb/s 5.5 Mb/s 11 Mb/s Current Bit Rate:72.2 Mb/s $
$ sudo iwlist wlx1027f5995a8a event wlx1027f5995a8a Wireless Events supported : wlx1027f5995a8a Scanning capabilities : - ESSID - BSSID - Channel - Mode - Rate - Type $
The private parameters are showing using iwpriv command:
$ iwpriv lo no private ioctls. wlp0s20f3 no private ioctls. wlx1027f5995a8a Available private ioctls : write (8BE0) : set 2047 char & get 0 read (8BE1) : set 2047 char & get 16 char driver_ext (8BE2) : set 0 & get 0 apinfo (8BE4) : set 1 int & get 0 setpid (8BE5) : set 2 int & get 0 wps_start (8BE6) : set 1 int & get 0 channel_plan (8BEA) : set 1 int & get 0 dbg (8BEB) : set 2 int & get 0 rfw (8BEC) : set 3 int & get 0 rfr (8BED) : set 2 int & get 16 char p2p_set (8BF0) : set 64 char & get 0 p2p_get (8BF1) : set 64 char & get 64 char p2p_get2 (8BF2) : set 64 char & get 16 char pm_set (8BF6) : set 64 char & get 0 rereg_nd_name (8BF8) : set 16 char & get 0 $
2. Edimax EW-7811Un 802.11n Wireless Adapter
The next usb wifi adapter is Edimax EW-7811Un Wifi4 adapter supporting upto 150mbps speed.
The iw command was able to detect this one:
$ iw dev phy#4 Interface wlx74da38e88bd7 ifindex 9 wdev 0x400000001 addr 74:da:38:e8:8b:d7 type managed txpower 20.00 dBm phy#0 Unnamed/non-netdev interface wdev 0x2 addr 90:cc:df:fd:97:c5 type P2P-device txpower 0.00 dBm Interface wlp0s20f3 ifindex 2 wdev 0x1 addr 90:cc:df:fd:97:c4 type managed channel 7 (2442 MHz), width: 20 MHz, center1: 2442 MHz txpower 21.00 dBm multicast TXQ: qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets 0 0 0 0 0 0 0 0 0 $
The phy#4 is the edimax wifi adapter. We can note down the interface name and get further details.
$ iw wlx74da38e88bd7 info Interface wlx74da38e88bd7 ifindex 4 wdev 0x100000001 addr 74:da:38:e8:8b:d7 type managed wiphy 1 txpower 20.00 dBm $
The addr field shows the mac address and txpower is the radio transmission power level.
Driver information can be found with ethtool or lshw command
$ sudo ethtool -i wlx74da38e88bd7 driver: rtl8192cu version: 5.19.0-29-generic firmware-version: N/A expansion-rom-version: bus-info: 3-2:1.0 supports-statistics: yes supports-test: no supports-eeprom-access: no supports-register-dump: no supports-priv-flags: no $
Note driver: rtl8192cu
$ sudo lshw -C network *-network description: Wireless interface product: Wi-Fi 6 AX201 vendor: Intel Corporation physical id: 14.3 bus info: pci@0000:00:14.3 logical name: wlp0s20f3 version: 20 serial: 90:cc:df:fd:97:c4 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=iwlwifi driverversion=5.19.0-29-generic firmware=71.058653f6.0 QuZ-a0-hr-b0-71.u ip=192.168.1.44 latency=0 link=yes multicast=yes wireless=IEEE 802.11 resources: iomemory:600-5ff irq:16 memory:601f274000-601f277fff *-network description: Wireless interface physical id: 11 bus info: usb@3:2 logical name: wlx74da38e88bd7 serial: 74:da:38:e8:8b:d7 capabilities: ethernet physical wireless configuration: broadcast=yes driver=rtl8192cu driverversion=5.19.0-29-generic firmware=N/A link=no multicast=yes wireless=IEEE 802.11 acerlight@acerlight-laptop:~$
The driver being used this time is rtl8192cu and it is
$ lsmod | grep -i rtl8192cu rtl8192cu 106496 0 rtl_usb 20480 1 rtl8192cu rtl8192c_common 86016 1 rtl8192cu rtlwifi 122880 3 rtl8192c_common,rtl_usb,rtl8192cu mac80211 1327104 5 iwlmvm,rtl_usb,rtl8192cu,rtlwifi,rtl8xxxu $ $ lsmod | grep -i CFG80211 cfg80211 1040384 5 iwlmvm,rtlwifi,iwlwifi,mac80211,rtl8xxxu $
From the above output we can see that rtl8192cu relies on rtlwifi which relies on cfg80211. Hence the driver works with the iw command properly.
3. D-Link DWA-131
The next device is dlink dwa131 which is also a n300 nano usb2.0 wifi adapter. Although this device claims 300mbps of speed, it requires 40mhz channel width on 2.4ghz band to reach that speed, which i could not see happen at all.
The device most of time used 20mhz channel only and the speed never went above 144.4mbps (mcs15). Honestly this feels like deceptive marketing.
The iw command can detect this device
$ iw dev phy#5 Interface wlx7898e8fda005 ifindex 11 wdev 0x500000001 addr 78:98:e8:fd:a0:05 type managed txpower 20.00 dBm phy#0 Unnamed/non-netdev interface wdev 0x2 addr 90:cc:df:fd:97:c5 type P2P-device txpower 0.00 dBm Interface wlp0s20f3 ifindex 2 wdev 0x1 addr 90:cc:df:fd:97:c4 type managed channel 7 (2442 MHz), width: 20 MHz, center1: 2442 MHz txpower 21.00 dBm multicast TXQ: qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets 0 0 0 0 0 0 0 0 0 $
Device information
$ iw wlx7898e8fda005 info Interface wlx7898e8fda005 ifindex 11 wdev 0x500000001 addr 78:98:e8:fd:a0:05 type managed wiphy 5 channel 7 (2442 MHz), width: 20 MHz, center1: 2442 MHz txpower 20.00 dBm $
For full hardware details of this adapter we can use the info option with iw command. It will show all the supported frequencies, bands and channel width.
iw phy5 info
Link information is available when connected to some wifi network. This will show the connection frequency channel, signal strength, bitrate, mcs index being used along with ssid and mac address.
$ iw wlx7898e8fda005 link Connected to 98:35:ed:d4:e1:48 (on wlx7898e8fda005) SSID: AirtelFiber freq: 2442 RX: 351125 bytes (2124 packets) TX: 51427 bytes (349 packets) signal: -100 dBm rx bitrate: 39.0 MBit/s MCS 10 tx bitrate: 144.4 MBit/s MCS 15 short GI bss flags: short-slot-time dtim period: 1 beacon int: 100 $
The driver details can be checked with ethtool command.
$ sudo ethtool -i wlx7898e8fda005 driver: rtl8xxxu version: 5.19.0-29-generic firmware-version: N/A expansion-rom-version: bus-info: 3-2:1.0 supports-statistics: yes supports-test: no supports-eeprom-access: no supports-register-dump: no supports-priv-flags: no $
The driver rtl8xxxu uses cfg80211 module hence this driver works perfectly fine with iw command. This can be verified with the lsmod command.
lsmod | grep -i rtl8xxxu rtl8xxxu 151552 0 mac80211 1327104 5 iwlmvm,rtl_usb,rtl8192cu,rtlwifi,rtl8xxxu cfg80211 1040384 5 iwlmvm,rtlwifi,iwlwifi,mac80211,rtl8xxxu $
If a wifi adapter works well with iw command, it should ideally work with wavemon as well and show connection details in realtime.
Since this is a usb connected wifi adapter, some product details checked with lsusb command
$ lsusb Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 006: ID 1c7a:0575 LighTuning Technology Inc. EgisTec EH575 Bus 003 Device 005: ID 04f2:b6dd Chicony Electronics Co., Ltd HD User Facing Bus 003 Device 004: ID 04ca:00a8 Lite-On Technology Corp. Dell Wireless Mouse WM118 Bus 003 Device 015: ID 0bda:818b Realtek Semiconductor Corp. RTL8192EU 802.11b/g/n WLAN Adapter Bus 003 Device 007: ID 8087:0026 Intel Corp. AX201 Bluetooth Bus 003 Device 002: ID 413c:2113 Dell Computer Corp. KB216 Wired Keyboard Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub acerlight@acerlight-laptop:~$
Note the line
Bus 003 Device 015: ID 0bda:818b Realtek Semiconductor Corp. RTL8192EU 802.11b/g/n WLAN Adapter
It does not mention D-Link anywhere, which is silly! This wifi adapter uses the RTL8192EU wifi chip.
Conclusion
If you are using a usb wifi dongle on linux and want to diagnose speed issues then the above commands will provide you with all the necessary information.
Sometimes you can change some configuration settings in your router to boost the speed. For example forcing 40Mhz channel width on 2.4Ghz band can double your speed on wifi4. As most cheap usb wifi adapters are wifi4 based this can be an advantage.
Furthermore look at the signal strength (negative dBm) and make sure that it is within good limits for proper speed. Most nano-sized usb wifi adapters have very small antennas that cause severe drop in signal strength thereby limiting the speed.
Adapters with an antenna tend to perform better in this regard.
I have a failing adapter. Sudo iwlist and inxi -Fxxxrz tells me it is an Intel Wireless-AC 9462. My computer manufacturer (system 76) tells me it is an Intel WiFi 6 AX 201. How accurate are these commands? I would like to have the correct card before taking my laptop apart.
Intel Wireless-AC 9462 supports 802.11ac (upto Wifi5)
Intel WiFi 6 AX 201 supports 802.11ax (upto Wifi6)
Check official intel docs for both.
What linux distro are you actually using ? Try running a live instance of the latest Ubuntu which should have the most uptodate drivers.
In my experience the latest version of Ubuntu 22.10 works well with Intel WiFi 6 AX 201 and recognises it correctly.
If the latest ubuntu still shows intel AC 9462, then its probably correct.
make sure to confirm with “lshw -C network” command for accurate model name detection
I am running Mint. I hated the Gnome Desktop Pop uses. I will try a live disk. I have about 8 different OS’s on them.
Thanks. Are they interchangeable (the same size shape and connections) so if I changed out the AC 9462 for the AX 201 it would fit properly? I can buy either reasonably priced from amazon.
whether you can swap one with the other depends on the “connector”.
Modern laptops have M.2 connector/form factor based wifi adapters. It should be (in theory) be possible to easily replace one with another.
however i have no experience in this.
you might try opening the laptop chassis, and take a look at the form factor of the wifi adapter and compare with picture of the other one that you plan to use.