<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Reading from a Vendor Defined HID device</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/30775/reading-from-a-vendor-defined-hid-device</link><description> 
Hi, 

 
I have a vendor defined hid device with Usage Page: 0xFF00 and
Usage: 0x01. I can read it through CreateFile, ReadFile function on
Windows XP. However, the data rate (500 msec after 2 packets
received) is far lower than the MCU transmission</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Reading from a Vendor Defined HID device</title><link>https://community.arm.com/thread/143428?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2013 10:01:56 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ddaec5c2-f119-467f-838f-2043dede69e6</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
Heh, then bus hound is not reliable.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading from a Vendor Defined HID device</title><link>https://community.arm.com/thread/140611?ContentTypeID=1</link><pubDate>Wed, 28 Aug 2013 10:00:32 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0fcebb3d-4900-4190-82a2-cb356495b302</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
Just delete WaitForSingleObject().&lt;br /&gt;
Maybe, it makes the trouble.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading from a Vendor Defined HID device</title><link>https://community.arm.com/thread/131302?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2013 23:33:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5d4911a7-9bab-4ed8-b9ff-218388aace26</guid><dc:creator>Danny Wong</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks for the detailed explanation on the report descriptor!&lt;/p&gt;

&lt;p&gt;
As you said the &amp;quot;ReadFile&amp;quot; will wait until the it get the input
report. Yes, it is true. Those 500ms delay time is mostly on running
&amp;quot;ReadFile&amp;quot; function. Does Bulk and Interrupt Transfer help this
situation because I findthat USBlyze could read those data without
500ms delay. Or is there any tricky thing to deal with &amp;quot;ReadFile&amp;quot;
function? Or It is the limitation set up by Windows?&lt;/p&gt;

&lt;p&gt;
Thanks!&lt;/p&gt;

&lt;p&gt;
Danny&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading from a Vendor Defined HID device</title><link>https://community.arm.com/thread/128279?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2013 21:47:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4a87df95-fcdb-437b-8271-68b64695a81f</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;b&gt;1) Report format&lt;/b&gt;&lt;br /&gt;
Your report descriptor is&lt;/p&gt;

&lt;pre&gt;
Usage Page    : 06 00 FF
Usage         : 09 01
Collection    : A1 01

Report ID     : 85 01

Usage         : 09 00
Logical Min   : 15 00
Logical Max   : 26 FF 00
Report Size   : 75 08
Report Count  : 95 0D
Input         : 81 02

Usage         : 09 00
Logical Min   : 15 00
Logical Max   : 26 FF 00
Report Size   : 75 08
Report Count  : 95 06
Output        : 91 02

End Collection: C0
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
This report descriptor defines single input and single output
report.&lt;br /&gt;
The format of each packet is,&lt;/p&gt;

&lt;pre&gt;
Input report
 byte offset
    0     report ID (1)
  1 - 13  report body (13 bytes)

Output report
 byte offset
    0     report ID (1)
  1 - 6   report body (6 bytes)
&lt;/pre&gt;

&lt;p&gt;
Your firmware has to send &lt;b&gt;14 bytes&lt;/b&gt; input report packet,
starting with report ID(1).&lt;br /&gt;
If the packet size wouldn&amp;#39;t be 14 bytes, or if the packet wouldn&amp;#39;t
start with 1,&lt;br /&gt;
PC HID driver drops such a packet.&lt;/p&gt;

&lt;p&gt;
If you wouldn&amp;#39;t have any plan to extend the report descriptor to
exchange another size of input or output report, you may delete the
Report ID definition from your report descriptor. And then, the
report ID field is deleted from the input and report packets.&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;2) PC code&lt;/b&gt;&lt;br /&gt;
hHandle = CreateFile(hDevice-&amp;gt;DevicePath, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);&lt;/p&gt;

&lt;p&gt;
CreateFile opens the device synchronously (non-OVERLAPPED).&lt;br /&gt;
It means, ReadFile doesn&amp;#39;t return until it gets an input report.&lt;/p&gt;

&lt;p&gt;
I&amp;#39;m not sure, what is WaitForSingleObject() waiting.&lt;br /&gt;
If it would wait for ReadFile completion, it should be useless,
because ReadFile returns just when it completes.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading from a Vendor Defined HID device</title><link>https://community.arm.com/thread/117374?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2013 19:13:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:e8a97c31-94b2-4fef-b2fe-810edc1341b1</guid><dc:creator>Danny Wong</dc:creator><description>&lt;p&gt;&lt;p&gt;
Here is the report descriptor&lt;/p&gt;

&lt;p&gt;
Usage Page: 06 00 FF&lt;br /&gt;
Usage: 09 01&lt;br /&gt;
Collection: A1 01 Report ID: 85 01 Usage: 09 00 Logical Min: 15 00
Logical Max: 26 FF 00 Report Size: 75 08 Report Count: 95 0D Input:
81 02 Usage: 09 00 Logical Min: 15 00 Logical Max: 26 FF 00 Report
Size: 75 08 Report Count: 95 06 Output: 91 02&lt;br /&gt;
End Collection C0&lt;/p&gt;

&lt;p&gt;
The following codes are run in a thread&lt;br /&gt;
Source code:&lt;br /&gt;
hHandle = CreateFile(hDevice-&amp;gt;DevicePath, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);&lt;/p&gt;

&lt;p&gt;
while(1)&lt;br /&gt;
{ Result = ReadFile( hHandle, buffer, // unsigned char *buffer = new
unsigned char[256] capLength, // read from &amp;quot;HidP_GetCaps&amp;quot; and it is
14 (0x0E) &amp;amp;NumberOfBytesRead, // always return 0 but the data
received is correct NULL );&lt;/p&gt;

&lt;p&gt;
if (Result) print out the received frame number
WaitForSingleObject(hEventObject,50); ResetEvent(hEventObject);&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;
Output:&lt;br /&gt;
1 2&lt;br /&gt;
(delay 500ms)&lt;br /&gt;
3 4&lt;br /&gt;
(delay 500ms)&lt;br /&gt;
...&lt;br /&gt;
10&lt;br /&gt;
11&lt;br /&gt;
(delay 500ms)&lt;br /&gt;
...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading from a Vendor Defined HID device</title><link>https://community.arm.com/thread/107247?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2013 03:47:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d47c2b7b-ccc2-4fcd-a282-5546a4b903d6</guid><dc:creator>Chinzei Tsuneo</dc:creator><description>&lt;p&gt;&lt;p&gt;
The sniffer catches low-level USB traffic, before the PC HID
driver examines the packets.&lt;/p&gt;

&lt;p&gt;
a) PC HID driver drops the packets, because the packet format
doesn&amp;#39;t match to those on the report descriptor.&lt;/p&gt;

&lt;p&gt;
OR&lt;/p&gt;

&lt;p&gt;
b) Your PC application doesn&amp;#39;t read the packets quick enough.&lt;/p&gt;

&lt;p&gt;
1) Post the report descriptor&lt;br /&gt;
2) Post the PC application code, around CreateFile() and
ReadFile()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&amp;gt; how do i know if the hardware support &amp;quot;HidD_GetInputreport&amp;quot;
function?&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
HidD_GetInputreport() reads packet over the default endpoint, by
Get_Report request.&lt;br /&gt;
It can&amp;#39;t read from the interrupt IN endpoint.&lt;/p&gt;

&lt;p&gt;
Tsuneo&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reading from a Vendor Defined HID device</title><link>https://community.arm.com/thread/81398?ContentTypeID=1</link><pubDate>Sun, 25 Aug 2013 20:40:04 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4fa71cda-50b7-44a4-9124-bbd0d36990c0</guid><dc:creator>Danny Wong</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks for the reply&lt;/p&gt;

&lt;p&gt;
The HID device is sending out packet every 5 ms. It is proved by
USBlyze. Although PC receive with low data rate, NO missing packet is
found. I can read those packet with continuous frame number.
Therefore i think that the hardware would be ok.&lt;/p&gt;

&lt;p&gt;
Then I looked into PC side, i found that it took 500 ms to run
&amp;quot;ReadFile&amp;quot; function. I have no idea why it happens. Could you give me
some hints? Also, how do i know if the hardware support
&amp;quot;HidD_GetInputreport&amp;quot; function?&lt;/p&gt;

&lt;p&gt;
Thanks&lt;/p&gt;

&lt;p&gt;
Danny&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>