After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 590755 - Keycodes mismatch using generatekeyevent from python-ldtp
Keycodes mismatch using generatekeyevent from python-ldtp
Status: RESOLVED FIXED
Product: LDTP
Classification: Other
Component: ldtp
1.6.0
Other All
: Normal normal
: ---
Assigned To: Nagappan Alagappan
LDTP Development Mailing List
Depends on:
Blocks:
 
 
Reported: 2009-08-04 17:12 UTC by José Luis Segura Lucas
Modified: 2009-08-14 04:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to the LDTP server (461 bytes, patch)
2009-08-04 17:34 UTC, José Luis Segura Lucas
committed Details | Review
Patch to device.c file, who includes a method to retrieve the keycodes info from xmodmap (3.84 KB, patch)
2009-08-04 17:35 UTC, José Luis Segura Lucas
committed Details | Review
Fixes the crash when xmodmap doesn't exist in path (1.94 KB, patch)
2009-08-13 23:00 UTC, Nagappan Alagappan
committed Details | Review

Description José Luis Segura Lucas 2009-08-04 17:12:31 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:
Comment 1 José Luis Segura Lucas 2009-08-04 17:34:29 UTC
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
Comment 2 José Luis Segura Lucas 2009-08-04 17:35:29 UTC
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
Comment 3 José Luis Segura Lucas 2009-08-04 17:43:45 UTC
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.
Comment 4 Nagappan Alagappan 2009-08-04 21:53:47 UTC
Lavi, Attached patch is okay in your embedded environment ?

Tim, also in Solaris Platform ?

Thanks
Comment 5 José Luis Segura Lucas 2009-08-05 07:23:10 UTC
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.
Comment 6 lavi 2009-08-13 05:56:35 UTC
Nags, xmodmap is avaiable too, and, i tried fews of key, they're working fine.

Thank you too, Lucas.
Comment 7 Nagappan Alagappan 2009-08-13 07:34:32 UTC
Thanks for the bug report and the patch. This will be part of LDTP 1.7.0 release.
Comment 8 Nagappan Alagappan 2009-08-13 07:35:23 UTC
I forgot to mention, when the xmodmap is not in path, LDTP dumps core. Need to fix it.
Comment 9 Tim Miao 2009-08-13 08:13:44 UTC
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.
Comment 10 Nagappan Alagappan 2009-08-13 15:33:53 UTC
Thanks Tim and Lavi :)
Comment 11 Nagappan Alagappan 2009-08-13 23:00:05 UTC
Created attachment 140718 [details] [review]
Fixes the crash when xmodmap doesn't exist in path
Comment 12 Nagappan Alagappan 2009-08-14 04:32:41 UTC
Fixed in LDTP 1.7.1.