[Tfug] The 'state' of a key??

Chris Hill ubergeek at ubergeek.tv
Fri Nov 18 01:16:52 MST 2005


Ok, so I've got 5 buttons on my laptop that are assignable in windows, 
but in linux they just map to the numbers 1-5. If I press any of the 
buttons (in a console or in x) I just get the numbers 1-5. In an attempt 
to discern what's going on, the only useful info I got was from xev:


Pressing the button:
KeyPress event, serial 29, synthetic NO, window 0x3400001,
    root 0xe9, subw 0x0, time 9940924, (169,-18), root:(174,30),
    state 0x40, keycode 14 (keysym 0x35, 5), same_screen YES,
    XLookupString gives 1 bytes: (35) "5"
    XmbLookupString gives 1 bytes: (35) "5"
    XFilterEvent returns: False

Pressing the '5' key:
KeyPress event, serial 29, synthetic NO, window 0x3400001,
    root 0xe9, subw 0x0, time 9953163, (169,-18), root:(174,30),
    state 0x0, keycode 14 (keysym 0x35, 5), same_screen YES,
    XLookupString gives 1 bytes: (35) "5"
    XmbLookupString gives 1 bytes: (35) "5"
    XFilterEvent returns: False


So the only discernible difference is the 'state' variable.

Using showkey (in console, not pseudo-terminal) I was able to get this:
(the first line is the press byte, and the 2nd is the release byte)
Keyboard:
1:
0x02
0x82
2:
0x03
0x83
3:
0x04
0x84
4:
0x05
0x85
5:
0x06
0x86

Assignable buttons(again, first line is press, second is release):
1:
0x7e 0x02
0x82 0xfe
2:
0x7e 0x03
0x83 0xfe
3:
0x7e 0x04
0x84 0xfe
4:
0x7e 0x05
0x85 0xfe
5:
0x7e 0x06 0x86 0xfe

Button 5 only sends a release, hence its code being all on one line.

Any ideas on how to get this to work?
Thanks
C




More information about the tfug mailing list