WiFi

From MOD Wiki
Revision as of 16:34, 31 October 2020 by FalkTX (talk | contribs) (→‎Steps)
Jump to navigation Jump to search

Starting from v1.10, it is possible to connect a MOD unit to a wireless network. We can achieve this by using a WiFi USB dongle, connected on the back of the unit.

Please note this is an advanced and experimental feature, currently requiring knowledge of command-line.

Steps

  1. Power on the unit
  2. Connect it to a PC via USB cable
  3. Plug the WiFi USB adapter/stick on the back of the unit
  4. SSH into the device
  5. Create and edit the file /data/wpa_supplicant.conf (this can be done with nano /data/wpa_supplicant.conf or vi /data/wpa_supplicant.conf as you prefer),

Inside this file, write the following contents:

ctrl_interface=/run/wpa_supplicant
update_config=1
network={
        ssid="MyWiFiSSID"
        psk="password-goes-here"
}
  1. Modify "MyWiFiSSID" and "password" as needed for your network (NOTE: the quotes are necessary)
  2. Run systemctl restart wpa-supplicant-wlan0 dhcpcd-wlan0 to activate WiFi services (not needed on subsequent boots)
  3. Run systemctl status wpa-supplicant-wlan0 to verify that service is running correctly.

If you see "Active: active (running)" then all is fine, WiFi is working; otherwise continue to the custom firmware deploy steps. (edited)

Custom firmware deploy

In case it might be needed custom firmware (which MOD Devices does not ship), we need to find out which firmware to install. Here are the steps:

  1. Run dmesg | tail and look for an error message like this;
[  293.903337] ieee80211 phy0: rt2x00lib_request_firmware: Error - Failed to request Firmware
[  293.909338] ieee80211 phy0: rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
  1. Note what is the firmware you need, in this example case it is 'rt2870.bin'
  2. Download the firmware (for example, from the linux-firmware project using https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-20200918.tar.gz or similar)
  3. Create the firmware folder inside the SSH session, by running mkdir /data/firmware
  4. Copy the firmware over SSH to this new folder, using something like scp /path/to/firmware.bin root@192.168.51.1:/data/firmware/
  5. Unplug and replug the WiFi usb stick

Finalizing

We can verify that everything is working by running dmesg inside the SSH session and checking the latest messages. If all is ok, you should see something like this:

[ 1321.759528] wlan0: authenticate with 00:06:91:64:12:a0
[ 1321.801547] wlan0: send auth to 00:06:91:64:12:a0 (try 1/3)
[ 1321.804295] wlan0: authenticated
[ 1321.805147] wlan0: associate with 00:06:91:64:12:a0 (try 1/3)
[ 1321.808800] wlan0: RX AssocResp from 00:06:91:64:12:a0 (capab=0x1411 status=0 aid=4)
[ 1321.815169] wlan0: associated

Finding IP address

After the unit connects to the WiFi, you can know the IP address by running ifconfig.
On the "wlan0" section you see the IP, like this:

wlan0     Link encap:Ethernet  HWaddr B8:A3:86:02:18:62  
          inet addr:192.168.1.126  Bcast:192.168.1.255  Mask:255.255.255.0

Bonus: if your OS and WiFi network supports zeroconf/mDNS, you can now at this point remove the USB cable and connect to the unit via http://modduo.local/ or http://modduox.local/.
This allows to keep using the plugin store and software updates. (which is blocked when using the WiFi IP directly)

Useful resources

  1. https://wiki.archlinux.org/index.php/Wpa_supplicant
  2. https://wiki.archlinux.org/index.php/Network_configuration/Wireless#iw