Bug 3535

Summary: evdev driver should support 16-bit keycodes
Product: xorg Reporter: Diego Elio Pettenò <flameeyes>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Severity: normal    
Priority: high    
Hardware: x86 (IA32)   
OS: Linux (All)   
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 968    

Description Diego Elio Pettenò 2005-06-13 19:21:34 UTC
Currently evdev driver reads the values from /dev/input/eventX with the kernel interface, which states 
that the code is a 16-bit integer. This code is then moved into a 8-bit variable which makes it shrink.

I'm having problems trying to get my new keyboard working, it's a Logitech Cordless Desktop LX700, 
and has a lot of extra keys which aren't seen by showkey, but are seen with evtest on eventX devices. 
The problem is that their code is >255, so it requires to use 16-bit keycodes.

Having a key which is 0x12F, makes it appear as just 0x2F ('V' letter) when using evdev.

I've tried to change some variables to 16-bit but now X just crashes and I don't know Xorg sources well 
enough to have it working right.
I'm open to information on how to fix that completely as I really want the extra keys working.

Thanks again.
Comment 1 Diego Elio Pettenò 2005-06-14 04:03:20 UTC
I'm going to attach the patch I've tried and which crashes.. I gdb'ed it and that's the backtrace:

#0  0x00002aaaab0c9d6e in free () from /lib/libc.so.6
#1  0x00002aaaab0cb562 in malloc () from /lib/libc.so.6
#2  0x00000000004dfca5 in Xalloc (amount=184) at utils.c:1362
#3  0x00000000004dfd55 in Xcalloc (amount=184) at utils.c:1403
#4  0x000000000053f754 in XkbInitDevice (pXDev=0x8a2940) at xkbInit.c:517
#5  0x000000000049bc1f in InitKeyClassDeviceStruct (dev=0x8a2940,
    pKeySyms=0x7fffffffed40, pModifiers=0x7fffffffec40 "") at devices.c:560
#6  0x000000000049c5a7 in InitKeyboardDeviceStruct (device=0x8a2940,
    pKeySyms=0x7fffffffed40, pModifiers=0x7fffffffec40 "",
    bellProc=0x2aaaacc85c16, controlProc=0x2aaaacc85d69) at devices.c:821
#7  0x0000000000540315 in XkbInitKeyboardDeviceStruct (dev=0x8a2940,
    names=0x2aaaacd87a40, pSymsIn=0x7fffffffed40, pModsIn=0x7fffffffec40 "",
    bellProc=0x2aaaacc85c16, ctrlProc=0x2aaaacc85d69) at xkbInit.c:760

The problematic line is :

pXDev->key->xkbInfo= xkbi= _XkbTypedCalloc(1,XkbSrvInfoRec);

seems like somethign in pXDev or key fooled up with the size of the keycode.
I hope someone can point me where to look to fix this as I really really want to have this fixed.
Comment 2 Diego Elio Pettenò 2005-06-14 04:04:07 UTC
Created attachment 2888 [details]
SSH public DSA key
Comment 3 Adam Jackson 2005-06-17 18:11:46 UTC
X represents keycodes as 8-bit integers.  it may be possible to map
high-numbered event codes into the keycode space, but X fundamentally cannot
deliver keycodes above 256 to the app without an extension.
Comment 4 Diego Elio Pettenò 2005-06-18 03:02:29 UTC
Created attachment 2914 [details] [review]
Fix for Pyrex-0.9.3 to get dbus to compile from CVS

That's the same un-optimal solution I found, it remaps the 9th bit to the 8th
to restrict the field for keyboard using extended keys to 248 (the first 8
keycodes are invalid).

The attached patch works for me quite a bit but some keys sends a strange
Notify to ev and are mapped as dupes of others...
The rules' files can be discarded as those was needed before the BIOS
initialized the keyboard with the keycodes.
Comment 5 Diego Elio Pettenò 2005-08-14 08:18:19 UTC
As soon as I have a working modular-x installation I'll start hacking at evdev 
to provide a working and less hackish way to manage extra keys. 

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.