PORTS Forum
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
This forum is closed to new activity.
The posts are available to browse, but posting has been disabled. BIG THANKS to all who have participated and shared your knowledge over the past 13 years.
Aug 11, 2023
Home
Help
Search
Login
Register
PORTS Forum
»
Ports and Interfaces
»
USB
»
USB HID Reports - different report sizes for different report ID's
« previous
next »
Print
Pages: [
1
]
Author
Topic: USB HID Reports - different report sizes for different report ID's (Read 14756 times)
E4dev
Member
Posts: 6
USB HID Reports - different report sizes for different report ID's
«
on:
January 09, 2012, 09:20:27 pm »
Y'all:
I am writing an application for a ST Cortex M3 processor that uses HID interrupt transfers to send information to the device from Windows. I do not seem to be able to use different sizes for the reports, even though each report has a different reportid. Windows signals an error for every write with a size not equal the size of the largest OUT report in my table. Different sizes in IN and OUT Ep's seem to work. Is that normal behavior or is it related to my report definition (see below).
const uint8_t CustomHID_ReportDescriptor[CUSTOMHID_SIZ_REPORT_DESC] =
{
0x06, 0x00, 0xFF, /* USAGE_PAGE (Vendor Page: 0xFF00) */
0x09, 0x01, /* USAGE (Demo Kit) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x26, 0x7f, 0x00, /* LOGICAL_MAXIMUM (1) */
/* 12 */
0xa1, 0x01, /* Application Collection */
/* Erase */
0x85, BL_OUT_REPORT_ERASE, /* REPORT_ID (2) */
0x75, CUSTOMHID_REPORTSIZE_8BIT, /* REPORT_SIZE (
*/
0x95, BL_MSG_CNT_ERASE, /* REPORT_COUNT (1) */
0x09, 0x01, /* USAGE */
0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
/* Prog hex record */
0x85, BL_OUT_REPORT_PROGHEX, /* REPORT_ID (3) */
0x75, CUSTOMHID_REPORTSIZE_8BIT, /* REPORT_SIZE (
*/
0x95, BL_MSG_CNT_PROGHEX, /* REPORT_COUNT (1) */
0x09, 0x02, /* USAGE */
0x91, 0x82, /* OUTPUT (Data,Var,Abs,Vol) */
/* Status */
0x85, BL_IN_REPORT_STATUS, /* REPORT_ID (7) */
0x75, CUSTOMHID_REPORTSIZE_8BIT, /* REPORT_SIZE (
*/
0x95, BL_MSG_CNT_STATUS,
0x09, 0x03, /* USAGE */
0x81, 0x82, /* INPUT (Data,Var,Abs,Vol) */
0xc0
}; /* CustomHID_ReportDescriptor */
Thanks,
HJ
Logged
Jan Axelson
Administrator
Frequent Contributor
Posts: 3033
Re: USB HID Reports - different report sizes for different report ID's
«
Reply #1 on:
January 09, 2012, 10:23:24 pm »
Make the output buffer big enough to fit the largest report + 1 byte for the report ID. You don't have to use the whole buffer if the report is shorter.
Jan
Logged
E4dev
Member
Posts: 6
Re: USB HID Reports - different report sizes for different report ID's
«
Reply #2 on:
January 10, 2012, 12:49:08 pm »
Thanks Jan,
I just checked the message with a packet analyzer and Windows indeed only sends a packet with the length of the report size, not the buffer size. Maybe this should be documented in the FAQ, because I could not find it in your book.
-HJ
Logged
Jan Axelson
Administrator
Frequent Contributor
Posts: 3033
Re: USB HID Reports - different report sizes for different report ID's
«
Reply #3 on:
January 10, 2012, 12:51:21 pm »
Thanks for the suggestion.
Jan
Logged
Print
Pages: [
1
]
« previous
next »
PORTS Forum
»
Ports and Interfaces
»
USB
»
USB HID Reports - different report sizes for different report ID's