User:Hastalavista/Mi4C WiFi Problem Log

From postmarketOS

Progress as of now

Installed postmarketOS on my Xiaomi Mi 4C by pmbootstrapping device xiaomi-libra, but unlike the device page suggests, WiFi didn't work out of the box.

After checking various log files in /var/log I found a file named /var/log/firmwareload.log. It seems that, everytime the device reboots, some log entries mentioning about missing firmware gets logged in this file:

cannot find firmware file 'evicted30.bin'
cannot find firmware file 'bdwlan30.b00'
cannot find firmware file 'wlan/qca_cld/wlan_mac.bin'

And bdwlan30.b00 and wlan/qca_cld/wlan_mac.bin does seem to be WiFi-related.

bdwlan30.b00

After searching for a while, I found a like-named file bdwlan30.bin in /lib/firmware/postmarketos. After renaming /lib/firmware/postmarketos/bdwlan30.bin to /lib/firmware/postmarketos/bdwlan30.b00 and rebooted, line cannot find firmware file 'bdwlan30.b00' stopped appearing in the firmwareload.log file, which might suggests I have done it right?

wlan/qca_cld/wlan_mac.bin

As for the wlan/qca_cld/wlan_mac.bin file, I found a symbolic link in LineageOS' system partition. It seems to indicate the file is in the userdata partition, before I overwrite that partition with postmarketOS:

libra:/android_system# find -name wlan_mac.bin
./etc/firmware/wlan/qca_cld/wlan_mac.bin
libra:/android_system# cd etc/firmware/wlan/qca_cld/
libra:/android_system/etc/firmware/wlan/qca_cld# ls -alh
total 8K
drwxr-xr-x    2 root     root        4.0K Jan  1  2009 .
drwxr-xr-x    3 root     root        4.0K Jan  1  2009 ..
lrw-r--r--    1 root     root          30 Jan  1  2009 WCNSS_cfg.dat -> /system/etc/wifi/WCNSS_cfg.dat
lrw-r--r--    1 root     root          35 Jan  1  2009 WCNSS_qcom_cfg.ini -> /system/etc/wifi/WCNSS_qcom_cfg.ini
lrw-r--r--    1 root     root          39 Jan  1  2009 WCNSS_qcom_wlan_nv.bin -> /system/etc/wifi/WCNSS_qcom_wlan_nv.bin
lrw-r--r--    1 root     root          28 Jan  1  2009 wlan_mac.bin -> /data/misc/wifi/wlan_mac.bin

However, searching on Github revealed a interesting commit by LineageOS people:

https://github.com/LineageOS/android_kernel_xiaomi_msm8992/commit/ee11c1e64c6b471b8e58a35b86f2d2a899373dca

qcacld: Update mac address using /persist/wlan_mac.bin
We give user defined file /persist/wlan_mac.bin the highest priority of updating mac address. If this file exist, we overwrite current mac address with the value provided by wlan_mac.bin.

It seems wlan/qca_cld/wlan_mac.bin is present in android persist partition, too. Some time digging in:

libra:~# blkid |grep persist
/dev/mmcblk0p39: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="persist" PARTUUID="27d8d83b-2d8e-1126-614c-e29397c94232"
libra:~# mount -o ro /dev/mmcblk0p39 /mnt
libra:~# cd /mnt
libra:/mnt# ls
bluetooth              display                intendAndRealLocation  properties             rfs                    st_hub_calib_data.dat
data                   hlos_rfs               lost+found             property               sensors                wlan_bt
libra:/mnt# cd wlan_bt/
libra:/mnt/wlan_bt# ls
bt.mac    wlan.mac

I tried to copy the wlan.mac file to /lib/firmware/postmarketos/wlan/qca_cld/wlan_mac.bin and reboot. Good news is, now firmwareload.log doesn't log cannot find firmware file 'wlan/qca_cld/wlan_mac.bin' either. Bad news? WiFi interface still isn't there. Maybe the firmware file evicted30.bin is related to WiFi, too?

If you have a Xiaomi 4C with working WiFi, or a Xiaomi 4C on rooted Android, please drop me a line, I would be very grateful if you can help me with the missing firmware file 😘

Matrix: @hastalavista:obermui.de