Skip to main content

Wi-Fi: Helpful Commands

There are a lot of ways to do the same things with Wi-Fi using slightly different commands. Some commands work for all M.2 boards and some only work for one type of M.2 boards (i.e. one chipset).

mlan0 or wlan0?

NXP based M.2 modules will appear as mlan0 interfaces in Linux while Infineon based M.2 modules will appear as wlan0. These are two alternative ways of finding out which one it is:

Lookup the M.2 module in the table on the iMX 6/7/8 page.

or

root@imx8mnea-ucom:~# iw dev
phy#0
Interface wfd0
ifindex 5
wdev 0x3
addr 2e:4c:c6:f4:d3:d0
type managed
txpower 24.00 dBm
Interface uap0
ifindex 4
wdev 0x2
addr 2c:4c:c6:f4:d4:d0
type AP
txpower 24.00 dBm
Interface mlan0 <-- it will be shown here
ifindex 3
wdev 0x1
addr 2c:4c:c6:f4:d3:d0
ssid EA Guest
type managed
channel 4 (2427 MHz), width: 20 MHz, center1: 2427 MHz
txpower 24.00 dBm

Scan for networks

This works with both mlan0 and wlan0:

root@imx8mnea-ucom:~# iw dev mlan0 scan
root@imx8mnea-ucom:~# iw dev wlan0 scan

But this only works for mlan0:

root@imx8mnea-ucom:~# iwlist mlan0 scan

Connect to Open/Unprotected AP

Works with both mlan0 and wlan0

root@imx8mnea-ucom:~# iw dev mlan0 connect TestNetwork
root@imx8mnea-ucom:~# iw dev wlan0 connect TestNetwork

Currently connected to...

Works with both mlan0 and wlan0

root@imx8mnea-ucom:~# iw dev mlan0 link
Connected to 88:d7:f6:6b:75:50 (on mlan0)
SSID: EA Guest
freq: 2427
RX: 145444 bytes (3693 packets)
TX: 16898 bytes (251 packets)
signal: -78 dBm
rx bitrate: 1.0 MBit/s
tx bitrate: 19.5 MBit/s MCS 2

bss flags: short-slot-time
dtim period: 3
beacon int: 100

If not currently connected to a network:

root@imx8mnea-ucom:~# iw dev mlan0 link
Not connected.

Fixed IP

Edit /etc/systemd/network/25-wireless-mlan0.network or /etc/systemd/network/20-wireless-wlan0.network depending on which interface is being used.

Change

[Network]
DHCP=yes

into

[Network]
Address=192.168.1.47
Gateway=192.168.1.1
DNS=8.8.8.8

This is not applicable when using ConnMan.

Get firmware version

For wlan0:

wl ver

For mlan0:

root@imx8mnea-ucom:~# /usr/share/nxp_wireless/mlanutl mlan0 verext
Extended Version string received: w8978o-V0, RF878X, FP92, 16.92.21.p41.1

Switch regions

This is not applicable for all modules, for a list of which modules are supported run

root@imx8mnea-ucom:~# switch_regions.sh

Version: 1.0

Usage:
/usr/sbin/switch_regions.sh <module> <country code>

Where:
<module> is one of :
1zm, 1ym, 1xk, 2ds

<country code> is one of :
CA, EU, JP, US

For example, to switch to Japan as a region on an 1XK M.2 module:

root@imx8mnea-ucom:~# switch_regions.sh 1XK JP

Setting up for 1XK (64 bit):
----------------------------
Directory /usr/lib/crda does not exist.
Creating crda in /usr/lib/
Setup complete.

global
country 98: DFS-UNSET
(2402 - 2482 @ 40), (N/A, 20), (N/A)
(2474 - 2483 @ 9), (N/A, 20), (N/A), NO-OFDM
(5170 - 5250 @ 80), (N/A, 20), (N/A), NO-OUTDOOR, AUTO-BW
(5250 - 5330 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
(5490 - 5710 @ 160), (N/A, 23), (0 ms), DFS
(57000 - 66000 @ 2160), (N/A, 10), (N/A)

root@imx8mnea-ucom:~# reboot

After rebooting run

root@imx8mnea-ucom:~# iw reg set JP
root@imx8mnea-ucom:~# iw reg get
global
country JP: DFS-JP
(2402 - 2482 @ 40), (N/A, 20), (N/A)
(2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM
(4910 - 4990 @ 40), (N/A, 23), (N/A)
(5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW
(5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW
(5490 - 5710 @ 160), (N/A, 23), (0 ms), DFS
(57000 - 66000 @ 2160), (N/A, 10), (N/A)