From ab6fcefea0be9df0b56abccb390e5c41d9670ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E9=9C=96=E9=93=83?= <2712495353@qq.com> Date: Thu, 2 Jul 2026 22:30:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=B6=88=E8=B4=B9?= =?UTF-8?q?=E8=80=85=E6=8E=A7=E5=88=B6=E6=8A=A5=E5=91=8A=E4=BB=A5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=92=AD=E6=94=BE/=E6=9A=82=E5=81=9C=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 HID 报告定义,将播放按钮的 ID 更新为播放/暂停 - 更新消费者报告映射,添加播放/暂停的使用情况 - 调整逻辑以确保播放/暂停功能正确映射到新的报告 ID --- main/services/ble_hid.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main/services/ble_hid.c b/main/services/ble_hid.c index 0d8aef5..1d2bb43 100644 --- a/main/services/ble_hid.c +++ b/main/services/ble_hid.c @@ -27,9 +27,9 @@ static const char *TAG = "ble_hid"; #define HID_CC_RPT_VOLUME_UP 0x40 #define HID_CC_RPT_VOLUME_DOWN 0x80 #define HID_CC_RPT_MUTE 1 -#define HID_CC_RPT_PLAY 5 -#define HID_CC_RPT_SCAN_NEXT_TRK 10 -#define HID_CC_RPT_SCAN_PREV_TRK 11 +#define HID_CC_RPT_PLAY_PAUSE 13 +#define HID_CC_RPT_SCAN_NEXT_TRK 10 +#define HID_CC_RPT_SCAN_PREV_TRK 11 /* * Keyboard (Report ID 1) + Consumer Control (Report ID 2, mediaReportMap2). @@ -113,8 +113,9 @@ static const unsigned char s_hid_report_map[] = { 0x09, 0xB5, // Usage (Scan Next Track) 0x09, 0xB6, // Usage (Scan Previous Track) 0x09, 0xB7, // Usage (Stop) + 0x09, 0xCD, // Usage (Play/Pause) 0x15, 0x01, // Logical Minimum (1) - 0x25, 0x0C, // Logical Maximum (12) + 0x25, 0x0D, // Logical Maximum (13) 0x75, 0x04, // Report Size (4) 0x95, 0x01, // Report Count (1) 0x81, 0x00, // Input (Data, Array, Absolute) @@ -187,7 +188,7 @@ static bool ble_hid_encode_consumer_report(uint16_t usage, uint8_t buffer[HID_CO ble_hid_cc_set_button(buffer, HID_CC_RPT_MUTE); return true; case HID_CONSUMER_PLAY_PAUSE: - ble_hid_cc_set_button(buffer, HID_CC_RPT_PLAY); + ble_hid_cc_set_button(buffer, HID_CC_RPT_PLAY_PAUSE); return true; case HID_CONSUMER_SCAN_NEXT: ble_hid_cc_set_button(buffer, HID_CC_RPT_SCAN_NEXT_TRK);