hathach / tinyusb

An open source cross-platform USB stack for embedded system
https://www.tinyusb.org
MIT License
4.72k stars 1.01k forks source link

samd SETUP buffer size #247

Closed kaysievers closed 4 years ago

kaysievers commented 4 years ago

I need to add something like this:

--- a/tinyusb/src/portable/microchip/samd/dcd_samd.c
+++ b/tinyusb/src/portable/microchip/samd/dcd_samd.c
@@ -44,6 +44,8 @@ static inline void prepare_setup(void)
   // Only make sure the EP0 OUT buffer is ready
   // SETUP token doesn't check any other parameters
   sram_registers[0][0].ADDR.reg = (uint32_t) _setup_packet;
+  sram_registers[0][0].PCKSIZE.bit.MULTI_PACKET_SIZE = sizeof(_setup_packet);
+  sram_registers[0][0].PCKSIZE.bit.BYTE_COUNT = 0;
 }

to make https://github.com/hathach/tinyusb/commit/49b316143ad4e1bd6130b3032b8418be7e0bc2c3 work properly on Linux, Windows appears to work fine without this change.

[ 2757.279279] usb 1-3.4: new full-speed USB device number 120 using xhci_hcd
[ 2757.371886] usb 1-3.4: unable to read config index 0 descriptor/start: -32
[ 2757.371891] usb 1-3.4: chopping to 0 config(s)
[ 2757.371894] usb 1-3.4: can't read configurations, error -32
[ 2757.449265] usb 1-3.4: new full-speed USB device number 121 using xhci_hcd
[ 2757.541670] usb 1-3.4: unable to read config index 0 descriptor/start: -32
[ 2757.541675] usb 1-3.4: chopping to 0 config(s)
[ 2757.541678] usb 1-3.4: can't read configurations, error -32
[ 2757.543265] usb 1-3-port4: attempt power cycle
[ 2758.134263] usb 1-3.4: new full-speed USB device number 122 using xhci_hcd
[ 2758.150574] usb 1-3.4: unable to read config index 0 descriptor/start: -32
[ 2758.150578] usb 1-3.4: chopping to 0 config(s)
[ 2758.150581] usb 1-3.4: can't read configurations, error -32
hathach commented 4 years ago

fixed, thanks for the issue. hopefully this is the last PR for racing issue.

kaysievers commented 4 years ago

Yeah, updated all the repos now and tested a SAMD51 device connected to Windows, Android, Linux (Desktop), iOS. It seems all fine. Thanks!