Hi Jan and everyone,
Thanks for the great session about Generic HID cs.
I've used it without any problem to exchange some bytes between my
DIY device (Atmel's tiny45) with V-USB firmware and using only a Control Transfer.
The report descriptor I'm using is as follow:
PROGMEM const char usbHidReportDescriptor[22] = {
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (
0x95, 0x88, // REPORT_COUNT (136)
0x09, 0x00, // USAGE (Undefined)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0xc0 // END_COLLECTION
};
Now, because I need to exchange two kinds of data: a large one (app. 136 byte, used rarely),
and a short one (8 bytes, used more frequently), would be better, if I use a report descriptor
having one input and one output reports beside the feature report I already have?
Something like that:
PROGMEM const char usbHidReportDescriptor[48] = {
0x06, 0xa0, 0xff, // USAGE_PAGE (Vendor Defined Page 1)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
// Input Report
0x09, 0x02, // Usage ID - vendor defined
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x75, 0x08, // Report Size (8 bits)
0x95, 0x08, // Report Count (8 fields)
0x81, 0x02, // Input (Data, Variable, Absolute)
// Output report
0x09, 0x03, // Usage ID - vendor defined
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x75, 0x08, // Report Size (8 bits)
0x95, 0x08, // Report Count (8 fields)
0x91, 0x02, // Output (Data, Variable, Absolute)
// Feature report
0x09, 0x04, // Usage ID - vendor defined
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x75, 0x08, // Report Size (8 bits)
0x95, 0x88, // Report Count (136 fields)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0xc0 // END_COLLECTION
};
Or, may be implementing an interrupt IN/OUT transfer is more reasonable in my case?
I'll be glad for any advise.
Thank You in advance,
hristo.