We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm making an application with an at91SAM7S128 uC and use the USB interface. As starting point I use the demo application. For my application it is required to send two bytes to the PC. I try to change the report, but it when I try the device is not even found by windows.
When I try to double the data I can receive from the PC (as show in the source below) is works fine. Have anyone an idée how I have to modify this report descriptor so I can send two bytes? Or must I change more on the demo program to get it working?
/* HID Report Descriptor */ const BYTE HID_ReportDescriptor[] = { HID_UsagePageVendor(0x00), HID_Usage(0x01), HID_Collection(HID_Application), HID_UsagePage(HID_USAGE_PAGE_BUTTON), HID_UsageMin(1), HID_UsageMax(4), HID_LogicalMin(0), HID_LogicalMax(1), HID_ReportCount(4), HID_ReportSize(1), HID_Input(HID_Data | HID_Variable | HID_Absolute), HID_ReportCount(1), HID_ReportSize(4), HID_Input(HID_Constant), HID_UsagePage(HID_USAGE_PAGE_LED), HID_Usage(HID_USAGE_LED_GENERIC_INDICATOR), HID_LogicalMin(0), HID_LogicalMax(1), HID_ReportCount(8), HID_ReportSize(2),// <- this work HID_Output(HID_Data | HID_Variable | HID_Absolute), HID_EndCollection, };
The problem is solved. I had looked only at the line's I used, but it that's not enough. When You also whant to change the size, keep in mind that the demo source don't send a byte, but only the last 4 bits.
HID_ReportCount(1), HID_ReportSize(4), HID_Input(HID_Constant),
This lines gives the problem. (HID_Constant)
If you change the descriptor to this:
const BYTE HID_ReportDescriptor[] = { HID_UsagePageVendor(0x00), HID_Usage(0x01), HID_Collection(HID_Application), HID_UsagePage(HID_USAGE_PAGE_BUTTON), HID_UsageMin(1), HID_UsageMax(254), HID_LogicalMin(0), HID_LogicalMax(1), HID_ReportCount(8),// <- 8 bits HID_ReportSize(2),// <- 2 x TX HID_Input(HID_Data | HID_Variable | HID_Absolute), HID_UsagePage(HID_USAGE_PAGE_LED), HID_Usage(HID_USAGE_LED_GENERIC_INDICATOR), HID_LogicalMin(0), HID_LogicalMax(1), HID_ReportCount(8), HID_ReportSize(2),// <- 2 x RX HID_Output(HID_Data | HID_Variable | HID_Absolute), HID_EndCollection, };
Sending with more or les data is easier to adjust, and it seems to work fine. For me this is the solution, I hope it will help you when you also have problems.