Added general purpus HID report
Fork of USBDevice by
Diff: USBHID/USBMouseKeyboard.cpp
- Revision:
- 28:6cc8a2d36729
- Parent:
- 25:7c72828865f3
--- a/USBHID/USBMouseKeyboard.cpp Wed Jun 18 09:00:48 2014 +0100 +++ b/USBHID/USBMouseKeyboard.cpp Fri Aug 15 14:14:38 2014 +0000 @@ -438,6 +438,22 @@ REPORT_COUNT(1), 0x01, INPUT(1), 0x01, END_COLLECTION(0), + + + // Generic device + 0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0xa1, 0x01, // COLLECTION (Application) + REPORT_ID(1),REPORT_ID_UTILITY, + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, REPORT_PAYLOAD_SIZE, // REPORT_COUNT + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x09, 0x01, // USAGE (Vendor Usage 1) + 0x91, 0x02, // OUTPUT (Data,Var,Abs) + 0xc0 // END_COLLECTION }; reportLength = sizeof(reportDescriptor); return reportDescriptor; @@ -554,14 +570,17 @@ USBDevice::readEP(EPINT_OUT, led, &bytesRead, MAX_HID_REPORT_SIZE); // we take led[1] because led[0] is the report ID - lock_status = led[1] & 0x07; - + if(led[0]==REPORT_ID_UTILITY) + { + genericHidCallback(bytesRead-1, &led[1]); + } // We activate the endpoint to be able to recceive data if (!readStart(EPINT_OUT, MAX_HID_REPORT_SIZE)) return false; return true; } + uint8_t USBMouseKeyboard::lockStatus() { return lock_status; }