<?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>how to inform USB host that data waiting to transmit</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/23702/how-to-inform-usb-host-that-data-waiting-to-transmit</link><description> 
Hello! 

 
How do I inform the USB host, that the device has data waiting to
transmit? I like to do an IN transaction. I am using the control
transfer for data exchange. Or do I have to use Endpoints for a data
IN transaction? 

 
Thanks for your help</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: how to inform USB host that data waiting to transmit</title><link>https://community.arm.com/thread/55535?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2009 02:22:35 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:f1fbb9ea-472a-42f7-b58c-6daff30a394c</guid><dc:creator>Tsuneo Chinzei</dc:creator><description>&lt;p&gt;&lt;p&gt;
As USB is host centric, there is no active way for device to
inform to the host, unless the host polls the device regularly. - Up
to USB 2.0. This will change on coming USB 3.0.&lt;/p&gt;

&lt;p&gt;
What is the USB class you are working on?&lt;/p&gt;

&lt;p&gt;
PC HID device driver polls the interrupt IN endpoint
regularly.&lt;br /&gt;
Also CDC driver polls the bulk IN and interrupt IN endpoints.&lt;br /&gt;
For these classes, the data on the device is carried to host, just by
putting data to the endpoint, at the next access from the host.&lt;/p&gt;

&lt;p&gt;
For generic device driver, you have to do it in your host app.&lt;br /&gt;
Make an asynchronous (OVERLAPPED) read call to the IN pipe.&lt;br /&gt;
Then, the host controller repeats IN transactions for ever, until the
device put data, or until the call fails by noise.&lt;br /&gt;
When the asynchronous read call completes, the data is received by
the host app.&lt;/p&gt;

&lt;p&gt;
You may need to do this process in an another thread than main, if
you use one of Wait-API, like WaitForSingleObject().&lt;/p&gt;

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

&lt;p&gt;
If you do it in main thread, ReadFileEx() will work. In the
completion routine, post a user-defined message, and catch it in the
message handler of the main thread.&lt;/p&gt;

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