Commit 696ceea6 authored by OyyoDams's avatar OyyoDams Committed by Bkg2k

fix(bluetooth): configured pads automatically unpaired before pairing

Bluetooth pairing script review so pairing a pad works even if the pad was previously known from Recalbox
parent ddef0ce2
......@@ -37,6 +37,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- New theme folder in /recalbox/share/themes
- Moga Pro Power, Wiimote, Logitech RumblePad added to es_input.cfg
- Enable threaded-dsp option in 4do core
- Bluetooth: Previously configured pads automatically unpaired before pairing again
## [6.0] - DragonBlaze
- Change name from 5.0 to 6.0 DragonBlaze
......
......@@ -20,11 +20,12 @@
- Mame changes its default emulator to mame2003_plus
- Shutdown System option moved at the top of the Quit menu
- Retroarch ratio resynchronized:
- "Core provided" and "Retroarch Custom" added to ratio menu
- Old "custom" ratio renamed "Do not set" (let the user choose in Retroarch)
- Ratio text localized
- "Core provided" and "Retroarch Custom" added to ratio menu
- Old "custom" ratio renamed "Do not set" (let the user choose in Retroarch)
- Ratio text localized
- New theme folder in share root folder (old folders are still working)
- New pads added to known controllers: Moga Pro Power, Wiimote, Logitech RumblePad
- Bluetooth pads configuration easier than ever: previously configured pads automatically unpaired before pairing again
- Enable "Threaded DSP" option in 4DO by default (improve emulation speed)
### Fixes
......
#!/bin/bash
#Usage: recalpair XX:XX:XX:XX:XX:XX | bluetoothctl
mac=$1
echo -e "agent on\n"
sleep 1
echo -e "default-agent\n"
sleep 1
echo -e "power on\n"
sleep 1
echo -e "discoverable on\n"
sleep 1
echo -e "pairable on\n"
sleep 1
echo -e "scan on\n"
sleep 3
echo -e "devices\n"
sleep 1
echo -e "remove $mac\n"
sleep 1
echo -e "pair $mac\n"
sleep 3
echo -e "connect $mac\n"
sleep 5
echo -e "0000\n"
sleep 3
echo -e "trust $mac\n"
sleep 3
echo -e "exit"
......@@ -593,6 +593,9 @@ if [[ "$command" == "hiddpair" ]]; then
if [ "$?" != "0" ]; then
exit 1
fi
recallog "Unpairing and removing BT device $mac"
/recalbox/scripts/bluetooth/test-device remove "$mac"
recallog "pairing $name $mac"
echo $name | grep "8Bitdo\|other"
if [ "$?" == "0" ]; then
......@@ -603,20 +606,18 @@ if [[ "$command" == "hiddpair" ]]; then
echo "SUBSYSTEM==\"input\", ATTRS{uniq}==\"$macLowerCase\", MODE=\"0666\", ENV{ID_INPUT_JOYSTICK}=\"1\"" >> "/run/udev/rules.d/99-8bitdo.rules"
fi
fi
/recalbox/scripts/bluetooth/simple-agent -c NoInputNoOutput -i hci0 "$mac" 2>&1 | recallog
connected=${PIPESTATUS[0]}
if [ $connected -eq 0 ]; then
hcitool con | grep $mac1
if [[ $? == "0" ]]; then
recallog "bluetooth : $mac1 connected !"
/recalbox/scripts/bluetooth/test-device trusted "$mac" yes
# Save the configuration
btTar=/recalbox/share/system/bluetooth/bluetooth.tar
rm "$btTar" ; tar cvf "$btTar" /var/lib/bluetooth/
else
recallog "bluetooth : $mac1 failed connection"
fi
/recalbox/scripts/bluetooth/recalpair $mac | bluetoothctl | recallog
hcitool con | grep $mac1
if [[ $? == "0" ]]; then
connected=0
recallog "bluetooth : $mac1 connected !"
/recalbox/scripts/bluetooth/test-device trusted "$mac" yes
# Save the configuration
btTar=/recalbox/share/system/bluetooth/bluetooth.tar
rm "$btTar" ; tar cvf "$btTar" /var/lib/bluetooth/
else
connected=1
recallog "bluetooth : $mac1 failed connection"
fi
exit $connected
......@@ -694,3 +695,4 @@ echo "Uknown command $command"
recallog -e "recalbox-config.sh: unknown command $command"
exit 10
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment