I have successfully tryed the hid-data example provided with avrusb after fixing the command line tool.
Now i have changed back the Report to my previously working keyboard copyed from HID-Keys:
Code: Select all
PROGMEM char usbHidReportDescriptor[35] = { // USB report descriptor
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x06, // USAGE (Keyboard)
0xa1, 0x01, // COLLECTION (Application)
0x05, 0x07, // USAGE_PAGE (Keyboard)
0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x08, // REPORT_COUNT (8)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x08, // REPORT_SIZE (8)
0x25, 0x65, // LOGICAL_MAXIMUM (101)
0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
0x81, 0x00, // INPUT (Data,Ary,Abs)
0xc0 // END_COLLECTION
};
I wasnt expecting it to work, but it works perfectly.
So i wonder what is the difference between both Reports?
I can see different hex values but i dont know what they means.
For instance ones have REPORT_COUNT (128) and the comments says that the report consists in 128 opaque data bytes, and in this report i have REPORT_COUNT (1), so this means "1 opaque data byte".
Then why is the transfer working?
I can write and read all 128 values with hidtool.
My usbFunctionSteup is as follow:
Code: Select all
case USBRQ_HID_GET_REPORT:
// wValue: ReportType (highbyte), ReportID (lowbyte)
// we only have one report type, so don't look at wValue
// buildReport(keyPressed());
// usbMsgPtr = reportBuffer;
// return sizeof(reportBuffer); // This will always be 2
// fallback and use usbFunctionRead() to obtain data
case USBRQ_HID_SET_REPORT:
bytesRemaining = 128;
currentAddress = 0;
return USB_NO_MSG; // use usbFunctionWrite() to receive data from host
The 3 commented code lines seems to not be needed for the keyboard to work.