bluer icon indicating copy to clipboard operation
bluer copied to clipboard

Can setting the connection interval parameter be added?

Open Jah-On opened this issue 1 year ago • 10 comments
trafficstars

Hello,

Is it possible to set the connection interval in BlueR or is this a "wait for bluetoothd to add it then we will" issue?

Thanks

Jah-On avatar Nov 28 '23 00:11 Jah-On

What method do you use to set the connection interval?

surban avatar Nov 28 '23 11:11 surban

What method do you use to set the connection interval?

We think it's LoadConnectionParameters but we have not tried it with a command line utility yet. We tried

echo "16" > /sys/kernel/debug/bluetooth/hci0/conn_min_interval

echo "16" > /sys/kernel/debug/bluetooth/hci0/conn_max_interval

as sudo but could not modify the file even after stopping BlueZ.

Jah-On avatar Nov 28 '23 12:11 Jah-On

Given the path it seems to be a debug-only setting.

@Vudentz Do you know a supported method to achieve the same result? Does it make sense to extend the Bluetooth D-Bus API to change adapter settings like these?

surban avatar Nov 28 '23 17:11 surban

Without this ability, ASHA can not be implemented for Linux. As we understand it, the connection interval must be set to 10 or 20 ms for hearing aids and cochlear implants to properly receive the data. For some reason, Cochlear's N7 advertises a max interval of 30ms but this will not work for streaming. Google's ASHA implementation forces the interval to be either 10 or 20ms.

Jah-On avatar Nov 28 '23 17:11 Jah-On

I support adding this enhancement. Setting the connection interval is required for implementing ASHA on Linux.

hxk1633 avatar Nov 28 '23 22:11 hxk1633

Same here, this is much needed for ASHA, we noticed https://github.com/bluez/bluez-asha Can we have an official place for this?

shareefalis avatar Nov 28 '23 22:11 shareefalis

Hello,

Just checking in to see if there are any updates on if or when this will be added. I reckon I could use the old BlueZ 4 kernel API to set the connection interval. This possibly can be done with FFI but I'm not sure if that's a good idea. Ideally, everything should be managed via BlueR.

Thanks!

Jah-On avatar Jan 22 '24 02:01 Jah-On

Hello,

I am also interested in ASHA in linux, while I do not undestand much about the internals of blueZ, there is this code about the HCI, https://github.com/bluez/bluez/blob/master/lib/hci.c , that helps in defining the connection interval

I think creating Rust bindings to the HCI part of blueZ, is a good start to solve this issue, what do y'all think?

OmarCastro avatar Jan 22 '24 23:01 OmarCastro

Although I like the idea of adding a HCI interface to BlueR, I don't think that it is the right solution to this particular problem. You will run into permission problems, since HCI functions are not available to non-root users. Furthermore, to my knowledge bluetoothd (if running) should be the only process using the HCI interface.

While I am not an expert on this particular issue, I suppose the way forward is to implement functionality to set the connection interval in bluetoothd and expose it via D-Bus. Since it is a global parameter of the Bluetooth controller, bluetoothd will have to merge requests from different clients.

Afterwards it is a simple step to include an API for that in BlueR.

surban avatar Jan 25 '24 22:01 surban

Hey @surban, thanks for your reply! I opened an issue on the main BlueZ repo, https://github.com/bluez/bluez/issues/731, so hopefully we can get somewhere with it.

Cheers

Jah-On avatar Jan 25 '24 23:01 Jah-On