-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect BlueTooth devices by GATT service UUID #7127
Conversation
@hughsie devices detection by service UUID. Please pay attention to
|
Here I attached the output from |
libfwupdplugin/fu-bluez-device.c
Outdated
fu_device_add_instance_str(FU_DEVICE(self), "GATT", obj_uuid); | ||
if (!fu_device_build_instance_id_full(FU_DEVICE(self), | ||
FU_DEVICE_INSTANCE_FLAG_VISIBLE | | ||
FU_DEVICE_INSTANCE_FLAG_QUIRKS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think lose the FU_DEVICE_INSTANCE_FLAG_VISIBLE
and then we can still match it in quirks for "interesting device" rather than showing them all to the user as potential matches for firmware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm... I did a try and have:
11:59:10.360 FuEngine /org/bluez/hci0/dev_00_02_5B_00_FF_01 added FuBluezDevice:
Name: CCC5171
Flags: none
BatteryLevel: 98
...
Guid[quirk]: 21608f80-6c9c-5cd1-91ed-0fbf18e31958 <- BLUETOOTH\GATT_00001100-d102-11e1-9b23-00025b00a5a5
...
PhysicalId: /org/bluez/hci0
LogicalId: 00:02:5B:00:FF:01
BackendId: /org/bluez/hci0/dev_00_02_5B_00_FF_01
...
11:59:11.061 FuEngine no GUIDs for device CCC5171 [9f455188df0fd268b4b349575f714570967c3815]
The quirk file:
[BLUETOOTH\GATT_00001100-d102-11e1-9b23-00025b00a5a5]
Plugin = audio_s5gen2
ProxyGType = FuQcS5gen2BleDevice
Works well with FU_DEVICE_INSTANCE_FLAG_VISIBLE
flag.
Maybe I missed something else?
I'm trying to register the device, which is working via BLE proxy implementing the Interface for communication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no GUIDs for device CCC5171
That's actually success! We don't want to use any of the GATT UUIDs for firmware matching. I think you can fix this by adding a GUID (that is used for matching firmware) manually in the quirk file -- maybe even USB\VID_0A12&PID_4007
? I think we need to work out how to get a proper VID and PID for the FuQcS5gen2BleDevice device really -- so we know what firmware to suggest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you dump what you see for FuQcS5gen2BleDevice please?
@d4s mind if i rebase and merge this? There's another vendor interested in this functionality now. |
@hughsie I found that segfault and additionally moved some querying from my experimental code. Now the bluez device might look like:
|
@d4s also, the windows CI build seems to be failing with this -- maybe we need to sprinkle some ifdefs. |
Signed-off-by: Richard Hughes <richard@hughsie.com>
Signed-off-by: Richard Hughes <richard@hughsie.com>
Added GUID constructed from the Alias. In case if the device has no Modailas property the VID is not set, and the Alias-based name allows to clearly match the device: e3dfc8e1-e923-55b1-a2b7-1c6d82e312d2 <- BLUETOOTH\ALIAS_CCC5171 Used Alias property instead of the Name, since BlueZ documentation has the comment for the Name property: "This value is only present for completeness. It is better to always use the Alias property when displaying the devices name. If the Alias property is unset, it will reflect this value which makes it more convenient." https://github.com/luetzel/bluez/blob/master/doc/device-api.txt#L123
Some BT devices don't provide VID, so fwupd can't detect such devices properly. In the same time, the device might announce service with unique UUID for firmware upgrading. This commit allows to detect BT devices by UUID of the updating service, for instance: 21608f80-6c9c-5cd1-91ed-0fbf18e31958 ← BLUETOOTH\GATT_00001100-d102-11e1-9b23-00025b00a5a5 In addition, added querying of Battery service if available, and battery percentage is set according to received value If Device Information service is available it might also contain useful information for device identification, see https://www.bluetooth.com/specifications/dis-1-2/ for a full list. Also, allow to acquire write and notify for BlueZ devices, which allows us to interact with the device directly via file descriptor without D-Bus usage for every data portion.
Nah, we need to check for bits of GIO_UNIX -- I've fixed it up for you. |
ah! misunderstood your request. |
@hughsie thanks for changes! |
Some BT devices don't provide VID, so fwupd can't detect such devices properly. In the same time, the device might announce service with unique UUID for firmware upgrading.
This commit allows to detect BT devices by UUID of the updating service, for instance:
21608f80-6c9c-5cd1-91ed-0fbf18e31958 ← BLUETOOTH\GATT_00001100-d102-11e1-9b23-00025b00a5a5
In addition, added querying of Battery service if available, and battery percentage is set according to received value
Type of pull request: