<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/10466" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2016-06-10T14:21:56+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/10466</id>

		<entry>
		<author><name><![CDATA[arvydas]]></name></author>
		<updated>2016-06-10T14:21:56+02:00</updated>

		<published>2016-06-10T14:21:56+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=10466&amp;p=31247#p31247</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=10466&amp;p=31247#p31247"/>
		<title type="html"><![CDATA[Waking up tablet with key press]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=10466&amp;p=31247#p31247"><![CDATA[
Hi,<br /><br />I have a Windows tablet that needs to wake up after a certain amount of time with a custom VUSB based device. I turn off the screen with my software and send a message to the device to send a SPACE key after a certain amount of time. I got it working, however there is one problem. Sometimes the tablet does not wake up as it needs to send the key twice. I've noticed this with a normal keyboard connected to the tablet. When I press the ON/OFF button on the tablet, the screen turns off and most of the times it wakes up just by pressing a key on the keyboard once, but occasionally I have to press it twice.<br /><br />My device works as follows:<br /><br />1) Waits a certain amount of time<br />2) Sends key pressed<br />3) Waits a few milliseconds<br />4) Sends a key released<br /><br />The code looks something like this:<br /><br /><div class="codebox"><p>Code: </p><pre><code>if (usbInterruptIsReady())<br />{<br />        // Step 2<br />   if (sendKeyState == 2)<br />   {<br />      usbSetInterrupt((uchar *)&amp;keyboard_report, sizeof(keyboard_report));<br />      sendKeyState = 1;<br />   }<br />        // Step 4<br />   else if (sendKeyState == 1)<br />   {<br />      keyboard_report.key&#91;0&#93; = 0;<br />      usbSetInterrupt((uchar *)&amp;keyboard_report, sizeof(keyboard_report));<br />      sendKeyState = 0;<br />   }<br />}<br /></code></pre></div><br /><br />When the condition that requires two key presses occurs, my device only gets to the 4) after I press the ON/OFF button on the tablet to wake it up manually. I'm fairly certain that it gets blocked at usbInterruptIsReady() function call as it never becomes ready.<br /><br />Is VUSB waiting to get acknowledgement from the OS that data has been received? Is there any way to avoid this?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=20789">arvydas</a> — Fri Jun 10, 2016 2:21 pm</p><hr />
]]></content>
	</entry>
	</feed>
