daniel-thompson / i2c-star

A clone of the i2c-tiny-usb based upon STM32 and libopencm3
GNU General Public License v3.0
127 stars 31 forks source link

Proposal: Increase USB control buffer size #15

Open broth-itk opened 3 years ago

broth-itk commented 3 years ago

Background:

With the original i2c-tiny-usb there was a problem with the maximum I2C transfer size. In the past I had a TPM module connected to the adapter and the linux kernel was unable to talk to it.

Anyhow, I fixed the issue with a patch in the usbtiny code (see changelog in https://dicks.home.xs4all.nl/avr/usbtiny/usbtiny-1.7.tar.gz) for details.

In i2c-star that can be accomplished much easier. My test environment uses 1024 bytes for the control buffer:

uint8_t usbd_control_buffer[1024];

This works fine. Tested with libusb-1.0 and a custom control message.

The static reply_buf will need to get adjusted as well:

static uint8_t reply_buf[1024];

Proposal: Increase control buffer size or use #define USB_CONTROL_BUFSIZE 1024

If you think it's worth the effort to provide the change via fork + pull request, please let me know.

Thanks for your great project :)

daniel-thompson commented 3 years ago

Yes, this sounds useful.