embedded config_error ai_generated partial

USB HID:报告描述符过大,最大允许 64 字节但描述符大小为 128 字节

USB HID: Report descriptor too large, max allowed 64 bytes but descriptor size is 128 bytes

ID: embedded/usb-hid-report-descriptor-too-large

其他格式: JSON · Markdown 中文 · English
78%修复率
83%置信度
1证据数
2024-06-19首次发现

版本兼容性

版本状态引入弃用备注
STM32 USB Device Library 2.6.0 active — — —
TinyUSB 0.16.0 active — — —
ARM GCC 12.2.1 active — — —

根因分析

USB HID 报告描述符超过设备配置描述符中定义的最大大小(bMaxPacketSize0),对于全速设备通常为 64 字节。

English

USB HID report descriptor exceeds the maximum size defined in device configuration descriptor (bMaxPacketSize0), typically 64 bytes for full-speed devices.

generic

官方文档

https://www.usb.org/document-library/hid-usage-tables-112

解决方案

  1. Compress report descriptor by using short items (e.g., replace INPUT(Data,Var,Abs) with INPUT(Const) for unused fields) and remove redundant usage pages. Example: replace multiple 4-byte items with 2-byte short forms.
  2. Switch to high-speed USB mode if hardware supports it (bMaxPacketSize0 = 512 bytes). Update device descriptor: bcdUSB = 0x0200 and configure PHY for HS. This allows larger report descriptors up to 512 bytes.

无效尝试

常见但无效的做法:

  1. Increase bMaxPacketSize0 in USB descriptor to 128 bytes 85% 失败

    bMaxPacketSize0 is limited by USB specification (64 bytes for full-speed, 512 for high-speed); increasing beyond spec causes host rejection.

  2. Split report descriptor across multiple endpoints 90% 失败

    HID class does not support multi-packet report descriptors; descriptor must fit in one control transfer.