* [PATCH BlueZ 1/2] device: Reset svc_resolved on device_discover_services() request
@ 2025-04-16 15:55 Frédéric Danis
2025-04-16 15:55 ` [PATCH BlueZ 2/2] input: device: Browse SDP records if not cached Frédéric Danis
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Frédéric Danis @ 2025-04-16 15:55 UTC (permalink / raw)
To: linux-bluetooth
This allows profiles requesting to re-retrieve the services records
(SDP or GATT) to be called back once the services are completed using
device_wait_for_svc_complete().
---
src/device.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/device.c b/src/device.c
index 097b1fbba..ee9216a8e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5989,10 +5989,13 @@ int device_discover_services(struct btd_device *device)
{
int err;
- if (device->bredr)
+ if (device->bredr) {
+ device->bredr_state.svc_resolved = FALSE;
err = device_browse_sdp(device, NULL);
- else
+ } else {
+ device->le_state.svc_resolved = FALSE;
err = device_browse_gatt(device, NULL);
+ }
if (err == 0 && device->discov_timer) {
timeout_remove(device->discov_timer);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH BlueZ 2/2] input: device: Browse SDP records if not cached
2025-04-16 15:55 [PATCH BlueZ 1/2] device: Reset svc_resolved on device_discover_services() request Frédéric Danis
@ 2025-04-16 15:55 ` Frédéric Danis
2025-04-16 17:39 ` [BlueZ,1/2] device: Reset svc_resolved on device_discover_services() request bluez.test.bot
2025-04-24 17:06 ` bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: Frédéric Danis @ 2025-04-16 15:55 UTC (permalink / raw)
To: linux-bluetooth
For a HID paired device, if the cache file containing the SDP records
is not present this will prevent the device to connect and need to
remove it and pair again.
Current bluetoothd traces:
src/shared/mgmt.c:can_read_data() [0x0000] event 0x000b
src/adapter.c:connected_callback() hci0 device EC:83:50:76:BD:67
connected eir_len 31
src/shared/mgmt.c:can_read_data() [0x0000] event 0x0006
profiles/input/server.c:connect_event_cb() Incoming connection from
EC:83:50:76:BD:67 on PSM 17
profiles/input/device.c:input_device_set_channel() idev 0x5580c6a331b0
psm 17
profiles/input/server.c:confirm_event_cb()
profiles/input/server.c:connect_event_cb() Incoming connection from
EC:83:50:76:BD:67 on PSM 19
profiles/input/device.c:input_device_set_channel() idev 0x5580c6a331b0
psm 19
profiles/input/device.c:hidp_add_connection() Could not parse HID SDP
record: No such file or directory (2)
profiles/input/device.c:ctrl_watch_cb() Device EC:83:50:76:BD:67
disconnected
profiles/input/device.c:intr_watch_cb() Device EC:83:50:76:BD:67
disconnected
This commit tries to retrieve the SDP record from the remote HID then
to add the HIDP connection.
---
profiles/input/device.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/profiles/input/device.c b/profiles/input/device.c
index b162c0bc7..c1bb5588d 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -86,6 +86,7 @@ struct input_device {
bool virtual_cable_unplug;
uint8_t type;
unsigned int idle_timer;
+ bool sdp_rediscover;
};
static int idle_timeout = 0;
@@ -1045,6 +1046,22 @@ static gboolean encrypt_notify(GIOChannel *io, GIOCondition condition,
return FALSE;
}
+static void input_device_update_rec(struct input_device *idev);
+static int hidp_add_connection(struct input_device *idev);
+
+static void hidp_sdp_cb(struct btd_device *dev, int err, void *user_data)
+{
+ struct input_device *idev = user_data;
+
+ DBG("");
+
+ /* Attempt to update SDP record if it had changed */
+ input_device_update_rec(idev);
+
+ if (hidp_add_connection(idev) < 0)
+ btd_service_disconnect(idev->service);
+}
+
static int hidp_add_connection(struct input_device *idev)
{
struct hidp_connadd_req *req;
@@ -1061,6 +1078,18 @@ static int hidp_add_connection(struct input_device *idev)
if (err < 0) {
error("Could not parse HID SDP record: %s (%d)", strerror(-err),
-err);
+ if (err == -ENOENT && !idev->sdp_rediscover) {
+ err = device_discover_services(idev->device);
+ if (err < 0) {
+ error("Could not discover services: %s (%d)",
+ strerror(-err), -err);
+ goto cleanup;
+ }
+
+ idev->sdp_rediscover = TRUE;
+ device_wait_for_svc_complete(idev->device,
+ hidp_sdp_cb, idev);
+ }
goto cleanup;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [BlueZ,1/2] device: Reset svc_resolved on device_discover_services() request
2025-04-16 15:55 [PATCH BlueZ 1/2] device: Reset svc_resolved on device_discover_services() request Frédéric Danis
2025-04-16 15:55 ` [PATCH BlueZ 2/2] input: device: Browse SDP records if not cached Frédéric Danis
@ 2025-04-16 17:39 ` bluez.test.bot
2025-04-24 17:06 ` bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-04-16 17:39 UTC (permalink / raw)
To: linux-bluetooth, frederic.danis
[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=954076
---Test result---
Test Summary:
CheckPatch PENDING 0.32 seconds
GitLint PENDING 0.36 seconds
BuildEll PASS 21.65 seconds
BluezMake PASS 2640.54 seconds
MakeCheck PASS 20.53 seconds
MakeDistcheck PASS 199.25 seconds
CheckValgrind PASS 276.84 seconds
CheckSmatch PASS 311.95 seconds
bluezmakeextell PASS 132.45 seconds
IncrementalBuild PENDING 0.42 seconds
ScanBuild PASS 945.63 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [BlueZ,1/2] device: Reset svc_resolved on device_discover_services() request
2025-04-16 15:55 [PATCH BlueZ 1/2] device: Reset svc_resolved on device_discover_services() request Frédéric Danis
2025-04-16 15:55 ` [PATCH BlueZ 2/2] input: device: Browse SDP records if not cached Frédéric Danis
2025-04-16 17:39 ` [BlueZ,1/2] device: Reset svc_resolved on device_discover_services() request bluez.test.bot
@ 2025-04-24 17:06 ` bluez.test.bot
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-04-24 17:06 UTC (permalink / raw)
To: linux-bluetooth, frederic.danis
[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=954076
---Test result---
Test Summary:
CheckPatch PENDING 0.34 seconds
GitLint PENDING 0.35 seconds
BuildEll PASS 21.15 seconds
BluezMake PASS 2909.56 seconds
MakeCheck PASS 20.10 seconds
MakeDistcheck PASS 208.79 seconds
CheckValgrind PASS 288.10 seconds
CheckSmatch PASS 319.67 seconds
bluezmakeextell PASS 133.32 seconds
IncrementalBuild PENDING 0.31 seconds
ScanBuild PASS 956.83 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-24 17:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16 15:55 [PATCH BlueZ 1/2] device: Reset svc_resolved on device_discover_services() request Frédéric Danis
2025-04-16 15:55 ` [PATCH BlueZ 2/2] input: device: Browse SDP records if not cached Frédéric Danis
2025-04-16 17:39 ` [BlueZ,1/2] device: Reset svc_resolved on device_discover_services() request bluez.test.bot
2025-04-24 17:06 ` bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox