X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/e5e7eaee7af719cee00a8c2cb6fb4649dde0aa05..526e398986583e2fb65c0a36a2fbf2ce153446e5:/Demos/Device/GenericHID/GenericHID.c diff --git a/Demos/Device/GenericHID/GenericHID.c b/Demos/Device/GenericHID/GenericHID.c index 207f63c26..695342d0e 100644 --- a/Demos/Device/GenericHID/GenericHID.c +++ b/Demos/Device/GenericHID/GenericHID.c @@ -160,15 +160,15 @@ EVENT_HANDLER(USB_ConfigurationChanged) EVENT_HANDLER(USB_UnhandledControlPacket) { /* Handle HID Class specific requests */ - switch (bRequest) + switch (USB_ControlRequest.bRequest) { case REQ_GetReport: - if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) { + uint8_t GenericData[GENERIC_REPORT_SIZE]; + Endpoint_ClearSETUP(); - uint8_t GenericData[GENERIC_REPORT_SIZE]; - CreateGenericHIDReport(GenericData); /* Write the report data to the control endpoint */ @@ -180,15 +180,15 @@ EVENT_HANDLER(USB_UnhandledControlPacket) break; case REQ_SetReport: - if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { + uint8_t GenericData[GENERIC_REPORT_SIZE]; + Endpoint_ClearSETUP(); /* Wait until the generic report has been sent by the host */ while (!(Endpoint_IsOUTReceived())); - uint8_t GenericData[GENERIC_REPORT_SIZE]; - Endpoint_Read_Control_Stream_LE(&GenericData, sizeof(GenericData)); ProcessGenericHIDReport(GenericData);