Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
bluetooth_controllers_-_manual_setup [2020/02/04 22:36] lalabluetooth_controllers_-_manual_setup [2023/01/11 07:19] (current) – [Pair Bluetooth Controllers - manual setup] no more blank spaces atari
Line 1: Line 1:
-~~NOTOC~~ +====== Pair Bluetooth Controllers - manual setup ======
-===== Pair Bluetooth Controllers - manual setup =====+
  
-You need to establish a [[access_the_batocera_via_ssh|SSH connection]] or a terminal windows with keyboard to accomblish this furtherYou can connect your bluetooth controller manually by doing some commands step by step.+First ensure that Bluetooth is enabled on your device. First, the line ''controllers.bluetooth.enabled=1'' should be present in your ''system/batocera.conf'' file and not commented out ([[:batocera_conf_syntax|how to access the batocera.conf file]])If it is missing, add it in. Note that doing this won't suddenly make a non-functional Bluetooth dongle start working, only the ones that are already compatible with the Linux kernel and the drivers included in Batocera.
  
-Get started by typing ''bluetoothctl''+Establish an [[:access_the_batocera_via_ssh|SSH connection]] (or open up Xterm) to start the manual connection process. Get started by typing ''bluetoothctl'' and hitting ''[Enter]''.
  
-Now you are in the Bluetooth control unit. Type following commands and confirm every single one with //Enter//+Now you are in the Bluetooth control unit. Type following commands and confirm every single one with ''[Enter]''
  
-    agent on +<code> 
-    default-agent +agent on 
-    power on +default-agent 
-    scan on+power on 
 +scan on 
 +</code>
  
-**Important: Now set the controller in Pairing mode!** This strongly depends from your controller type and we can't write an instruction set for every single controller, how to do this.+Now set the controller in pairing mode! This strongly depends from your [[:supported_controllers|controller type]].
  
-So you are in Pairing Mode and you likely see text messages like this.+An example of the output you would see from running all the commands successfully:
  
->[bluetooth]# scan on +<code> 
->Discovery started +[root@BATOCERA /userdata/system]# bluetoothctl 
->[CHG] Controller 43:45:C0:00:1F:AC Discovering: yes +Agent registered 
->[NEW] Device E4:17:D8:C2:0B:0E 8BitDo M30 Modkit+[bluetooth]# agent on 
 +Agent is already registered 
 +[bluetooth]# default-agent 
 +Default agent request successful 
 +[bluetooth]# power on 
 +Changing power on succeeded 
 +[bluetooth]# scan on 
 +Discovery started 
 +[CHG] Controller 43:45:C0:00:1F:AC Discovering: yes 
 +[NEW] Device E4:17:D8:C2:0B:0E 8BitDo M30 Modkit 
 +</code> 
 +    
 +<WRAP center round tip> 
 +If you're having trouble detecting devices, check out the [[:troubleshooting#bluetooth_issues_not_connecting_no_devices_detected_etc|Bluetooth section on the troubleshooting page]]. 
 +</WRAP>
  
-Now we want to connect to our controller. So we type following commands to connect to discovered controller with MAC adress ''E4:17:D8:C2:0B:0E'' properly. +Now we want to connect to our controller. So we type following commands to connect to discovered controller with MAC address ''E4:17:D8:C2:0B:0E'' properly. Wait a few seconds after entering the commands in order to ensure they are processed successfully.
-We need to wait a few seconds after entering each command to setup the controller correctly+
  
     pair E4:17:D8:C2:0B:0E     pair E4:17:D8:C2:0B:0E
Line 29: Line 43:
     trust E4:17:D8:C2:0B:0E     trust E4:17:D8:C2:0B:0E
  
 +This would be the output from our example:
  
-So we see for a example a process text like this+   [bluetooth]# pair E4:17:D8:C2:0B:0E 
 +   Attempting to pair with E4:17:D8:C2:0B:0E 
 +   [CHG] Device E4:17:D8:C2:0B:0E Connected: yes 
 +   [CHG] Device E4:17:D8:C2:0B:0E Modalias: usb:v2DC8p5101d0100 
 +   [CHG] Device E4:17:D8:C2:0B:0E UUIDs: 00001124-0000-1000-8000-00805f9b34fb 
 +   [CHG] Device E4:17:D8:C2:0B:0E UUIDs: 00001200-0000-1000-8000-00805f9b34fb 
 +   [CHG] Device E4:17:D8:C2:0B:0E ServicesResolved: yes 
 +   [CHG] Device E4:17:D8:C2:0B:0E Paired: yes 
 +   Pairing successful 
 +    
 +   [bluetooth]# connect E4:17:D8:C2:0B:0E 
 +   Attempting to connect to E4:17:D8:C2:0B:0E 
 +   Failed to connect: org.bluez.Error.Failed 
 +   [CHG] Device E4:17:D8:C2:0B:0E Connected: yes 
 +   Authorize service (yes/no): yes  
 +    
 +   Authorize service 00001124-0000-1000-8000-00805f9b34fb  
 +   [8BitDo M30 Modkit]# trust E4:17:D8:C2:0B:0E 
 +   [CHG] Device E4:17:D8:C2:0B:0E Trusted: yes 
 +   Changing E4:17:D8:C2:0B:0E trust succeeded
  
->[bluetooth]# pair E4:17:D8:C2:0B:0E +Type ''devices'' to see a list of devices configurated in your BT setup. \\ 
->Attempting to pair with E4:17:D8:C2:0B:0E +Type ''remove MAC-ADRESS'' to remove single devices \\ 
->[CHG] Device E4:17:D8:C2:0B:0E Connected: yes +Type ''yes'' if you are asked for authorization progress or enter PIN
->[CHG] Device E4:17:D8:C2:0B:0E Modalias: usb:v2DC8p5101d0100 +
->[CHG] Device E4:17:D8:C2:0B:0E UUIDs: 00001124-0000-1000-8000-00805f9b34fb +
->[CHG] Device E4:17:D8:C2:0B:0E UUIDs: 00001200-0000-1000-8000-00805f9b34fb +
->[CHG] Device E4:17:D8:C2:0B:0E ServicesResolved: yes +
->[CHG] Device E4:17:D8:C2:0B:0E Paired: yes +
->Pairing successful+
  
->[bluetooth]# connect E4:17:D8:C2:0B:0E +If you have multiple Bluetooth adapters on your machine and you want to tell which one is used, you can use the command ''hcitool dev'' to list them allOn my setup, ''hci0'' is the internal BT on my Pi4, and ''hci1'' is an additional USB BT module:
->Attempting to connect to E4:17:D8:C2:0B:0E +
->Failed to connect: org.bluez.Error.Failed +
->[CHG] Device E4:17:D8:C2:0B:0E Connected: yes +
->Authorize service +
->o)yes Authorize service 00001124-0000-1000-8000-00805f9b34fb (yes/no+
  
->[8BitDo M30 Modkit]trust E4:17:D8:C2:0B:0E +   hcitool dev 
->[CHG] Device E4:17:D8:C2:0B:0E Trusted: yes +   Devices: 
->Changing E4:17:D8:C2:0B:0E trust succeeded+       hci1    90:80:62:00:88:00 
 +       hci0    DC:A6:32:04:10:7F 
 +     
 +   # bluetoothctl  
 +   Agent registered 
 +   [bluetooth]# scan on 
 +   Discovery started 
 +   [CHG] Controller 90:80:62:00:88:00 Discovering: yes
  
 +===== Batocera is automatically pairing a device I don't want it to! =====
 +
 +Some devices out there break Bluetooth protocol and are always in "pairing" mode, common with modern "smart" TVs. Since Batocera will automatically connect to any device in pair mode, this could cause unintended connections.
 +
 +To work around this, it is possible to pair to only strictly pads. Put your controller into its pairing mode and then run the following:
 +
 +<code>
 +batocera-bluetooth trust-pad
 +</code>
 +
 +Batocera will explicitly only search for and connect to Bluetooth controllers. This may take a while as it methodically goes through, parses and accepts/rejects devices in the background. Once the pad is found, Batocera will attempt to pair to it:
 +
 +<code>
 +[root@RPI3-BATOCERA /userdata/system]# batocera-bluetooth trust-pad
 +Pairing 8BitDo M30 gamepad...
 +Trusting 8BitDo M30 gamepad...
 +[root@RPI3-BATOCERA /userdata/system]#
 +</code>
 +
 +The Bluetooth controller can now be used with Batocera.
 +
 +Conversely, the same can be done to connect strictly to audio devices:
 +
 +<code>
 +batocera-bluetooth trust-audio
 +</code>
 +
 +--> Blacklisting a device in Batocera v33 #
 +
 +<WRAP center round important>
 +The functionality of this has been supplanted by ''trust-pad'' method described above. These instructions are retained here specifically for Batocera **v33** and no other version.
 +</WRAP>
 +
 +There might be some device that is perpetually in pairing mode that you don't want your Batocera machine to connect to (such as your neighbor's "smart" TV). You can block such devices by utilizing the blacklist.
 +
 +In order to do this via SSH, run the following command:
 +
 +<code>
 +batocera-bluetooth blacklist <device address> <device name>
 +</code>
 +
 +For example:
 +
 +FIXME
 +
 +To show a list of all the currently blacklisted devices:
 +
 +<code>
 +batocera-bluetooth list_blacklistable
 +</code>
 +
 +To remove a device from the blacklist:
 +
 +<code>
 +batocera-bluetooth unblacklist <device address>
 +</code>
 +
 +<--
 +
 +===== Using batocera-bluetooth =====
 +
 +<WRAP center round todo>
 +Still needs further investigation/testing.
 +</WRAP>
 +
 +<code>
 +batocera-bluetooth list                          Print the list of currently trusted and saved Bluetooth devices.
 +batocera-bluetooth trust                         Scan for and trust a new, randomly(?) selected device. Good luck!
 +batocera-bluetooth trust-pad                     Scan for and trust only controllers.
 +batocera-bluetooth trust-audio                   Scan for and trust only audio devices.
 +batocera-bluetooth starttrust
 +batocera-bluetooth stoptrust
 +batocera-bluetooth remove <device address>       Removes (untrusts) specified Bluetooth device from the list and removes its connection from memory.
 +batocera-bluetooth save                          Saves the newly trusted device to memory.
 +batocera-bluetooth restore                       Undoes any trusted but not currently saved device and restores from memory.
 +batocera-bluetooth live_devices                  Lists all current nearby devices in pairing mode.
 +</code>
 +
 +--> v33 specific commands#
 +
 +<code>
 +batocera-bluetooth list_blacklistable            Print the list of currently blacklisted Bluetooth devices.
 +batocera-bluetooth blacklist <device address> <device name>  Adds a device to the blacklist, preventing it from being paired to.
 +batocera-bluetooth unblacklist <device address>  Removes specified Bluetooth device from the blacklist.
 +</code>
 +
 +<--
  
-Type ''devices'' to see a list of devices configurated in your BT setup. \\ 
-Type ''remove MAC-ADRESS'' to remove single devices \\ 
-Type ''yes'' if you are asked for authorization progress or enter PIN 
  • bluetooth_controllers_-_manual_setup.1580852188.txt.gz
  • Last modified: 4 years ago
  • by lala