Enabling bluetooth

Please see

for reboot issues

Sam

It works, thanks Sam! :slight_smile:

Hi. Is it possible to add an option to pair with a keyboard without entering a code? I am using FC30 controller and cannot connect it in keyboard mode because osmc asks the keyboard to enter a code. The controller cannot enter the code because it has no numeric buttons. The alternative options (e.g. to use bluez-simple-agent) are not available in osmc so we have to use the OSMC Settings -> Network -> Bluetooth which does not allow for simple pairing mode.

Did you try the Connect option instead of Pair ? Should work…

Hi DBMandrake. Yes. I just tried to connect to it in keyboard mode again. Just says “connection to [controller] failed”. I looked in .kodi/kodi.log but I don’t see any new messages when trying to connect. When I try to pair the controller and it fails I get the following messages in the log:

21:45:41 125.987762 T:1529869344  NOTICE: calling agent "/usr/bin/python /usr/share/kodi/addons/script.module.osmcsetting.networking/resources/lib/osmc_bluetooth_agent.py 64:03:D0:B3:7F:06"

We are currently working on some bluetooth pairing issues and have already fixed one similar problem that might be the issue you’re seeing, in the meantime you could try pairing with ‘bluetoothctl’ from the command line using SSH. Launch bluetoothctl then:

scan on

Then put your device into pairing mode, you should then see it’s name scroll by with a mac address, if not, after a few seconds type:

devices

copy the mac address into your clipboard and issue the following commands:

pair mac
trust mac
connect mac

Replace mac with the actual mac address of your keyboard that you found earlier, and wait between each command making sure that it says it was successful.

Let us know if that works for you and if possible grab the commands and results and post them here. (use the preformatted text tag)

If you want to start over and remove the pairing for a device use:

remove mac

If you want to try to pair a device that does require a PIN then you would use the command:

agent on

immediately before you try to use the pair command.

When you are finished pairing you can disable scan mode:

scan off

You can also check the status of the device you just paired:

info mac

This will let you confirm whether the device is paired, trusted and connected.

Some simpler devices may not actually need to be paired so you might find you need to skip the pairing step and only use trust and connect.

1 Like

Thank you. I will do this tonight and give feedback. Is the feedback you want in a log file or are you looking for the terminal output? Do I need to set any “verbose” flags to give proper output?

If you just copy and paste the commands and response from the terminal session when you find the method that works for your device that will be enough. We just need to see what the device is expecting and needing as not all bluetooth devices pair in the same way.

Hi DBMandrake. Sorry for the late reply. I could not pair the controller as a keyboard. Please see the output below:

osmc@osmc:~$ bluetoothctl
[NEW] Controller 00:11:22:98:76:54 osmc [default]
[NEW] Device 64:03:D0:B3:7F:06 8Bitdo FC30 GamePad
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:11:22:98:76:54 Discovering: yes
[CHG] Device 64:03:D0:B3:7F:06 LegacyPairing: yes
[CHG] Device 64:03:D0:B3:7F:06 RSSI: 50
[CHG] Device 64:03:D0:B3:7F:06 Class: 0x002540
[CHG] Device 64:03:D0:B3:7F:06 Icon: input-keyboard

[bluetooth]# devices
Device 64:03:D0:B3:7F:06 8Bitdo FC30 GamePad

[bluetooth]# pair 64:03:D0:B3:7F:06
Attempting to pair with 64:03:D0:B3:7F:06
Failed to pair: org.bluez.Error.AlreadyExists

//remove old controller via OSMC UI
[DEL] Device 64:03:D0:B3:7F:06 8Bitdo FC30 GamePad

//activated pairing on device
[NEW] Device 64:03:D0:B3:7F:06 8Bitdo FC30 GamePad

[bluetooth]# pair 64:03:D0:B3:7F:06
Attempting to pair with 64:03:D0:B3:7F:06
[CHG] Device 64:03:D0:B3:7F:06 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed

[bluetooth]# trust 64:03:D0:B3:7F:06
Changing 64:03:D0:B3:7F:06 trust succeeded

[bluetooth]# connect 64:03:D0:B3:7F:06
Attempting to connect to 64:03:D0:B3:7F:06
Failed to connect: org.bluez.Error.Failed

[bluetooth]# devices
Device 64:03:D0:B3:7F:06 8Bitdo FC30 GamePad
[CHG] Device 64:03:D0:B3:7F:06 RSSI: 34


//Second attempt with agent on
[bluetooth]# agent on
Agent registered
[NEW] Device 64:03:D0:B3:7F:06 8Bitdo FC30 GamePad
[bluetooth]# info 64:03:D0:B3:7F:06
Device 64:03:D0:B3:7F:06
        Name: 8Bitdo FC30 GamePad
        Alias: 8Bitdo FC30 GamePad
        Class: 0x002540
        Icon: input-keyboard
        Paired: no
        Trusted: no
        Blocked: no
        Connected: no
        LegacyPairing: yes
[bluetooth]# trust 64:03:D0:B3:7F:06
[CHG] Device 64:03:D0:B3:7F:06 Trusted: yes
Changing 64:03:D0:B3:7F:06 trust succeeded
[bluetooth]# pair 64:03:D0:B3:7F:06
Attempting to pair with 64:03:D0:B3:7F:06
[CHG] Device 64:03:D0:B3:7F:06 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationTimeout
[bluetooth]# connect 64:03:D0:B3:7F:06
Attempting to connect to 64:03:D0:B3:7F:06
[CHG] Device 64:03:D0:B3:7F:06 Connected: yes
Failed to connect: org.bluez.Error.NotAvailable
[CHG] Device 64:03:D0:B3:7F:06 Connected: no

After playing around in bluetoothctl I came across something odd. I have copied the session below. Note how the device connects, gets UUID and Modalias and then disconnects. I don’t know if this helps, but I thought I would post it here.

[NEW] Device 64:03:D0:B3:7F:06 8Bitdo FC30 GamePad
[bluetooth]# info 64:03:D0:B3:7F:06
Device 64:03:D0:B3:7F:06
        Name: 8Bitdo FC30 GamePad
        Alias: 8Bitdo FC30 GamePad
        Class: 0x002540
        Icon: input-keyboard
        Paired: no
        Trusted: no
        Blocked: no
        Connected: no
        LegacyPairing: yes

[bluetooth]# trust 64:03:D0:B3:7F:06
[CHG] Device 64:03:D0:B3:7F:06 Trusted: yes
Changing 64:03:D0:B3:7F:06 trust succeeded
[bluetooth]# connect 64:03:D0:B3:7F:06
Attempting to connect to 64:03:D0:B3:7F:06
Failed to connect: org.bluez.Error.Failed
[bluetooth]# connect 64:03:D0:B3:7F:06
Attempting to connect to 64:03:D0:B3:7F:06
[CHG] Device 64:03:D0:B3:7F:06 Connected: yes
[CHG] Device 64:03:D0:B3:7F:06 Modalias: usb:v2810p0009d0100
[CHG] Device 64:03:D0:B3:7F:06 UUIDs:
        00001200-0000-1000-8000-00805f9b34fb
Failed to connect: org.bluez.Error.NotAvailable
[CHG] Device 64:03:D0:B3:7F:06 Connected: no

[bluetooth]# info 64:03:D0:B3:7F:06
Device 64:03:D0:B3:7F:06
        Name: 8Bitdo FC30 GamePad
        Alias: 8Bitdo FC30 GamePad
        Class: 0x002540
        Icon: input-keyboard
        Paired: no
        Trusted: yes
        Blocked: no
        Connected: no
        LegacyPairing: yes
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        Modalias: usb:v2810p0009d0100

At the point where you tried to connect to the device, was the device still in pairing mode ? Make sure it hadn’t timed out and gone out of pairing mode due to taking too long between each step.

Try repeating the process but without using “remove” - leave the device as already trusted, then put the device in pairing mode and try pair, then connect, or just connect on its own.

We have found that with some simple devices such as my Fire TV Stick remote, that it is enough to trust and then connect with the remote while it is in pairing mode - the remote will then attempt to pair back to osmc in the other direction and provided it is already trusted this will succeed. So you don’t always have to initiate pairing from the osmc end and perhaps with some devices this would not work.

There seems to be a lot of variations of the pairing procedures for different devices and we are still learning how some devices handle this. Fortunately bluetoothctl is a good tool for testing this out, then when we know what is needed we can incorporate it into the GUI.

1 Like

Hi DBMandrake. I tried again last night to get the gamepad connected in keyboard mode. It looks like I got it to connect (after unsuccessfully pairing, disconnecting, and reconnecting), however, I could not get any input from the device. I copy the log below for reference. I will continue to try different combinations until I succeed. At least this is appears to be a step in the right direction.

osmc@osmc:~$ bluetoothctl

[bluetooth]# scan on
Discovery started
[CHG] Controller 00:11:22:98:76:54 Discovering: yes
[NEW] Device 64:03:E1:A4:7F:06 8Bitdo FC30 II
[bluetooth]# pair 64:03:E1:A4:7F:06
Attempting to pair with 64:03:E1:A4:7F:06
[CHG] Device 64:03:E1:A4:7F:06 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
//device still has flashing light and is not connected

[bluetooth]# trust 64:03:E1:A4:7F:06
[CHG] Device 64:03:E1:A4:7F:06 Trusted: yes
Changing 64:03:E1:A4:7F:06 trust succeeded

[bluetooth]# pair 64:03:E1:A4:7F:06
Attempting to pair with 64:03:E1:A4:7F:06
Failed to pair: org.bluez.Error.AuthenticationFailed

[bluetooth]# connect 64:03:E1:A4:7F:06
Attempting to connect to 64:03:E1:A4:7F:06
Failed to connect: org.bluez.Error.Failed

[bluetooth]# connect 64:03:E1:A4:7F:06
Attempting to connect to 64:03:E1:A4:7F:06
Failed to connect: org.bluez.Error.NotAvailable

[bluetooth]# connect 64:03:E1:A4:7F:06
Attempting to connect to 64:03:E1:A4:7F:06
Failed to connect: org.bluez.Error.NotAvailable

[bluetooth]# info 64:03:E1:A4:7F:06
Device 64:03:E1:A4:7F:06
        Name: 8Bitdo FC30 II
        Alias: 8Bitdo FC30 II
        Class: 0x002540
        Icon: input-keyboard
        Paired: no
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: yes

[bluetooth]# pair 64:03:E1:A4:7F:06
Attempting to pair with 64:03:E1:A4:7F:06
Failed to pair: org.bluez.Error.AuthenticationFailed

[bluetooth]# agent on
Agent registered

[bluetooth]# disconnect 64:03:E1:A4:7F:06
Attempting to disconnect from 64:03:E1:A4:7F:06
Successful disconnected
[CHG] Device 64:03:E1:A4:7F:06 Connected: no

[bluetooth]# connect 64:03:E1:A4:7F:06
Attempting to connect to 64:03:E1:A4:7F:06
[CHG] Device 64:03:E1:A4:7F:06 Connected: yes
[CHG] Device 64:03:E1:A4:7F:06 UUIDs:
        00001124-0000-1000-8000-00805f9b34fb
Connection successful
[CHG] Device 64:03:D0:B3:7F:06 Connected: yes
[CHG] Device 64:03:D0:B3:7F:06 Connected: no
//At this stage the device had a solid blue light indicating that it was connected.
//I could not get any input from the device even though it was connected.

How do you find that? I have the latest version on a Pi3, and there is no bluetooth option under Network. Does it have to be enabled somewhere else before it appears there?

The Bluetooth module for Raspberry Pi 3 is not ready yet and won’t be ready for a while yet.

This post is four months old, it predates Pi 3. The poster is using an external dongle.

Sam

Thanks. I’ll find another OS and media server then.

Bluetooth in :osmc: works pretty well now on rpi3

Hi all,

I found this threat quite helpful, it allowed me to finally connect RPi3 to EDIFIER R1700BT speakers (although no sound from them still). I have tried a couple of times to use OSMC menu to connect with and witout PIN - always failed with red BT icon next to speakers name.

DBMandrake intructions helped with block command (why block?..) in addition, see:

[bluetooth]# devices
Device 00:26:83:11:E1:9F REKSIO
Device 40:EF:4C:B6:39:5C EDIFIER R1700BT
Device F8:3F:51:2E:FC:66 F8-3F-51-2E-FC-66
[bluetooth]# pair 40:EF:4C:B6:39:5C
Attempting to pair with 40:EF:4C:B6:39:5C
Failed to pair: org.bluez.Error.AlreadyExists
[bluetooth]# trust 40:EF:4C:B6:39:5C
Changing 40:EF:4C:B6:39:5C trust succeeded
[bluetooth]# connect 40:EF:4C:B6:39:5C
Attempting to connect to 40:EF:4C:B6:39:5C
Failed to connect: org.bluez.Error.Failed

[bluetooth]# info 40:EF:4C:B6:39:5C
Device 40:EF:4C:B6:39:5C
Name: EDIFIER R1700BT
Alias: EDIFIER R1700BT
Class: 0x240428
Icon: audio-card
Paired: yes
Trusted: yes
Blocked: no
Connected: no
LegacyPairing: no
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
[bluetooth]# block 40:EF:4C:B6:39:5C
[CHG] Device 40:EF:4C:B6:39:5C Blocked: yes
Changing 40:EF:4C:B6:39:5C block succeeded
[bluetooth]# info 40:EF:4C:B6:39:5C
Device 40:EF:4C:B6:39:5C
Name: EDIFIER R1700BT
Alias: EDIFIER R1700BT
Class: 0x240428
Icon: audio-card
Paired: yes
Trusted: yes
Blocked: yes
Connected: no
LegacyPairing: no
UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
[bluetooth]# connect 40:EF:4C:B6:39:5C
Attempting to connect to 40:EF:4C:B6:39:5C
[CHG] Device 40:EF:4C:B6:39:5C Connected: yes
Failed to connect: org.bluez.Error.Failed
[CHG] Device 40:EF:4C:B6:39:5C Connected: no
[bluetooth]# connect 40:EF:4C:B6:39:5C
Attempting to connect to 40:EF:4C:B6:39:5C
[CHG] Device 40:EF:4C:B6:39:5C Connected: yes

Nice… :unamused: I have reconnected manually many times, after some tens of seconds it disconnects by itself.

[CHG] Device 40:EF:4C:B6:39:5C Connected: no
[bluetooth]# connect 40:EF:4C:B6:39:5C
Attempting to connect to 40:EF:4C:B6:39:5C
[CHG] Device 40:EF:4C:B6:39:5C Connected: yes
Failed to connect: org.bluez.Error.Failed
[CHG] Device 40:EF:4C:B6:39:5C Connected: no
[bluetooth]# connect 40:EF:4C:B6:39:5C
Attempting to connect to 40:EF:4C:B6:39:5C
[CHG] Device 40:EF:4C:B6:39:5C Connected: yes
Failed to connect: org.bluez.Error.Failed
[CHG] Device 40:EF:4C:B6:39:5C Connected: no

If I go to Kodi settings during OSMC is connected to Edifiers I still do not see anything like Bluetooth audio device (standard outputs plus Digiberry). I have no problem with these speakers over bluutooth when connected to Samsung Galaxy S7 or old S4 mini - the connection simply works.

This block command really made me wonder :slight_smile:

[bluetooth]# unblock 40:EF:4C:B6:39:5C
[CHG] Device 40:EF:4C:B6:39:5C Blocked: no
Changing 40:EF:4C:B6:39:5C unblock succeeded
[bluetooth]# connect 40:EF:4C:B6:39:5C
Attempting to connect to 40:EF:4C:B6:39:5C
Failed to connect: org.bluez.Error.Failed
[bluetooth]# connect 40:EF:4C:B6:39:5C
Attempting to connect to 40:EF:4C:B6:39:5C
Failed to connect: org.bluez.Error.Failed
[bluetooth]# block 40:EF:4C:B6:39:5C
[CHG] Device 40:EF:4C:B6:39:5C Blocked: yes
Changing 40:EF:4C:B6:39:5C block succeeded
[bluetooth]# connect 40:EF:4C:B6:39:5C
Attempting to connect to 40:EF:4C:B6:39:5C
[CHG] Device 40:EF:4C:B6:39:5C Connected: yes
[EDIFIER R1700BT]#

Any help would be very appreciated.

Did you install the a2dp package from the Testing thread?

Yes, right after you mentioned. But it didn’t help to connect anyway.

I have unistallled the package and the new ones it had in dependencies. I was going to use BT speakers (with great Audio Profiles script for easy output switching) for audiobooks listening, since they don’t not require the quality of a big stereo set. Since the RPi buildt-in BT module has some issues in a2dp implementation I’ll wait for released fix :frowning: