Hi all, I have resolved my problem, and I'm sure that is a bug in DirectFB, version from 0.9.24 to 1.3.0). Those below is my fixed patch for keyboard.c, I don't know how to submit it, BTW :(
diff -burN /usr/src/DirectFB-1.3.0-orig/inputdrivers/keyboard/keyboard.c /usr/src/DirectFB-1.3.0/inputdrivers/keyboard/keyboard.c --- /usr/src/DirectFB-1.3.0-orig/inputdrivers/keyboard/keyboard.c 2008-09-27 07:32:25.000000000 +0800 +++ /usr/src/DirectFB-1.3.0/inputdrivers/keyboard/keyboard.c 2009-01-01 16:22:56.500000000 +0800 @@ -283,10 +283,18 @@ return entry.kb_value; } +// modified by wdl, fix repeat keypress bug! static void -keyboard_set_lights( KeyboardData *data, DFBInputDeviceLockState locks ) +keyboard_set_lights( KeyboardData *data, DFBInputEvent *evt ) { - ioctl( data->vt_fd, KDSKBLED, locks ); + switch (evt->key_symbol) { + case DIKS_CAPS_LOCK: + case DIKS_NUM_LOCK: + case DIKS_SCROLL_LOCK: + ioctl( data->vt_fd, KDSKBLED, evt->locks ); + default: + return; + } } static void* @@ -312,7 +320,7 @@ dfb_input_dispatch( data->device, &evt ); - keyboard_set_lights( data, evt.locks ); + keyboard_set_lights( data, &evt ); //wdl, &evt <--> evt.locks } if (readlen <= 0) -------------------------------------------------- From: <directfb-users-requ...@directfb.org> Sent: Tuesday, December 30, 2008 7:00 PM To: <directfb-users@directfb.org> Subject: directfb-users Digest, Vol 46, Issue 26 > Send directfb-users mailing list submissions to > directfb-users@directfb.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users > or, via email, send a message with subject or body 'help' to > directfb-users-requ...@directfb.org > > You can reach the person managing the list at > directfb-users-ow...@directfb.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of directfb-users digest..." > > > Today's Topics: > > 1. Keyboard repeat keypress error! (Wang Dongli) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 30 Dec 2008 12:38:33 +0800 > From: "Wang Dongli" <wang_don...@hotmail.com> > Subject: [directfb-users] Keyboard repeat keypress error! > To: <directfb-users@directfb.org> > Message-ID: <bay135-ds11354f59f0d021bc9f42488...@phx.gbl> > Content-Type: text/plain; charset="gb2312" > > Hi,all > I've found a strange bug in DFB's inputdrivers(keyboard.c), it seemed that > the DFB driver dispatched more keypress event than real. > That is to say, when I press a key (let's say 'a') down and hold for 1 > second to realize the 'repeat' function, then in the linux kernel debug, I > got maybe 9 times 'a' key press interrupt occured, but in the DFB's keyboard > driver, I got more than 7 times 'a' key press event(the amount is 60~90 times > maybe). > > And, I've changed the function keyboardEventThread()(in keyboard.c) as > below, > > static void* > keyboardEventThread( DirectThread *thread, void *driver_data ) > { > ... ... > /* Read keyboard data */ > while ((readlen = read (data->vt->fd, buf, 64)) >= 0 || errno == EINTR) { > int i; > > printf("readlen=%d, evt.key_code=0x%x\n", readlen, buf[0]); //wdl > direct_thread_testcancel( thread ); > for (i = 0; i < readlen; i++) { > DFBInputEvent evt; > > evt.type = ((buf[i] & 0x80) ? > DIET_KEYRELEASE : DIET_KEYPRESS); > evt.flags = DIEF_KEYCODE; > evt.key_code = buf[i] & 0x7f; > > //dfb_input_dispatch( data->device, &evt ); // rem here, so > print is ok! > > keyboard_set_lights( data, evt.locks ); > } > > if (readlen <= 0) > usleep( 200000 ); //wdl, 2000 > } > ...... > } > > Then, I got the right times keypress event print info, so I think maybe > the function dfb_input_dispatch() is the bug area, but I can't find how it > bugged! > Anybody suggestion? Thanks in advance! > > > Sean Wang > > wang_don...@hotmail.com > > > > ------------------------------ > > _______________________________________________ > directfb-users mailing list > directfb-users@directfb.org > http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users > > > End of directfb-users Digest, Vol 46, Issue 26 > ********************************************** > _______________________________________________ directfb-users mailing list directfb-users@directfb.org http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users