bluekitchen / btstack

Dual-mode Bluetooth stack, with small memory footprint.
http://bluekitchen-gmbh.com
Other
1.74k stars 613 forks source link

hid_device: allow configurable MTU #535

Closed shuffle2 closed 1 year ago

shuffle2 commented 1 year ago

Is your feature request related to a problem? Please describe. Implementing a HID device which needs to use reports larger than 48 bytes is currently impossible, as btstack hardcodes this value. You will see something like: [00:00:30.001] LOG -- l2cap.c.1544: l2cap_send cid 0x43, data length exceeds remote MTU.

Describe the solution you'd like The MTU values used in hid_device.c should be configurable. Either at build or run time. Runtime seems better, since one may want multiple hid_device instances with different MTUs. Alternatively, the below mentioned l2cap_create_channel calls could just use the relevant configured max mtu instead of hardcoding 48.

Additional context The MTUs are currently hardcoded to 48 at these locations: https://github.com/bluekitchen/btstack/blob/ebcec9d303c49e6d6f0b0ef8f3a9efe7abbb14d2/src/classic/hid_device.c#L714 https://github.com/bluekitchen/btstack/blob/ebcec9d303c49e6d6f0b0ef8f3a9efe7abbb14d2/src/classic/hid_device.c#L948

mringwal commented 1 year ago

Fixed in accepted PR #536