by texmex » Fri Apr 18, 2008 2:00 pm
christian wrote: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.
Have you checked your firmware whether it generates the keystrokes correctly?
Unfortunately i don't know how it should be correct.
After
- Code: Select all
hardwareInit();
usbInit();
sei();
And before the main event loop i've done this now as a workaround:
- Code: Select all
{...}
buildReport( 0 );
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
{...}
reportBuffer[0]= MOD_SHIFT_LEFT;
reportBuffer[1]= 0;
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
{...}
buildReport( 0 );
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
{...}
I've discovered also that i have to issue a
- Code: Select all
buildReport( 0 );
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
between each (simulated) keystroke. Otherwise some keystrokes are swallowed every now and then too.
I don't know whether this is the expected behaviour.
Maybe everything is a timing problem? Since it happens only occasionally?
Thank you for your patience with my half knowledge

.
Kind regards,
Klaus
[quote="christian"]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.
Have you checked your firmware whether it generates the keystrokes correctly?[/quote]
Unfortunately i don't know how it should be correct.
After
[code]
hardwareInit();
usbInit();
sei();
[/code]
And before the main event loop i've done this now as a workaround:
[code]
{...}
buildReport( 0 );
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
{...}
reportBuffer[0]= MOD_SHIFT_LEFT;
reportBuffer[1]= 0;
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
{...}
buildReport( 0 );
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
{...}
[/code]
I've discovered also that i have to issue a
[code]
buildReport( 0 );
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
[/code]
between each (simulated) keystroke. Otherwise some keystrokes are swallowed every now and then too.
I don't know whether this is the expected behaviour.
Maybe everything is a timing problem? Since it happens only occasionally?
Thank you for your patience with my half knowledge :-).
Kind regards,
Klaus