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

- **ID:** `embedded/usb-hid-report-descriptor-too-large`
- **Domain:** embedded
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 78%

## Root Cause

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

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| STM32 USB Device Library 2.6.0 | active | — | — |
| TinyUSB 0.16.0 | active | — | — |
| ARM GCC 12.2.1 | active | — | — |

## Workarounds

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.** (85% success)
   ```
   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.** (75% success)
   ```
   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.
   ```

## Dead Ends

- **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% fail)
- **Split report descriptor across multiple endpoints** — HID class does not support multi-packet report descriptors; descriptor must fit in one control transfer. (90% fail)
