IDE version is 1.8.4, recent enough.
I am trying to understand USBCore for Arduino micro so I can re-purpose it to enumerate a specific HID device that does the following:
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
Currently my micro does this:
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
In my user code, I have used both Keyboard and Mouse libraries. My bootloader may be a bit older but I don't know if that makes enough difference to the above descriptor, which I thought was in the user code.
From reading the USBCore.h, I found the typedef of interface descriptor and a macro to create one:
// Interface
typedef struct
{
u8 len; // 9
u8 dtype; // 4
u8 number;
u8 alternate;
u8 numEndpoints;
u8 interfaceClass;
u8 interfaceSubClass;
u8 protocol;
u8 iInterface;
} InterfaceDescriptor;
#define D_INTERFACE(_n,_numEndpoints,_class,_subClass,_protocol) \
{ 9, 4, _n, 0, _numEndpoints, _class,_subClass, _protocol, 0 }
Strangely enough the "9" was a magic number although this was already defined earlier:
#define USB_CONFIGUARTION_DESC_SIZE 9
I am still going through USBCore.cpp, which is long. I didn't spot where the actual interface descriptor is created, maybe not in this code but elsewhere?
Any pointers and advice where to find the code that creates the interface structures and "load" them up would be appreciated?
Thanks.