bluetooth: hid: fix SDP record and PTS compliance issues#568
Open
EListenX wants to merge 5 commits into
Open
Conversation
chengkai15
reviewed
Apr 3, 2026
chengkai15
reviewed
Apr 3, 2026
chengkai15
reviewed
Apr 3, 2026
chengkai15
reviewed
Apr 3, 2026
653ccec to
a93766c
Compare
zhongzhijie1
previously approved these changes
Apr 9, 2026
Contributor
zhongzhijie1
left a comment
There was a problem hiding this comment.
LGTM. SDP mandatory attributes 补全、protocol mode 持久化、report callback 修正 cookie 类型和 alignment、invalid report ID 拒绝、ACL keep alive for reconnect。PTS 覆盖充分。
02c5f40 to
c2debdc
Compare
chengkai15
reviewed
Apr 14, 2026
e816663 to
57e80ff
Compare
chengkai15
previously approved these changes
May 8, 2026
The merge-base changed after approval.
bug: v/88287 The HID SDP record template was missing the mandatory BT_SDP_ATTR_HID_NORMALLY_CONNECTABLE (0x020d) attribute, causing PTS test HID/DEV/HCE/BV-01-C to fail during SDP verification. Add the HIDNormallyConnectable boolean attribute (set to TRUE) to hid_attrs_template before HIDBootDevice (0x020e). Signed-off-by: v-yichenxi <v-yichenxi@xiaomi.com>
bug: v/88725 1. Fix crash in bttool hidd_get_report_cb and hidd_set_report_cb where cookie (remote_callback_t*) was incorrectly used as bt_instance_t* for bt_hid_device_response_report() and bt_hid_device_report_error(). Use g_bttool_ins instead. 2. Add missing HID Normally Connectable (0x020d) SDP attribute to hid_attrs_template so PTS can verify it. 3. Fix hid_get_report_callback parameter parsing to correctly extract rpt_type, rpt_id and buffer_size from struct bt_hid_report, accounting for structure alignment padding. Signed-off-by: v-yichenxi <v-yichenxi@xiaomi.com>
bug: v/88805 Store the protocol mode in sal_hid_connection so that SET_PROTOCOL actually saves the value and GET_PROTOCOL returns the current mode instead of always returning Report mode. Initialize protocol to Report mode on connection creation. This fixes PTS test case HID/DEV/HID/BV-09-C. Signed-off-by: v-yichenxi <v-yichenxi@xiaomi.com>
bug: v/88814 Validate report ID in hidd_get_report_cb before responding. If the report ID is not defined in the HID descriptor (only 0x01 and 0x02 are valid), respond with HANDSHAKE error ERR_INVALID_REPORT_ID instead of sending report data. This fixes PTS test case HID/DEV/HID/BI-01-C. Signed-off-by: v-yichenxi <v-yichenxi@xiaomi.com>
bug: v/88816 Add HIDDeviceReleaseNumber (0x0200) and HIDProfileVersion (0x020b) to the HID SDP record. These are mandatory attributes required by the HID specification. HIDProfileVersion is set to 0x0100 (HID v1.0) as expected by PTS. Signed-off-by: v-yichenxi <v-yichenxi@xiaomi.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: Please adhere to Contributing Guidelines.
Summary
Fix multiple HID Device PTS test failures related to SDP record completeness,
protocol mode handling, report callback correctness, and ACL link management.
Changes included:
SDP record fixes
HIDDeviceReleaseNumber (0x0200), HIDProfileVersion (0x020b)
ACL link management
allowing reconnection on existing link (HID/DEV/HCR/BV-01-C)
Report callback fixes
was incorrectly cast to bt_instance_t*
with proper alignment handling
Protocol mode persistence
instead of always returning Report mode (HID/DEV/HID/BV-09-C)
Impact
HID Device profile only. No impact on other Bluetooth profiles or build process.
Testing
Verified with Bluetooth PTS test cases: