chegewara / EspTinyUSB

ESP32S2 native USB library. Implemented few common classes, like MIDI, CDC, HID or DFU (update).
MIT License
475 stars 70 forks source link

Fix endpoint addresses for cdc/vendor #45

Closed xtrinch closed 2 years ago

xtrinch commented 2 years ago

Hello,

when using cdc & webusb at the same time, the default endpoint addresses actually clash (you can see it in the kernel logs and the device will not function properly), so it seems to me it would be nice that either the defaults are set so that they don't OR there's a line in the README indicating that they need to be overrridden if used together.

In the PR is what I used to un-clash my addresses, mostly copied from tinyusb own example at: https://github.com/hathach/tinyusb/blob/master/examples/device/webusb_serial/src/usb_descriptors.c

chegewara commented 2 years ago

Thanks, i will revert changes which i posted by accident trying to do USB flashing. Your changes are not quite good, because you are using too many endpoints in webusb, the only change required is in CDC.

xtrinch commented 2 years ago

When you say I am using too many endpoints in webusb, what do you mean by that? Bear with me I'm a beginner on this :) I thought for sure you need one IN, one OUT endpoint for webusb since it's bidirectional communication?

chegewara commented 2 years ago

Yes, you need need 1 IN and 1 OUT and thats fine. What i mean is that IN and OUT endpoints are enumerated the same way and you can use for both the same value, like 0x02 or 0x03. Then 0x80 is used to detect if its IN or OUT, but endpoint number is still 0x02 or 0x03.

xtrinch commented 2 years ago

Ah ok cool. Yeah I just copied from the example :) Thx for explanation

chegewara commented 2 years ago

https://github.com/chegewara/EspTinyUSB/releases/tag/1.3.4