+ if ((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_CLASS) { /* class request type */
+ switch(rq->bRequest) {
+ case USBRQ_HID_GET_REPORT: // send "no keys pressed" if asked here
+ // wValue: ReportType (highbyte), ReportID (lowbyte)
+ usbMsgPtr = (void *)&keyboard_report; // we only have this one
+ keyboard_report.modifier = 0;
+ keyboard_report.keycode[0] = 0;
+ return sizeof(keyboard_report);
+ case USBRQ_HID_SET_REPORT: // if wLength == 1, should be LED state
+ if (rq->wLength.word == 1) {
+ current_command = LED_WRITE;
+ return USB_NO_MSG;
+ }
+ return 0;
+ case USBRQ_HID_GET_IDLE: // send idle rate to PC as required by spec
+ usbMsgPtr = &idleRate;
+ return 1;
+ case USBRQ_HID_SET_IDLE: // save idle rate as required by spec
+ idleRate = rq->wValue.bytes[1];
+ return 0;
+ }
+ }
+ if ((rq->bmRequestType & USBRQ_TYPE_MASK) == USBRQ_TYPE_VENDOR) {