Enable/Disable WIFI with rfkill
-
@common763 What image have you used for installation ? The
pigaming
user is specific to the Odroid image. -
I just went to the RetroPie site, downloaded v4.4 for the Raspberry Pi 2/3. Then flashed to the SD card. Did it on Windows. Looking to fix issues with bluetooth and PS3 controllers going haywire during gameplay. Someone recommended this thread.
-
@common763 Sure - in this case you need to download the script to
/home/pi/RetroPie/retropiemenu/Wifi Switch.sh
wget http://raw.githubusercontent.com/crcerror/XU4-ORA-scripts/master/wifi_toggle_dialog.sh -O "/home/pi/RetroPie/retropiemenu/Wifi Switch.sh"
-
Thanks. One more stupid question. Will running this affect my wi-fi connect to the PC when I transfer files and such?
-
@common763 Of course, this will stop the Wifi radio so the network connection will not be possible via Wifi. You can toggle it though from the menu (on/off) whenever you need (or not) the Wifi connection.
-
ok. thanks for the help. Will give this a shot to see if it fixes my issues.
-
I just ran this. The Wifi Switch is at the bottom of the RetroPie Menu. When I select it does the same thing that a rom does without the proper bio...just goes back to the screen. ANy suggestions to what I am doing wrong?
-
@common763 All set. I replaced wget http://raw.githubusercontent.com/crcerror/XU4-ORA-scripts/master/wifi_toggle_dialog.sh -O "/home/pi/RetroPie/retropiemenu/Wifi Switch.sh" with wget http://raw.githubusercontent.com/crcerror/RetroPie-Shares/master/rfkill_wifi_dialog.sh -O "/home/pi/RetroPie/retropiemenu/Wifi Switch.sh"
-
@common763 Glad you found out ;)
-
@mitu said in Enable/Disable WIFI with rfkill:
@common763 Sure - in this case you need to download the script to
/home/pi/RetroPie/retropiemenu/Wifi Switch.sh
wget http://raw.githubusercontent.com/crcerror/XU4-ORA-scripts/master/wifi_toggle_dialog.sh -O "/home/pi/RetroPie/retropiemenu/Wifi Switch.sh"
Excuse me Sir. The XU4-ORA script does NOT work for Raspberry and vice versa.
- Raspberry uses
rfkill
for radio actions - ORA uses
nmcli
The XU4 is a realy nice device it's a full grown debian/ubuntu platform ;)
- Raspberry uses
-
@mitu Just a quetion. This will disable the onboard wifi, but if I block the wifi with this script and then plug a wifi dongle (On a rpi3), I will be using the dongle wifi? Thanks
-
@Shaddonai I'm not sure,
rfkill
can selectively disable/enable Wifi individually, I'm not sure the script can do that (i.e. choose which Wifi connection to stop).
But, as you said, if you use it before you're adding your Wifi dongle, then it should be fine. -
@Shaddonai There are more effective methods available to block onboard wifi.
Adddtoverlay=pi3-disable-wifi
toboot/config.txt
and then it's device drivers are not loaded during boot.rfkill
behaves like a software toggle and I assume if you plug in annother WiFi device then the whole stack will be resetted. Means both connections are active but not if you use the overlay above.@mitu
Yes rfkill can disable/enable devices by it's device number. But I do not know if the device number keeps unique everytime ;) -
@mitu Thanks!
-
@cyperghost Actually I am searching for an sript that let me disable the onboard bluetooth by modifying the config.txt, but I did not find one so I am trying with rfkill. If you know an script like that, please let me know.
-
@Shaddonai here you are - disable Bluetooth
-
@cyperghost I am already using your script for wifi, and I tried to modify it to work with bluetooth, but I could not make it work. You know how to write cripts, so you know wich instruction to sue to write on the config.txt with a script? For example, when I activate it via RetroPie menu, it would go and edit config.txt.
-
@Shaddonai This makes simply no sense. If I write to config.txt then only a reboot does enable/disable the internal WiFi or BT device of the Raspberry. So it makes more sense to disable them permanently and use external devices.
To make the script work for BT devices instead of using
sudo rfkill block wifi
just writesudo rfkill block bluetooth
. It's just a small change in two lines and then it will work for BT but I do not know why you want this? -
@cyperghost I am working on a portable Raspberry Pi, that will work as a Retropie and sort of portable computer with a portable keyboard. The thing is, I thought I could play with my friends , and most of them have PS4 controlers. I know that I can wire them to the RPI with an USB cable, but due to the design I made, It is really uncomfortable, so i thought to make them all use bluetooth. After a little research, I found out that onboard bluetooth is not really good handling many cotrollers, so I went to Amazon and search for a Bluetooth dongle. Then I saw several of them were "Low Energy". That intrigated me, so I searched the consumption of these dongles, and it was pretty heavy , reducing a good amount of battery life. I only planned to use the dongle with friend, in the meantime I would only use one bluetooth controller, so the onboard was OK, and less power consumpting. I woud like to write an script to only disable theonboard bluetooth when I need, and then plug the dongle, so I can maximize the battery life.
-
@Shaddonai AFAIK if you disable the wifi with this script then you can connect several PS-controllers with BT and all is fine.
If you want to do some inline editing then please read about
grep
andsed
commands. This tools can automate write to your/boot/config.txt
but I don't wont to do this for you. For some reasons I can easily break your device.An example how this tools work are here. The
^
is relevant it says search string from the beginning.if grep -q "^enable_uart=1" "/boot/config.txt"; then echo "UART is already enabled. Disabeling now!" sed -i -e "s|^enable_uart=1|#enable_uart=1|" "/boot/config.txt" fi
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.