PORTS Forum
Ports and Interfaces => USB => Topic started by: Antm on March 03, 2012, 05:19:59 pm
-
Hello all, please forgive me if this is a bit of a daft question as I am very new to USB.
I have an STM32P103 which I can connect to the generic HID cs program, I can transfer data back and forth fine. What I want to do is change the size of the input report, when I do this in my uP code the HID program will no longer recognise the device... so I assume it is coded into the HID cs program to only be 2 bytes in length (including identifier).
Does this sound correct? I have been looking for where to alter the c# code so I can increase the input report size but have had no joy so far.
Many thanks,
Anthony.
-
The device stores the report descriptor that defines the size of each report. See the HIDP_CAPS structure returned by HidP_GetCaps. If you want a longer report, you need to change the device firmware.
Jan
-
I see, so the c# program looks to see the size of the input report from the device. This is what I have so far:
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(2),
HID_LogicalMin(0),
HID_LogicalMax(1),
HID_ReportCount(2), // 2
HID_ReportSize(1), // 1
HID_Input(HID_Data | HID_Variable | HID_Absolute),
HID_ReportCount(1), // 1
HID_ReportSize(6),
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 ), // 8
HID_ReportSize(2),
HID_Output(HID_Data | HID_Variable | HID_Absolute), // Out report, from HOST
HID_EndCollection,
};
I thought that just changing the report size for the top input report would be the way to get what I want, though if I do this the c# program no longer recognises the device which makes me think that the top input report is not what I am looking for. No matter what I change on the above when the device connects it always gives the input report size as being 2 bytes.
-
Thanks for the advice before... I have made some progress.
Now I can increase the size of the input report and the C# program will report this correctly. My problem now is that the input report will not be displayed and it gives me a time out waiting for the report. I assume this is just because I need to add to the C# code to get more than 1 byte and display this in the text box, even if the rest of the reports are empty?
Anthony.
-
Ignore the last 2 posts, I now have it working correctly.