feat(bt_rssi): add 0xf9 feature report to get bt rssi

This commit is contained in:
awalol
2026-05-14 21:50:39 +08:00
parent 58909831e1
commit 908bace5c4
5 changed files with 88 additions and 34 deletions
+40 -32
View File
@@ -362,8 +362,8 @@ uint8_t descriptor_configuration[] = {
0x00, // bCountryCode: Not localized
0x01, // bNumDescriptors: 1 report descriptor
0x22, // bDescriptorType: Report
0x39, 0x01, // wDescriptorLength: 313 (0x0139) DS
// 0xAD, 0x01, // wDescriptorLength: 429 (0x01AD) DSE
0x41, 0x01, // wDescriptorLength: 321 (0x0141) DS
// 0xB5, 0x01, // wDescriptorLength: 437 (0x01B5) DSE
// Endpoint Descriptor (HID IN: EP4)
0x07, // bLength
@@ -408,9 +408,9 @@ uint8_t const *tud_descriptor_configuration_cb(uint8_t index) {
descriptor_configuration[offset - 1] = bInterval;
descriptor_configuration[offset - 8] = bInterval;
if (ds_mode()) {
descriptor_configuration[offset - 16] = 0x39;
descriptor_configuration[offset - 16] = 0x41;
}else {
descriptor_configuration[offset - 16] = 0xAD;
descriptor_configuration[offset - 16] = 0xB5;
}
return descriptor_configuration;
}
@@ -561,22 +561,26 @@ uint8_t const desc_hid_report_ds[] = {
0x09, 0x36, // Usage (0x36)
0x95, 0x03, // Report Count (3)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF6,
0x09, 0x37,
0x95, 0x3F,
0xB1, 0x02,
0x85, 0xF7,
0x09, 0x38,
0x95, 0x3F,
0xB1, 0x02,
0x85, 0xF8,
0x09, 0x39,
0x95, 0x3F,
0xB1, 0x02,
0x85, 0xF6, // Report ID (-10)
0x09, 0x37, // Usage (Vendor 0x37)
0x95, 0x3F, // Report Count (63)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF7, // Report ID (-9)
0x09, 0x38, // Usage (Vendor 0x38)
0x95, 0x3F, // Report Count (63)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF8, // Report ID (-8)
0x09, 0x39, // Usage (Vendor 0x39)
0x95, 0x3F, // Report Count (63)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF9, // Report ID (-7)
0x09, 0x3A, // Usage (Vendor 0x3A)
0x95, 0x3F, // Report Count (63)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0, // End Collection
// 313 bytes
// 321 bytes
};
static_assert(sizeof(desc_hid_report_ds) == 0x0139);
static_assert(sizeof(desc_hid_report_ds) == 0x0141);
uint8_t const desc_hid_report_dse[] = {
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
@@ -778,22 +782,26 @@ uint8_t const desc_hid_report_dse[] = {
0x85, 0x7B, // Report ID (123)
0x09, 0x53, // Usage (0x53)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF6,
0x09, 0x37,
0x95, 0x3F,
0xB1, 0x02,
0x85, 0xF7,
0x09, 0x38,
0x95, 0x3F,
0xB1, 0x02,
0x85, 0xF8,
0x09, 0x39,
0x95, 0x3F,
0xB1, 0x02,
0x85, 0xF6, // Report ID (-10)
0x09, 0x37, // Usage (Vendor 0x37)
0x95, 0x3F, // Report Count (63)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF7, // Report ID (-9)
0x09, 0x38, // Usage (Vendor 0x38)
0x95, 0x3F, // Report Count (63)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF8, // Report ID (-8)
0x09, 0x39, // Usage (Vendor 0x39)
0x95, 0x3F, // Report Count (63)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF9, // Report ID (-7)
0x09, 0x3A, // Usage (Vendor 0x3A)
0x95, 0x3F, // Report Count (63)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0, // End Collection
// 429 bytes
// 437 bytes
};
static_assert(sizeof(desc_hid_report_dse) == 0x01AD);
static_assert(sizeof(desc_hid_report_dse) == 0x01B5);
// Invoked when received GET HID REPORT DESCRIPTOR
// Application return pointer to descriptor