# USB HID：报告描述符过大，最大允许 64 字节但描述符大小为 128 字节

- **ID:** `embedded/usb-hid-report-descriptor-too-large`
- **领域:** embedded
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

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

## 版本兼容性

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

## 解决方案

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.
   ```

## 无效尝试

- **Increase bMaxPacketSize0 in USB descriptor to 128 bytes** — bMaxPacketSize0 is limited by USB specification (64 bytes for full-speed, 512 for high-speed); increasing beyond spec causes host rejection. (85% 失败率)
- **Split report descriptor across multiple endpoints** — HID class does not support multi-packet report descriptors; descriptor must fit in one control transfer. (90% 失败率)
