src/demo.h: changed definition of InReport into InReport[8]
src/demo.c: changed definition of InReport into InReport[8]
changed GetInReport function to put (and remove) keys in InReport[2] at regular intervals
src/hiduser.c: changed HID_GetReport to get the full InReport[] buffer into EP0Buf[]
src/usbdesc.c: changed the HID Report descriptor to identify a keyboard device:
/* HID Report Descriptor */
const uint8_t HID_ReportDescriptor[] = {
HID_UsagePage(HID_USAGE_PAGE_GENERIC),
HID_Usage(HID_USAGE_GENERIC_KEYBOARD),
HID_Collection(HID_Application),
HID_UsagePage(HID_USAGE_PAGE_KEYBOARD),
HID_UsageMin(0xe0),
HID_UsageMax(0xe7),
HID_LogicalMin(0),
HID_LogicalMax(1),
HID_ReportSize(1),
HID_ReportCount(8),
HID_Input(HID_Data | HID_Variable | HID_Absolute),
HID_ReportCount(1),
HID_ReportSize(8),
HID_Input(HID_Constant),
HID_ReportCount(5),
HID_ReportSize(1),
HID_UsagePage(HID_USAGE_PAGE_LED),
HID_UsageMin(1),
HID_UsageMax(5),
HID_Output(HID_Data | HID_Variable | HID_Absolute),
HID_ReportCount(1),
HID_ReportSize(3),
HID_Output(HID_Constant),
HID_ReportCount(6),
HID_ReportSize(8),
HID_LogicalMin(0),
HID_LogicalMax(101),
HID_UsagePage(HID_USAGE_PAGE_KEYBOARD),
HID_UsageMin(0),
HID_UsageMax(101),
HID_Input(HID_Data | HID_Array),
HID_EndCollection,
};
In the USB_ConfigDescriptor[] enabled the USB_CONFIG_REMOTE_WAKEUP in the bmAttributes field
and changed the InterfaceSubClass and InterFaceProtocol in HID_SUBCLASS_NONE and HID_PROTOCOL_KEYBOARD.
also changed bcdHID in the intefacedescriptor into 0x0101 instead of 0x0100
and the wMaxPacketSize in the endpoint is set to 8 (was 4)
src/demo.c: add simulated keypresses in the GetInReport function:
void GetInReport (void) {
static unsigned counter = 0;
static unsigned keycode = 0x04;
switch(counter++) {
case 1: InReport[2] = keycode++;
if(keycode > 0x1d) keycode = 0x04; // Rotate back from Z to A
break;
case 3: InReport[2] = 0;
break;
case 16:counter = 0;
break;
}
return;
} |