24 #include "PluggableUSB.h" 32 #define HID_GET_REPORT 0x01 33 #define HID_GET_IDLE 0x02 34 #define HID_GET_PROTOCOL 0x03 35 #define HID_SET_REPORT 0x09 36 #define HID_SET_IDLE 0x0A 37 #define HID_SET_PROTOCOL 0x0B 39 #define HID_HID_DESCRIPTOR_TYPE 0x21 40 #define HID_REPORT_DESCRIPTOR_TYPE 0x22 41 #define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23 44 #define HID_SUBCLASS_NONE 0 45 #define HID_SUBCLASS_BOOT_INTERFACE 1 48 #define HID_PROTOCOL_NONE 0 49 #define HID_PROTOCOL_KEYBOARD 1 50 #define HID_PROTOCOL_MOUSE 2 54 #define HID_BOOT_PROTOCOL 0 55 #define HID_REPORT_PROTOCOL 1 58 #define HID_REPORT_TYPE_INPUT 1 59 #define HID_REPORT_TYPE_OUTPUT 2 60 #define HID_REPORT_TYPE_FEATURE 3 75 InterfaceDescriptor hid;
76 HIDDescDescriptor desc;
77 EndpointDescriptor in;
80 class HIDSubDescriptor {
82 HIDSubDescriptor *next = NULL;
83 HIDSubDescriptor(
const void *d,
const uint16_t l) : data(d), length(l) { }
86 const uint16_t length;
89 class HID_ :
public PluggableUSBModule {
93 int SendReport(uint8_t
id,
const void* data,
int len);
94 void AppendDescriptor(HIDSubDescriptor* node);
98 int getInterface(uint8_t* interfaceCount);
99 int getDescriptor(USBSetup&
setup);
101 uint8_t getShortName(
char* name);
106 HIDSubDescriptor* rootNode;
107 uint16_t descriptorSize;
118 #define D_HIDREPORT(length) { 9, 0x21, 0x01, 0x01, 0, 1, 0x22, lowByte(length), highByte(length) }