hid-keys key repetition....

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers

hid-keys key repetition....

Postby massimo » Tue Apr 10, 2007 8:37 pm

Hello I'm building a keyboard emulator using avr-hid and the hid keys demo...

i can't find any way to stop the computer from repeating a key...
i just want to be able to fire only one character until I release and press again. they computer seems to be repeating the code all the time...

this is my main event loop stripped to the core...

wdt_reset();
usbPoll();
key = PINC & 0x01;

if (( key == 1) && (lastKey == 0) ) {
while (!usbInterruptIsReady()) ;
buildReport(1);
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));

}
lastKey = key;


as anybody got any idea?

massimo
massimo
 

Postby christian » Wed Apr 11, 2007 2:12 pm

The HID spec suggests that key repitition can be implemented by sending the keyboard status in an interrupt transfer in regular intervals.

Most operating system interpret the key status as status, measure the time how long a particular key is pressed and start repeating (with their own internal timer) after that time.

On the other hand, if an operating system wants to out-source the task of key repitition to the device, it configures an idle rate. HIDKeys does not implement properly, although it accepts the idle rate setting.

Search main.c for "USBRQ_HID_SET_IDLE" and "idleCounter" for details. The USB HID specification contains more information about the proper handling of USBRQ_HID_SET_IDLE.
christian
Objective Development
Objective Development
 
Posts: 1243
Joined: Thu Nov 09, 2006 10:46 am


Return to V-USB

Who is online

Users browsing this forum: No registered users and 1 guest