You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix USB descriptors for multiple interface devices (#3193)
For simple 1-interface devices, there is a fixed position in the USB
interface descriptor where the interface lives and we can hardcode
an updater in the USB handler. However, for devices like CDC(Serial)
or MIDI there are multiple interfaces and the interface IDs need to
be stuffed inside the actual descriptor.
To allow this, instead of just taking a fixed set of bytes and
blindly patching in USB, make all interfaces do their own memcpy
from a local version, updated with the new dynamic interface id,
via a callback.
Add a simple USBClass callback to handle the normal 1-interface
case.
Fix MSD (SingleFileDrive, FatFSUSB) to only request the correct, single
interface used.
voidtud_cdc_line_coding_cb(uint8_t itf, voidconst *p_line_coding); // Can't use cdc_line_coding_t const* p_line_coding, TinyUSB and BTStack conflict when we include tusb.h + BTStack.h
59
59
60
+
// USB interface descriptor CB
61
+
voidinterfaceCB(int itf, uint8_t *dst, int len);
62
+
60
63
private:
61
64
bool _running = false;
62
65
uint8_t _id;
63
66
uint8_t _epIn;
64
67
uint8_t _epOut;
68
+
uint8_t _epIn2;
69
+
uint8_t _strID;
65
70
66
71
typedefstruct {
67
72
unsignedint rebooting : 1;
@@ -73,6 +78,10 @@ class SerialUSB : public arduino::HardwareSerial {
73
78
SyntheticState _ss = { 0, 0, 0, 0, 115200};
74
79
75
80
voidcheckSerialReset();
81
+
82
+
staticvoid_cb(int itf, uint8_t *dst, int len, void *param) {
0 commit comments