WiFi
General information
To get wireless LAN working, most WiFi chips need a proprietary firmware blob. While it would be more secure to replace that with open source software in the long term, it isn't feasible right now, so we try to get it working with that closed source firmware.
A great place to start looking for information about many available WiFi chips is this kernel.org page. It often provides driver sources and the required firmware blobs as well. For a start if you want Internet working try the USB Internet guide.
Android-specific
Instead of mounting Android's firmware partition, we package the files ourselves (see the FAQ). |
Requirements:
- WiFi firmware files
- Some firmwares need additional config files with calibration data, these can usually be found in the LineageOS or Google repositories.
- Make sure all files get installed properly (look at the packaging of other devices with working wifi in our
aports/device
folder)
Path to firmware
Usually your Android kernel expects the firmware files to be in a folder like /system/vendor/firmware
and you need to patch the kernel and change the path to /lib/firmware/postmarketos
(see this patch. Sometimes there is no need to patch, but simply change a kernel option that defines this path.
Debugging
- Find the wifi device name with
ip link
(wlan0
on most phones) - Try to start the wlan interface with
ip link set wlan0 up
.
When that worked, you're done with this section. Otherwise look in the following places for errors (such as missing firmware files):
dmesg
tail /var/log/firmwareload.log
If there is nothing helpful in these files, continue reading. The original OS may run a userspace application, that enables the wifi driver by doing essentially echo 1 > /dev/wcnss_wlan
and echo sta > /sys/module/wlan/parameters/fwpath
or execute similar commands. This was the case for wcnss-wlan
(see aports/main/wcnss-wlan
for how we packaged it).
Try to compare your sysfs and dmesg
output with the one of a known working ROM after you have connected to a wireless network. Look for differences in /sys/module/wlan/
.
Connecting to APs
In #388 we enabled NetworkManager. You might need to set your wlan interface to unmanaged in NetworkManager to configure it manually. |
postmarketOS currently configures the wpa_supplicant service to start on boot. This service will fail to start unless /etc/wpa_supplicant/wpa_supplicant.conf
has been defined. This can be configured using the wpa_passphrase
utility:
$ wpa_passphrase YOUR_SSID YOUR_PASSPHRASE | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf
Note: If you are connecting to a hidden wireless network, make sure to add line "scan_ssid=1" after the ssid line in your generated conf file
Next you'll need to set up the networking
service by adding interfaces to /etc/network/interfaces
. In some cases, the loopback device may need to precede the wlan interface:
auto lo iface lo inet loopback auto wlan0 iface wlan0 inet dhcp
Finally, set the networking service to start on boot:
$ sudo rc-update add networking default
Note that on some systems (e.g. the RX51) you may have to configure wpa_supplicant to use the Linux kernel wireless extensions by editing /etc/conf.d/wpa_supplicant
:
wpa_supplicant_args="-Dwext"
You will have to reboot, or manually restart the aforementioned services, before your device will connect to the access point.
Using NetworkManager command line
It is possible to use NetworkManager to connect to a wifi access point using nmcli or nmtui command line.
$ sudo nmcli device wifi list ifname wlan0
$ sudo nmcli device wifi ifname wlan0 connect "$SSID" password "$PASSWORD"
Start WIFI manually
If you experience problems or just want to test wifi you can start wpa supplicant (using -Dwext or nl80211 driver) and the dhcp service:
sudo wpa_supplicant -u -Dnl80211 -B -c /etc/wpa_supplicant/wpa_supplicant.conf -iwlan0 sudo udhcpc -i wlan0