Wifi Privacy Switch without rebooting
#1
Lightbulb 
update 2020.06.16: some recent kernel update has changed the naming of the wifi device - now fe310000.mmc. For those who like a compact one-liner:

Code:
sudo tee /sys/bus/platform/drivers/dwmmc_rockchip/{un,}bind <<< "$(basename /sys/devices/platform/fe310*)"



TL;DR: use the two commands here to restart the Wifi driver after powering the Wifi again with the Privacy Switch for Wifi (Pine + F11) :
Code:
$ echo 'fe310000.dwmmc' | sudo tee /sys/bus/platform/drivers/dwmmc_rockchip/unbind
$ echo 'fe310000.dwmmc' | sudo tee /sys/bus/platform/drivers/dwmmc_rockchip/bind



The full story :

(Moving to a more general thread, because currently my reply is burried in the middle of the Manjaro discussion)

Currently, the privacy switch for Wifi cannot put back Wifi on because soldered-on-motherboard SDIO modules aren't Plug'n'Play.

Here's what you normally see if you try the usual rmmod  + modprobe route:

Code:
$ sudo rmmod brcmfmac brcmutil cfg80211
$ modprobe brcmfmac
$ dmesg
[ 1299.511038] usbcore: deregistering interface driver brcmfmac
[ 1313.114017] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1313.114781] cfg80211: failed to load regulatory.db
[ 1313.132537] brcmfmac: probe of mmc0:0001:1 failed with error -110
[ 1313.133192] brcmfmac: probe of mmc0:0001:2 failed with error -110
[ 1313.133865] usbcore: registered new interface driver brcmfmac



There is a way though:

You can find the actual soldered device that answers on the mmcn mentioned above and unbind and re-bind it.

Code:
$ ls -d /sys/devices/platform/*.dwmmc/mmc_host/mmc0
/sys/devices/platform/fe310000.dwmmc/mmc_host/mmc0
$ ls -d /sys/devices/platform/*.dwmmc/mmc_host/mmc*/mmc*/mmc*/ieee80211
/sys/devices/platform/fe310000.dwmmc/mmc_host/mmc0/mmc0:0001/mmc0:0001:2/ieee80211
$ echo 'fe310000.dwmmc' | sudo tee /sys/bus/platform/drivers/dwmmc_rockchip/unbind
$ echo 'fe310000.dwmmc' | sudo tee /sys/bus/platform/drivers/dwmmc_rockchip/bind
$ dmesg
[ 1845.593897] mmc0: card 0001 removed
[ 1849.712047] dwmmc_rockchip fe310000.dwmmc: IDMAC supports 32-bit address mode.
[ 1849.712707] dwmmc_rockchip fe310000.dwmmc: Using internal DMA controller.
[ 1849.713307] dwmmc_rockchip fe310000.dwmmc: Version ID is 270a
[ 1849.713840] dwmmc_rockchip fe310000.dwmmc: DW MMC controller at irq 27,32 bit host data width,256 deep fifo
[ 1849.714799] dwmmc_rockchip fe310000.dwmmc: allocated mmc-pwrseq
[ 1849.715321] mmc_host mmc0: card is non-removable.
[ 1849.728861] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
[ 1849.777673] mmc_host mmc0: Bus speed (slot 0) = 148500000Hz (slot req 150000000Hz, actual 148500000HZ div = 0)
[ 1850.622467] dwmmc_rockchip fe310000.dwmmc: Successfully tuned phase to 47
[ 1850.627007] mmc0: new ultra high speed SDR104 SDIO card at address 0001
[ 1850.636215] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43456-sdio for chip BCM4345/9
[ 1852.731997] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43456-sdio for chip BCM4345/9
[ 1852.732808] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[ 1852.734049] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/9 wl0: Sep  7 2018 14:33:37 version 7.45.96.27 (42b546f@shgit) (r) FWID 01-c958c084 es7.c5.n4.a3
[ 1860.053215] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

Note -if I'm not mistaken :
  • the 'mmc0' numbering might change depending on how your OS enumerate its devices (see how /dev/mmcblk changes - on Manjaro the Wifi is on mmc0 and the internal eMMC is on mmc2, but on the factory shipped Debian - Wifi is on mmc2 and mmc0 has the external µSD)
  • but fe310000.dwmmc is how this soldered MMC interface is mapped to the Rockchip and is fixed accross OSes (it is set in the .dtb)

the bind + unbind trick can also be used if the Broadcom Wifi chip has gone crazy and needs restarting.

(source: other people with similar problems of soldered MMC modules)
  Reply
#2
Thanks for posting this, I was already wondering if it could work this way Smile
Come have a chat in the Pine A64 IRC channel >>
  Reply
#3
Great post. Don't want to move it to tutorials? also, link it to Wiki please in relevant section.
You can find me on IRC, Discord and Twitter


  Reply
#4
(11-13-2019, 06:13 PM)Luke Wrote: Great post. Don't want to move it to tutorials?

If you think it has its place there, feel free to move it (or is it something non-admin can do too ?)

Though the best long-term solution, as I've written in the Manjaro thread, would be to get the EC-firmware guys to have the keyboard also emit simulated "Wifi Soft-kill" keypresses, and the Linux side of things to do such SDIO rescan automatically whenever the EC send such key press.

(11-13-2019, 06:13 PM)Luke Wrote: also, link it to Wiki please in relevant section.

The Wiki is pointing to this trick as of now. I can also add a reverse-link.
  Reply
#5
Think this is fine, thanks.
You can find me on IRC, Discord and Twitter


  Reply
#6
I like one-liners.
Code:
sudo tee /sys/bus/platform/drivers/dwmmc_rockchip/{un,}bind <<< 'fe310000.dwmmc'
  Reply
#7
Just a quick note: I just tried this (rebooting is for other OS-es), and found that on my PineBook Pro (received just over a week ago) I have to use fe310000.mmc instead of fe310000.dwmmc (mmc instead of dwmmc).
  Reply
#8
(06-13-2020, 04:50 AM)robt Wrote: I have to use fe310000.mmc instead of fe310000.dwmmc (mmc instead of dwmmc).

Sorry for the slow reply, my day job is in virology research and you can imagine that the past couple of months have been a tsunami of extra work.

I finally got time to check and: indeed, the name of the device has changed in some recent kernel update (didn't have time to track which):

Code:
$ ls -ld /sys/devices/platform/fe310*      
drwxr-xr-x 4 root root 0 Jun 16 10:03 /sys/devices/platform/fe310000.mmc
$ journalctl | grep 'fe3100'
Jun 15 23:42:56 nereid kernel: dwmmc_rockchip fe310000.mmc: IDMAC supports 32-bit address mode.
Jun 15 23:42:56 nereid kernel: dwmmc_rockchip fe310000.mmc: Using internal DMA controller.
Jun 15 23:42:56 nereid kernel: dwmmc_rockchip fe310000.mmc: Version ID is 270a
Jun 15 23:42:56 nereid kernel: dwmmc_rockchip fe310000.mmc: DW MMC controller at irq 27,32 bit host data width,256 deep fifo
Jun 15 23:42:56 nereid kernel: dwmmc_rockchip fe310000.mmc: allocated mmc-pwrseq
Jun 15 23:42:56 nereid kernel: dwmmc_rockchip fe310000.mmc: Successfully tuned phase to 56
Jun 15 23:43:03 nereid NetworkManager[931]: <info>  [1592257383.1179] rfkill0: found Wi-Fi radio killswitch (at /sys/devices/platform/fe310000.mmc/mmc_host/mmc0/mmc0:0001/mmc0:0001:1/ieee80211/phy0/rfkill0) (driver brcmfmac)

If one is not allergic to overly long one-line, it's automagically always findable with:
Code:
basename $(dirname $(dirname $(dirname $(dirname $(dirname /sys/devices/platform/*mmc/mmc_host/mmc*/mmc*/mmc*/ieee80211)))))
or
Code:
echo /sys/devices/platform/[0-9a-f]*mmc/mmc_host/mmc*/mmc*/mmc*/ieee80211|grep -oP '[0-9a-f]{8,}\.[^/]+'
  Reply
#9
Thanks for the reply and the one-liners, and keep up the good work on the tsunami front. I'm actually also very busy at work related to Covid19 but on a completely different end, yet geographically nearby - I'm looking onto the Limmat as I write this... ;-)
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Manjaro and Arch repository with privacy oriented software as400 58 9,753 09-24-2020, 10:31 AM
Last Post: as365n4
  Failing to install usb wifi adapter Debian older PBP AaronMFeld 0 80 09-14-2020, 07:42 PM
Last Post: AaronMFeld
  Changing regulatory domain (CRDA) on the wifi adapter newton688 3 423 06-30-2020, 04:32 PM
Last Post: newton688
  Wifi connection incomplete arp issue csaba 1 352 06-05-2020, 07:15 AM
Last Post: csaba
  Can't connect to wifi malachipclover 1 397 06-05-2020, 12:16 AM
Last Post: charlespine
  Slow WiFi on Manjaro Default Image 20.04 for PBP SuperUJ 8 1,176 05-28-2020, 08:16 PM
Last Post: nekojet
Shocked Cannot reenable WiFi novaprospekt216 2 407 04-04-2020, 11:58 AM
Last Post: novaprospekt216
  The default OS / kernel had a wifi issue? dawncold 15 2,325 03-02-2020, 06:26 PM
Last Post: lowry
  Eduroam Wifi Issues oldmansaur 5 869 02-21-2020, 08:04 PM
Last Post: rillian
  Repeatedly Freezing then Rebooting Dreamwalker 2 696 02-18-2020, 12:41 PM
Last Post: Dreamwalker

Forum Jump:


Users browsing this thread: 1 Guest(s)