GNOME Bugzilla – Bug 590755
Keycodes mismatch using generatekeyevent from python-ldtp
Last modified: 2009-08-14 04:32:41 UTC
Please describe the problem: When you use some of the non-printable characters (like the 4 arrows, home, end, previous and next page...) LDTP generate different keycode depending on your keyboard and configuration. For example, in my Spanish 105 keys keyboard it doesn't work properly. Steps to reproduce: 1. Using a Spanish keyboard 2. Configure it with USA layout 3. Try to do: generatekeyevent(<down>) Actual results: The key pressed is the enter of the numeric keypad instead down arrow Expected results: The key pressed is the down arrow Does this happen every time? Yes Other information:
Created attachment 139885 [details] [review] Patch to the LDTP server To patch it download on the LDTP source directory and patch with $ patch -p2 < ldtp.c.diff
Created attachment 139886 [details] [review] Patch to device.c file, who includes a method to retrieve the keycodes info from xmodmap To patch, in the source directory: $ patch -p2 < device.c.diff
This two patches solve my problem doing the following: First, when ldtp server starts, it executes "xmodmap -pke" and load the keysym-keycode pairs from its output. When you use generatekeyevent (or any other keyboard method), ldtp recognizes all the symbols listed by xmodmap and you can use names like "Control_L", "Up", "Down"... I preserve the old keysym values (like ctrl, up, down...) for retro-compatibility.
Lavi, Attached patch is okay in your embedded environment ? Tim, also in Solaris Platform ? Thanks
I have to say that my patch uses "xmodmap" command, that I don't know if it is available in all the platforms. Perhaps this patches will only work on PC with GNU/Linux, I don't know where "xmodmap" is available too.
Nags, xmodmap is avaiable too, and, i tried fews of key, they're working fine. Thank you too, Lucas.
Thanks for the bug report and the patch. This will be part of LDTP 1.7.0 release.
I forgot to mention, when the xmodmap is not in path, LDTP dumps core. Need to fix it.
I tested the patch on latest OpenSolaris box, the patch did not introduce regressions. The OpenSolaris also releases xmodmap by default, so I think it should work also.
Thanks Tim and Lavi :)
Created attachment 140718 [details] [review] Fixes the crash when xmodmap doesn't exist in path
Fixed in LDTP 1.7.1.