<?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/1292" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2008-05-01T00:58:42+02:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-05-01T00:58:42+02:00</updated>

		<published>2008-05-01T00:58:42+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5209#p5209</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5209#p5209"/>
		<title type="html"><![CDATA[First key is not sent (hid keyboard)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5209#p5209"><![CDATA[
<blockquote><div><cite>christian wrote:</cite>Although the main loop looks a bit weird, it should work.<br /><br />Maybe the host side driver does not accept keystrokes shortly after the device was connected (just a wild guess). Did you try to add a delay before sending the first keystroke, e.g. iterate the main loop for one second before you send the first interrupt report?</div></blockquote><br /><br />Yes, i've tried this but it doesn't work. I have to send a dummy keystroke (shift for example) at first.<br /><br />It's no problem but a bit strange <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":-)" title="Smile" />.<br /><br /><br />Kind regards,<br />Klaus<p>Statistics: Posted by Guest — Thu May 01, 2008 12:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-04-18T20:53:38+02:00</updated>

		<published>2008-04-18T20:53:38+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5102#p5102</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5102#p5102"/>
		<title type="html"><![CDATA[First key is not sent (hid keyboard)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5102#p5102"><![CDATA[
Although the main loop looks a bit weird, it should work.<br /><br />Maybe the host side driver does not accept keystrokes shortly after the device was connected (just a wild guess). Did you try to add a delay before sending the first keystroke, e.g. iterate the main loop for one second before you send the first interrupt report?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Fri Apr 18, 2008 8:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-04-18T17:05:59+02:00</updated>

		<published>2008-04-18T17:05:59+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5100#p5100</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5100#p5100"/>
		<title type="html"><![CDATA[First key is not sent (hid keyboard)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5100#p5100"><![CDATA[
<blockquote><div><cite>christian wrote:</cite>Do you check whether the interrupt buffer is free with usbInterruptIsReady() before you use usbSetInterrupt()? If not, this is probably the cause of the problem. See EasyLogger for details.</div></blockquote><br /><br />Yes of course. This is my complete testing main loop:<br /><br /><div class="codebox"><p>Code: </p><pre><code>   for&#40;;;&#41;<br />     &#123;  /* main event loop */<br />        wdt_reset&#40;&#41;;<br />        usbPoll&#40;&#41;;<br />        if&#40;pgm_read_byte&#40;&amp;teststring&#91;stringpointer&#93;&#41; != 0 &amp;&amp; usbInterruptIsReady&#40;&#41;&#41;<br />          &#123;<br />             buildReport&#40; pgm_read_byte&#40;&amp;teststring&#91;stringpointer++&#93;&#41; &#41;;<br />             usbSetInterrupt&#40;reportBuffer, sizeof&#40;reportBuffer&#41;&#41;;<br />             while &#40; ! usbInterruptIsReady&#40;&#41; &#41;<br />               &#123;<br />                  wdt_reset&#40;&#41;;<br />                  usbPoll&#40;&#41;;<br />               &#125;<br />             buildReport&#40; 0 &#41;;<br />             usbSetInterrupt&#40;reportBuffer, sizeof&#40;reportBuffer&#41;&#41;;<br />          &#125;<br />     &#125;<br /></code></pre></div><p>Statistics: Posted by Guest — Fri Apr 18, 2008 5:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-04-18T15:24:53+02:00</updated>

		<published>2008-04-18T15:24:53+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5096#p5096</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5096#p5096"/>
		<title type="html"><![CDATA[First key is not sent (hid keyboard)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5096#p5096"><![CDATA[
Do you check whether the interrupt buffer is free with usbInterruptIsReady() before you use usbSetInterrupt()? If not, this is probably the cause of the problem. See EasyLogger for details.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Fri Apr 18, 2008 3:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-04-18T15:00:44+02:00</updated>

		<published>2008-04-18T15:00:44+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5095#p5095</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5095#p5095"/>
		<title type="html"><![CDATA[First key is not sent (hid keyboard)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5095#p5095"><![CDATA[
<blockquote><div><cite>christian wrote:</cite>Interesting. I have tried both with EasyLogger. If I set USB_INITIAL_DATATOKEN to USBPID_DATA1, then it works as expected. If I set it to USBPID_DATA0, the first keystroke is missing.<br /><br />Have you checked your firmware whether it generates the keystrokes correctly?</div></blockquote><br /><br />Unfortunately i don't know how it should be correct.<br /><br />After<br /><div class="codebox"><p>Code: </p><pre><code>   hardwareInit&#40;&#41;;<br />   usbInit&#40;&#41;;<br />   sei&#40;&#41;;<br /></code></pre></div><br /><br />And before the main event loop i've done this now as a workaround:<br /><br /><div class="codebox"><p>Code: </p><pre><code>&#123;...&#125;<br />   buildReport&#40; 0 &#41;;<br />   usbSetInterrupt&#40;reportBuffer, sizeof&#40;reportBuffer&#41;&#41;;<br />&#123;...&#125;<br />   reportBuffer&#91;0&#93;= MOD_SHIFT_LEFT;<br />   reportBuffer&#91;1&#93;= 0;<br />   usbSetInterrupt&#40;reportBuffer, sizeof&#40;reportBuffer&#41;&#41;;<br />&#123;...&#125;<br />   buildReport&#40; 0 &#41;;<br />   usbSetInterrupt&#40;reportBuffer, sizeof&#40;reportBuffer&#41;&#41;;<br />&#123;...&#125;<br /></code></pre></div><br /><br />I've discovered also that i have to issue a<br /><div class="codebox"><p>Code: </p><pre><code>  buildReport&#40; 0 &#41;;<br />   usbSetInterrupt&#40;reportBuffer, sizeof&#40;reportBuffer&#41;&#41;;<br /></code></pre></div><br />between each (simulated) keystroke. Otherwise some keystrokes are swallowed every now and then too.<br />I don't know whether this is the expected behaviour.<br /><br />Maybe everything is a timing problem? Since it happens only occasionally?<br /><br />Thank you for your patience with my half knowledge <img class="smilies" src="./../../../images/smilies/icon_smile.gif" alt=":-)" title="Smile" />.<br /><br /><br />Kind regards,<br />Klaus<p>Statistics: Posted by Guest — Fri Apr 18, 2008 3:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-04-18T13:35:55+02:00</updated>

		<published>2008-04-18T13:35:55+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5092#p5092</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5092#p5092"/>
		<title type="html"><![CDATA[First key is not sent (hid keyboard)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5092#p5092"><![CDATA[
Interesting. I have tried both with EasyLogger. If I set USB_INITIAL_DATATOKEN to USBPID_DATA1, then it works as expected. If I set it to USBPID_DATA0, the first keystroke is missing.<br /><br />Have you checked your firmware whether it generates the keystrokes correctly?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Fri Apr 18, 2008 1:35 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2008-04-17T11:36:54+02:00</updated>

		<published>2008-04-17T11:36:54+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5077#p5077</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5077#p5077"/>
		<title type="html"><![CDATA[First key is not sent (hid keyboard)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=5077#p5077"><![CDATA[
<blockquote><div><cite>christian wrote:</cite>Try defining USB_INITIAL_DATATOKEN to USBPID_DATA1 in usbconfig.h. I have to verify this yet, but some people say that this is the correct start condition.<br /><br />And no, there's no other way to send a key twice, as far as I know. I do the same in EasyLogger.</div></blockquote><br /><br />Hello!!<br /><br />I'm trying the AVRUSB code with a similar HID application and i'm experiencing the same problem.<br /><br />The first Keypress is not swallowed every time. But if i set USB_INITIAL_DATATOKEN to USBPID_DATA1 it fails every time plus sometimes the second key event too.<br /><br />So the problem seems not to be caused by USB_INITIAL_DATATOKEN.<br /><br /><br />Kind regards,<br />Klaus<p>Statistics: Posted by Guest — Thu Apr 17, 2008 11:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[christian]]></name></author>
		<updated>2008-03-17T10:38:17+02:00</updated>

		<published>2008-03-17T10:38:17+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1292&amp;p=4624#p4624</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=4624#p4624"/>
		<title type="html"><![CDATA[First key is not sent (hid keyboard)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=4624#p4624"><![CDATA[
For a keyboard, you can ignore USBRQ_HID_GET_REPORT.<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=8">christian</a> — Mon Mar 17, 2008 10:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Grendel]]></name></author>
		<updated>2008-03-17T03:13:54+02:00</updated>

		<published>2008-03-17T03:13:54+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1292&amp;p=4619#p4619</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=4619#p4619"/>
		<title type="html"><![CDATA[First key is not sent (hid keyboard)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=4619#p4619"><![CDATA[
Uhm, you may want to update your AVR_USB to a version &gt;= 20070807..<br /><br /><blockquote class="uncited"><div>* Release 2007-08-07<br /><br />  - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN, USB_COUNT_SOF</div></blockquote><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=101">Grendel</a> — Mon Mar 17, 2008 3:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ThiefMaster]]></name></author>
		<updated>2008-03-17T00:17:31+02:00</updated>

		<published>2008-03-17T00:17:31+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=1292&amp;p=4614#p4614</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=4614#p4614"/>
		<title type="html"><![CDATA[First key is not sent (hid keyboard)]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=1292&amp;p=4614#p4614"><![CDATA[
Hmm, USB_INITIAL_DATATOKEN is not used anywhere in the driver. <img class="smilies" src="./../../../images/smilies/icon_surprised.gif" alt=":o" title="Surprised" /><br /><br />Btw, when sending data from my program, is it better to send it only when receiving USBRQ_HID_GET_REPORT or via usbSetInterrupt?<p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=918">ThiefMaster</a> — Mon Mar 17, 2008 12:17 am</p><hr />
]]></content>
	</entry>
	</feed>
