device: Reset svc_resolved on device_discover_services() request
PATCH 1/2 device: Reset svc_resolved on device_discover_services() request
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(-)
src/device.c +5 -2
@@ -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);
Signature · 1 line
2.43.0
PATCH 2/2 input: device: Browse SDP records if not cached
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(+)
profiles/input/device.c +29 -0
@@ -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; }
Signature · 1 line
2.43.0
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
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