Re: How to Automatically Re-Connect Bluetooth HID over GATT (HOG) Device when BlueZ Plugin "hog" is Disabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Luiz,

Am 01.02.23 um 22:37 schrieb Luiz Augusto von Dentz:
Hi Martin,

On Wed, Feb 1, 2023 at 1:25 PM Martin Petzold <martin.petzold@xxxxxxxx> wrote:
Hi,

Linux 5.10, BlueZ 5.55

I have a remote control which implements Bluetooth LE. If I use the
default Bluetooth daemon, I am able to pair and trust using
bluetoothctl. If the connection is lost after a while (or days) and a
button on the remote control is pressed, the daemon re-connects
automatically (because the device is paired). This is basically what I need.

But, I would also like to manually set notifying for characteristics
(Report) on the HID service within my application (Java via d-bus). This
is not possible anymore (also not via bluetoothctl) because the "hog"
(or "input") plugin manages the input device and the related HID
services are now hidden.

I then added "--noplugin=input,hog" to my Bluetooth daemon. Which is
okay, because I don't need this support for Kernel HID. Great, now the
HID services are available (also using bluetoothctl), but the peripheral
does not re-connect automatically any more. I always have to connect
manually first. I also have no signal on the d-bus when I press the
button of the remote control, when it is disconnected.

How can I enable automatic re-connect for devices, when these plugins
are disabled?

The only other way I was thinking of is to leave the "hog" plugin
enabled and use the operating system HID interface. However, my
application runs as non-root which makes it complicated and also I would
like to have direct connection and control to my device.
https://github.com/bluez/bluez/blob/master/doc/gatt-api.txt#L390

Thanks, I have implemented and registered the HID profile using org.bluez.GattProfile1 and now the device (remote control) re-connects automatically.

However, when I enable notifying on the Report characteristics of the HID service after I received the first device properties update (with services resolved), I miss the first Report event. If I press a button, the remote re-connects and dbus events for device properties updated are fine, but I don't have a Report event. If I then press again, I do get a Report event, because I set notifying on the Report characteristics. Setting notify seems to be too late.

What is the trick to get also the first button pressed as a Report characteristic event?

At the moment I only have the HID service (00001812-0000-1000-8000-00805f9b34fb) in the properties map of the org.bluez.GattProfile1.

Thanks,

Martin

--
Martin Petzold (Inhaber & Geschäftsführer)

TAVLA Technology GmbH
Im Dau 14
50678 Köln
Deutschland

Telefon: +49 (0)221 / 3466 0885
Mobil: +49 (0)179 / 9220154
E-Mail: martin.petzold@xxxxxxxx




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux