Bluetooth pairing is a complete headache

When I first tried to pair my Logitech M337/M535 Bluetooth Mouse, I also encountered some difficulties. For example, the connection only lasted until I restarted the computer or switched off the mouse. After that, a new pairing was necessary each time.
With some web based research I found out that it was due to the lack of authentication.
While pairing I had to enter the command # hccontrol -n ubt0hci write_authentication_enable 1. As a result the file /var/db/ hcsecd.keys was filled with this line: 00:1f:20:f8:90:2f cf6fc48842b49542af7fc2a4ced9b009

After that, the pairing survived a restart of the computer...
 
When I have time to code ...

Working on polkit libs to manage devices with elevated privileges.
 

Attachments

  • Screenshot_2023-06-21_21-36-05.png
    Screenshot_2023-06-21_21-36-05.png
    26.6 KB · Views: 75
  • Screenshot_2023-06-21_21-44-03.png
    Screenshot_2023-06-21_21-44-03.png
    24.4 KB · Views: 73
I'm getting choppy music once in a while.
I'm trying to adjust the virtual_oss settings.
changed from
virtual_oss -T /dev/sndstat -C 2 -c 2 -r 48000 -b 16 -s 20ms ...
to
virtual_oss -T /dev/sndstat -C 2 -c 2 -r 48000 -b 16 -s 5ms ...
but still the problem.

Any suggestions?
Thanks
 
rmomota is this something you'll be publishing eventually?
I was thinking on that but I have to take a look at some details on my contract policy.
There are some points regarding the property of any of my creations and it includes code, even if I code after hours.
I will probably need authorization for that unless it gets stolen. 😂
 
P

Please share the code if possible
It's no longer working :(
I've to take a look at it again but basically after a previous pairing is done it does a
$ hccontrol -N -n ubt0hci create_connection [bt_addr]
and
$ virtual_oss -T /dev/sndstat -C 2 -c 2 -r 48000 -b 16 -s 5ms -P /dev/bluetooth/[bt_addr] -R /dev/null -d dsp
and on disconnect it kills the virtual_oss process
 
I did try everything already, was able to pair but then it never connects.
I had this working before and then stopped working for some reason, my headset has no problem.
try to delete all entries in .conf files in /etc/bluetooth and reboot before try again
and make sure to kill virtual_oss before you start
 
hw.snd.basename_clone: 1 -> 0
backend_bt: Could not open SDP
backend_bt: PSM=0xffffffff
backend_bt: PSM not found
 
I don't think that this device need encryption but I did try with and without.
Nothing seems to work.
 
check this out
in this document seems it's enabling what's needed and what's not needed.
sdpd is a daemon for the local running bluetooth services which I don't have any
the only service I had is the hcsecd and nothing else and it was working just fine.
something changed in the system maybe an update and now the far I can go is pair but then not able to launch the virtual_oss that completes the connection.
 
in this document seems it's enabling what's needed and what's not needed.
sdpd is a daemon for the local running bluetooth services which I don't have any
the only service I had is the hcsecd and nothing else and it was working just fine.
something changed in the system maybe an update and now the far I can go is pair but then not able to launch the virtual_oss that completes the connection.
Code:
hccontrol -n ubt0hci read_connection_list
does your headphone show up !!??
 
Code:
hccontrol -n ubt0hci read_connection_list
does your headphone show up !!??
yes it show 1 entry
Remote BD_ADDR Handle Type Mode Role Encrypt Pending Queue State
PLT_Focus 256 ACL 0 MAST NONE 0 0 OPEN

I can see in the dmesg
ubt0hci - ACL connection does not exist ...
 
yes it show 1 entry
Remote BD_ADDR Handle Type Mode Role Encrypt Pending Queue State
PLT_Focus 256 ACL 0 MAST NONE 0 0 OPEN

I can see in the dmesg
ubt0hci - ACL connection does not exist ...
Might be encryption issue? I have WH-1000XM5 and I use it with no encryption.
 
Good news! It's working again.
Well, here it goes, whenever I restarted the system the and run
$ sudo hccontrol -n ubt0hci read_encryption_mode
Encryption mode: Disabled [00]
$ sudo hccontrol -n ubt0hci read_authentication_enable
Authentication Enable: Disabled [0]

so found out that it loses the state of this values.
Enabled the state back to 1
$ sudo hccontrol -n ubt0hci write_encryption_mode 1
$ sudo hccontrol -n ubt0hci write_authentication_enable 1

then because I was already able to pair it before with
$ sudo bluetooth-config scan

I just had to
$ sudo hccontrol -n ubt0hci create_connection f4:b6:88:55:f0:7f
$ sudo virtual_oss -T /dev/sndstat -C 2 -c 2 -r 48000 -b 16 -s 20ms -P /dev/bluetooth/PLT_Focus -R /dev/null -d dsp
hw.snd.basename_clone: 1 -> 0
backend_bt: PSM=0x19

and it connected, but there are no devices listed in the sound plugin
I did
$ pacmd unload-module module-oss
$ pacmd load-module module-oss
$ pacmd load-module module-detect

and it got displayed as /dev/sdp , ugly name uh?

The sound is working fine but from time to time it chops for few seconds and goes back to normal.
So now what I need to find out yet is how to persist those flags and how to make module-oss to auto detect when it gets connected.
 
Good news! It's working again.
Well, here it goes, whenever I restarted the system the and run
$ sudo hccontrol -n ubt0hci read_encryption_mode
Encryption mode: Disabled [00]
$ sudo hccontrol -n ubt0hci read_authentication_enable
Authentication Enable: Disabled [0]

so found out that it loses the state of this values.
Enabled the state back to 1
$ sudo hccontrol -n ubt0hci write_encryption_mode 1
$ sudo hccontrol -n ubt0hci write_authentication_enable 1

then because I was already able to pair it before with
$ sudo bluetooth-config scan

I just had to
$ sudo hccontrol -n ubt0hci create_connection f4:b6:88:55:f0:7f
$ sudo virtual_oss -T /dev/sndstat -C 2 -c 2 -r 48000 -b 16 -s 20ms -P /dev/bluetooth/PLT_Focus -R /dev/null -d dsp
hw.snd.basename_clone: 1 -> 0
backend_bt: PSM=0x19

and it connected, but there are no devices listed in the sound plugin
I did
$ pacmd unload-module module-oss
$ pacmd load-module module-oss
$ pacmd load-module module-detect

and it got displayed as /dev/sdp , ugly name uh?

The sound is working fine but from time to time it chops for few seconds and goes back to normal.
So now what I need to find out yet is how to persist those flags and how to make module-oss to auto detect when it gets connected.
Good for you! I hope we have a GUI soon for this. It will be awesome.
also there is a new project called blued .. it looks very promessing.
 
ISSUE:
connection keeps geting sound chop and then drops after some seconds, sometimes last a couple of minutes.
It's only recoverable after doing a
$ sudo service bluetooth restart ubt0

it's impossible to use headsets with such problem
 
Back
Top