Bluetooth : keyboard / mouse / ps4 controler pairing

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
vords
Posts: 16
Joined: Wed Feb 10, 2021 8:41 pm

Re: Bluetooth : keyboard / mouse / ps4 controler pairing

Post by vords »

Hello.

I've done it and rebooted.

Here is the log :

-- Logs begin at Thu 2019-02-14 11:11:58 CET, end at Tue 2021-02-23 13:29:00 CET. --
févr. 23 13:27:27 DietPi systemd[1]: Starting Configure Bluetooth Modems connected by UART...
févr. 23 13:27:35 DietPi btuart[222]: bcm43xx_init
févr. 23 13:27:35 DietPi btuart[222]: Flash firmware /lib/firmware/brcm/BCM4345C0.hcd
févr. 23 13:27:35 DietPi btuart[222]: Set Controller UART speed to 3000000 bit/s
févr. 23 13:27:35 DietPi btuart[222]: Device setup complete
févr. 23 13:27:35 DietPi systemd[1]: Started Configure Bluetooth Modems connected by UART.
févr. 23 13:27:35 DietPi systemd[1]: Starting Bluetooth service...
févr. 23 13:27:47 DietPi bluetoothd[441]: Bluetooth daemon 5.50
févr. 23 13:27:47 DietPi systemd[1]: Started Bluetooth service.
févr. 23 13:27:47 DietPi bluetoothd[441]: Starting SDP server
févr. 23 13:27:47 DietPi bluetoothd[441]: Excluding (cli) sap
févr. 23 13:27:47 DietPi bluetoothd[441]: Bluetooth management interface 1.18 initialized
févr. 23 13:27:47 DietPi bluetoothd[441]: Failed to get connections: Not Powered (0x0f)

I can't connect to devices.
Through blueman, the device are grey, i can't connect to it.

I need to do systmctl daemon-reload / restart bluetooth to be able to connect the devices.
User avatar
MichaIng
Site Admin
Posts: 3032
Joined: Sat Nov 18, 2017 6:21 pm

Re: Bluetooth : keyboard / mouse / ps4 controler pairing

Post by MichaIng »

Code: Select all

bluetoothd[441]: Failed to get connections: Not Powered (0x0f)
Hmm, probably it is starting somehow too early when some other hardware parts are not ready yet. Probably the kernel log dmesg reveals something.

Probably delaying the service start a bit is a workaround (for simplicity appending it to the some override config):

Code: Select all

echo 'ExecStartPre=sleep 10' >> /etc/systemd/system/bluetooth.service.d/no-sap.conf
vords
Posts: 16
Joined: Wed Feb 10, 2021 8:41 pm

Re: Bluetooth : keyboard / mouse / ps4 controler pairing

Post by vords »

Thanks for taking some time on this =)

I've modified no-sap.conf and rebooted.
Here are the logs :

dmesg

Code: Select all

[   11.200105] Bluetooth: Core ver 2.22
[   11.200184] NET: Registered protocol family 31
[   11.200191] Bluetooth: HCI device and connection manager initialized
[   11.200502] Bluetooth: HCI socket layer initialized
[   11.200514] Bluetooth: L2CAP socket layer initialized
[   11.200530] Bluetooth: SCO socket layer initialized
[   11.209220] Bluetooth: HCI UART driver ver 2.3
[   11.209229] Bluetooth: HCI UART protocol H4 registered
[   11.209283] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   11.209871] Bluetooth: HCI UART protocol Broadcom registered
[   21.468057] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   21.468067] Bluetooth: BNEP filters: protocol multicast
[   21.468081] Bluetooth: BNEP socket layer initialized
[   21.601170] Bluetooth: hci0: unexpected event for opcode 0x0c52
[   33.138729] Bluetooth: RFCOMM TTY layer initialized
[   33.138750] Bluetooth: RFCOMM socket layer initialized
[   33.138771] Bluetooth: RFCOMM ver 1.11
and

Code: Select all

root@DietPi:~# journalctl -u bluetooth -u hciuart
-- Logs begin at Thu 2019-02-14 11:11:58 CET, end at Wed 2021-02-24 11:46:06 CET. --
févr. 24 11:44:30 DietPi systemd[1]: Starting Configure Bluetooth Modems connected by UART...
févr. 24 11:44:38 DietPi btuart[233]: bcm43xx_init
févr. 24 11:44:38 DietPi btuart[233]: Flash firmware /lib/firmware/brcm/BCM4345C0.hcd
févr. 24 11:44:38 DietPi btuart[233]: Set Controller UART speed to 3000000 bit/s
févr. 24 11:44:38 DietPi btuart[233]: Device setup complete
févr. 24 11:44:38 DietPi systemd[1]: Started Configure Bluetooth Modems connected by UART.
févr. 24 11:44:38 DietPi systemd[1]: Starting Bluetooth service...
févr. 24 11:45:00 DietPi bluetoothd[670]: Bluetooth daemon 5.50
févr. 24 11:45:00 DietPi systemd[1]: Started Bluetooth service.
févr. 24 11:45:00 DietPi bluetoothd[670]: Starting SDP server
févr. 24 11:45:00 DietPi bluetoothd[670]: Excluding (cli) sap
févr. 24 11:45:00 DietPi bluetoothd[670]: Bluetooth management interface 1.18 initialized
févr. 24 11:45:00 DietPi bluetoothd[670]: Failed to set privacy: Rejected (0x0b)
févr. 24 11:45:00 DietPi bluetoothd[670]: Failed to set device class: Not Powered (0x0f)
User avatar
MichaIng
Site Admin
Posts: 3032
Joined: Sat Nov 18, 2017 6:21 pm

Re: Bluetooth : keyboard / mouse / ps4 controler pairing

Post by MichaIng »

Strange. You could try to further defer the start by e.g. 30 seconds instead of 10. When a restart solves it, at least a fresh service start at that time should work as well.

Ah one test could be:

Code: Select all

systemctl disable bluetooth
reboot
systemctl start bluetooth
If this works, it is ruled out that one service stop or a second start is for whatever reason required to have it working.

Another thing we could try it a kernel downgrade. There were quite a few other issues reported that were solved by downgrading to Linux 5.4. Then we'd know that it's something to report to the RPi kernel repository: https://github.com/raspberrypi/linux/issues

Ah there is a report already that looks at least similar: https://github.com/raspberrypi/linux/issues/4139
If you have a GitHub account, probably you could add your case and related logs.
vords
Posts: 16
Joined: Wed Feb 10, 2021 8:41 pm

Re: Bluetooth : keyboard / mouse / ps4 controler pairing

Post by vords »

so, i've tried with 30 sec.

Code: Select all

 journalctl -u bluetooth -u hciuart
-- Logs begin at Thu 2019-02-14 11:11:58 CET, end at Fri 2021-02-26 10:34:11 CET. --
févr. 26 10:30:03 DietPi systemd[1]: Starting Configure Bluetooth Modems connected by UART...
févr. 26 10:30:11 DietPi btuart[228]: bcm43xx_init
févr. 26 10:30:11 DietPi btuart[228]: Flash firmware /lib/firmware/brcm/BCM4345C0.hcd
févr. 26 10:30:11 DietPi btuart[228]: Set Controller UART speed to 3000000 bit/s
févr. 26 10:30:11 DietPi btuart[228]: Device setup complete
févr. 26 10:30:11 DietPi systemd[1]: Started Configure Bluetooth Modems connected by UART.
févr. 26 10:30:11 DietPi systemd[1]: Starting Bluetooth service...
févr. 26 10:30:51 DietPi bluetoothd[920]: Bluetooth daemon 5.50
févr. 26 10:30:51 DietPi systemd[1]: Started Bluetooth service.
févr. 26 10:30:51 DietPi bluetoothd[920]: Starting SDP server
févr. 26 10:30:51 DietPi bluetoothd[920]: Excluding (cli) sap
févr. 26 10:30:51 DietPi bluetoothd[920]: Bluetooth management interface 1.18 initialized
févr. 26 10:30:52 DietPi bluetoothd[920]: Failed to set privacy: Rejected (0x0b)
There is no more "Not powered" error.
But, i still can't connect device.
They are gray in blueman.

I've also tried

Code: Select all

systemctl disable bluetooth
reboot
systemctl start bluetooth
without more succes.

Only

Code: Select all

systemctl daemon-reload
systemctl restart bluetooth
after a reboot make it :/

I dont have github account for now but i will create one in order to post logs if that can help.

Could you tell me how can i downgrade the kernel on Dietpi please ? I dont know the process.
Thanks.
User avatar
Joulinar
Posts: 4836
Joined: Sat Nov 16, 2019 12:49 am

Re: Bluetooth : keyboard / mouse / ps4 controler pairing

Post by Joulinar »

Could you tell me how can i downgrade the kernel on Dietpi please ? I dont know the process.
Well, DietPi is not providing any kernel. If I'm not mistaken you are on a Raspberry Pi. Therefore you would need to use Raspberry Foundation tools to perform this. It's possible by using rpi-update.

https://github.com/Hexxeh/rpi-update#options

you can downgrade as follow to 5.4.79

Code: Select all

sudo rpi-update 0642816ed05d31fb37fc8fbbba9e1774b475113f
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3032
Joined: Sat Nov 18, 2017 6:21 pm

Re: Bluetooth : keyboard / mouse / ps4 controler pairing

Post by MichaIng »

So based on the test result it seems that the service must fail one and is then able to start. Probably on first failure it creates some environment or actives the BT hardware somehow so that the second start succeeds. systemctl daemon-reload should be obsolete since the systemd unit content does not change.

So as workaround, allowing one automated restart in case of failure via service options should work.

But let's first see if a kernel downgrade helps.
vords
Posts: 16
Joined: Wed Feb 10, 2021 8:41 pm

Re: Bluetooth : keyboard / mouse / ps4 controler pairing

Post by vords »

Hello.

Sorry i've been afk for few days.

So i've downgrade to :

Code: Select all

uname -a 
Linux DietPi 5.4.79-v7l+ #1373 SMP Mon Nov 23 13:27:40 GMT 2020 armv7l GNU/Linux
After a reboot, blueman just show wireless controler, not keyboard.
Turning on controler doesn't make it connected automaticaly.

Here are logs :

Code: Select all

dmesg 
[   11.007640] Bluetooth: Core ver 2.22
[   11.007689] NET: Registered protocol family 31
[   11.007694] Bluetooth: HCI device and connection manager initialized
[   11.007708] Bluetooth: HCI socket layer initialized
[   11.007718] Bluetooth: L2CAP socket layer initialized
[   11.007734] Bluetooth: SCO socket layer initialized
[   11.016180] Bluetooth: HCI UART driver ver 2.3
[   11.016190] Bluetooth: HCI UART protocol H4 registered
[   11.016227] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   11.016352] Bluetooth: HCI UART protocol Broadcom registered
[   11.228847] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   11.228854] Bluetooth: BNEP filters: protocol multicast
[   11.228866] Bluetooth: BNEP socket layer initialized
[   12.924405] debugfs: File 'le_min_key_size' in directory 'hci0' already present!
[   12.924414] debugfs: File 'le_max_key_size' in directory 'hci0' already present!
[   60.668337] Bluetooth: RFCOMM TTY layer initialized
[   60.668353] Bluetooth: RFCOMM socket layer initialized
[   60.668372] Bluetooth: RFCOMM ver 1.11

Code: Select all

 journalctl -u bluetooth -u hciuart
-- Logs begin at Thu 2019-02-14 11:11:58 CET, end at Mon 2021-03-01 15:37:28 CET. --
mars 01 15:31:54 DietPi systemd[1]: Starting Configure Bluetooth Modems connected by UART...
mars 01 15:32:02 DietPi btuart[221]: bcm43xx_init
mars 01 15:32:02 DietPi btuart[221]: Flash firmware /lib/firmware/brcm/BCM4345C0.hcd
mars 01 15:32:02 DietPi btuart[221]: Set Controller UART speed to 3000000 bit/s
mars 01 15:32:02 DietPi btuart[221]: Device setup complete
mars 01 15:32:02 DietPi systemd[1]: Started Configure Bluetooth Modems connected by UART.
mars 01 15:32:02 DietPi systemd[1]: Starting Bluetooth service...
mars 01 15:32:02 DietPi bluetoothd[399]: Bluetooth daemon 5.50
mars 01 15:32:02 DietPi systemd[1]: Started Bluetooth service.
mars 01 15:32:02 DietPi bluetoothd[399]: Starting SDP server
mars 01 15:32:02 DietPi bluetoothd[399]: Excluding (cli) sap
mars 01 15:32:02 DietPi bluetoothd[399]: Bluetooth management interface 1.14 initialized
mars 01 15:32:03 DietPi bluetoothd[399]: Failed to set privacy: Rejected (0x0b)
Now..

Code: Select all

root@DietPi:~# systemctl daemon-reload
root@DietPi:~# systemctl restart bluetooth
Keyboard appear in the list of connectable device.
Wireless controler does connect after few try : Turning controler ON > Controler blink > Select connect to Human Interface Device Service in blueman > Some Data Activity indicator show up and down and controler turn off by him self.
After few try it does connect and stay stable.

Here are the logs.

journalctl -u bluetooth -u hciuart

Code: Select all

mars 01 15:40:56 DietPi bluetoothd[399]: Terminating
mars 01 15:40:56 DietPi systemd[1]: Stopping Bluetooth service...
mars 01 15:40:56 DietPi bluetoothd[399]: Stopping SDP server
mars 01 15:40:56 DietPi bluetoothd[399]: Exit
mars 01 15:40:56 DietPi systemd[1]: bluetooth.service: Succeeded.
mars 01 15:40:56 DietPi systemd[1]: Stopped Bluetooth service.
mars 01 15:40:56 DietPi systemd[1]: Starting Bluetooth service...
mars 01 15:40:56 DietPi bluetoothd[1019]: Bluetooth daemon 5.50
mars 01 15:40:56 DietPi systemd[1]: Started Bluetooth service.
mars 01 15:40:56 DietPi bluetoothd[1019]: Starting SDP server
mars 01 15:40:56 DietPi bluetoothd[1019]: Excluding (cli) sap
mars 01 15:40:56 DietPi bluetoothd[1019]: Bluetooth management interface 1.14 initialized
mars 01 15:41:54 DietPi bluetoothd[1019]: Authentication attempt without agent
mars 01 15:41:54 DietPi bluetoothd[1019]: Access denied: org.bluez.Error.Rejected
mars 01 15:42:02 DietPi bluetoothd[1019]: Can't get HIDP connection info
mars 01 15:42:07 DietPi bluetoothd[1019]: connect error: Host is down (112)
mars 01 15:42:15 DietPi bluetoothd[1019]: Can't get HIDP connection info
mars 01 15:42:16 DietPi bluetoothd[1019]: connect error: Operation already in progress (114)
mars 01 15:42:17 DietPi bluetoothd[1019]: Authentication attempt without agent
mars 01 15:42:17 DietPi bluetoothd[1019]: Access denied: org.bluez.Error.Rejected
mars 01 15:42:42 DietPi bluetoothd[1019]: Authentication attempt without agent
mars 01 15:42:42 DietPi bluetoothd[1019]: Access denied: org.bluez.Error.Rejected
mars 01 15:42:45 DietPi bluetoothd[1019]: Can't get HIDP connection info
mars 01 15:42:50 DietPi bluetoothd[1019]: connect error: Host is down (112)
mars 01 15:42:59 DietPi bluetoothd[1019]: Can't get HIDP connection info
mars 01 15:42:59 DietPi bluetoothd[1019]: Refusing input device connect: Operation already in progress (114)
dmesg

Code: Select all

[  535.785363] debugfs: File 'le_min_key_size' in directory 'hci0' already present!
[  535.785373] debugfs: File 'le_max_key_size' in directory 'hci0' already present!
[  601.745742] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[  601.745757] Bluetooth: HIDP socket layer initialized
[  658.489213] sony 0005:054C:09CC.0001: unknown main item tag 0x0
[  658.513258] input: Wireless Controller Touchpad as /devices/platform/soc/fe201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:09CC.0001/input/input1
[  658.513575] input: Wireless Controller Motion Sensors as /devices/platform/soc/fe201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:09CC.0001/input/input2
[  658.514246] input: Wireless Controller as /devices/platform/soc/fe201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:09CC.0001/input/input0
[  658.514493] sony 0005:054C:09CC.0001: input,hidraw0: BLUETOOTH HID v81.00 Gamepad [Wireless Controller] on b8:27:eb:d6:4d:70

So, it doesn't connect after reboot, so i'm not sure that it is a kernel issue.
User avatar
MichaIng
Site Admin
Posts: 3032
Joined: Sat Nov 18, 2017 6:21 pm

Re: Bluetooth : keyboard / mouse / ps4 controler pairing

Post by MichaIng »

Hmm: https://unix.stackexchange.com/question ... th-headset

Code: Select all

bluetoothctl trust <MAC-address>
bluetoothctl disconnect <MAC-address>
bluetoothctl connect <MAC-address>
But shouldn't it be possible, and automatically when pairing, that the device is trusted permanently?

On a similar report on Arch one stated that it was necessary to remove the device(s) once from trusted ones and re-scan/re-add it.
Post Reply