Reconnect Bluetooth controller with a button
-
So I made my sister a great Retropie setup with a 8Bitdo SFC30 Bluetooth controller. Everything works really well. The first issue I’ve run into, is the controller lost its pairing. Now, I’m trying to make this as easy as possible for her. So I’ve hidden all the setup menus as she won’t have a keyboard connected.
So the best thing I could think of was to make a physical button to reconnect the controller. I’ve had an 8Bitdo controller working really well with my Raspberry pi, with heaps of reboots and a lot of time not using it etc. I used the Retropie setup script to connect it and setup the UDEV rule. So the only thing I can think of that might have happened to my sister’s is holding SELECT on the controller and it forgets the pairing. I will tell my sister not to do this, but I like the button as a catch all in case it happens again, or if something else goes wrong and the pairing messes up.
I tried to reverse engineer the setup script, but alas, my BASHfu isn’t up to the task. I have figured out how to connect the controller with:
pi@retropie:~/RetroPie-Setup $ bluetoothctl
[bluetooth]# scan on
[bluetooth]# remove 63:0F:24:AD:61:0D
[bluetooth]# pair 63:0F:24:AD:61:0D
[bluetooth]# connect 63:0F:24:AD:61:0D
[bluetooth]# trust 63:0F:24:AD:61:0DAnd after rebooting it connects again. Woo hoo!
So what I really want, is a script that:
Starts scanning
[bluetooth]# scan onRemove the device so it can properly be re-paired
[bluetooth]# remove 63:0F:24:AD:61:0DPairs the device, if it isn’t available, keeps trying until it pairs
[bluetooth]# pair 63:0F:24:AD:61:0DConnects the device if it isn’t available, keeps trying
[bluetooth]# connect 63:0F:24:AD:61:0DTrusts the device, (I think this is required so it reconnects on reboot)
[bluetooth]# trust 63:0F:24:AD:61:0D
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.