PDA

View Full Version : Map an undetected key/button



KKJensen
8th June 2007, 02:59 AM
Hi there,

I've got an Acer Aspire 3610 laptop with several extra "function" buttons across the top (email, web, and two for acer programs for windows) along with two extra keys on the keyboard with the dollar and euro symbols. I'd like to map these keys to do something.

If I use the standard keyboard shortcut menu under System it doesn't detect these buttons like the others. However, SOMETHING is being detected as when I hit one of these I get messages showing up in /var/log/messages like :


Jun 7 21:56:22 biggirl kernel: atkbd.c: Unknown key pressed (translated set 2, code 0xf3 on isa0060/serio0).
Jun 7 21:56:22 biggirl kernel: atkbd.c: Use 'setkeycodes e073 <keycode>' to make it known.
Jun 7 21:56:22 biggirl kernel: atkbd.c: Unknown key released (translated set 2, code 0xf3 on isa0060/serio0).
Jun 7 21:56:22 biggirl kernel: atkbd.c: Use 'setkeycodes e073 <keycode>' to make it known.
Jun 7 21:56:23 biggirl kernel: atkbd.c: Unknown key pressed (translated set 2, code 0xf4 on isa0060/serio0).
Jun 7 21:56:23 biggirl kernel: atkbd.c: Use 'setkeycodes e074 <keycode>' to make it known.
Jun 7 21:56:23 biggirl kernel: atkbd.c: Unknown key released (translated set 2, code 0xf4 on isa0060/serio0).
Jun 7 21:56:23 biggirl kernel: atkbd.c: Use 'setkeycodes e074 <keycode>' to make it known.


These codes 0xf3 and 0xf4...how do I make them act like normal keys??? I would like to be able to map them to either gnome shortcuts, beryl shortcuts or perhaps even just a script (i.e. for turning on/off wireless devices etc)

cathectic
22nd July 2007, 04:02 PM
These scancodes need to be mapped to proper keycodes - the next version of HAL is going to do this out-of-the-box. I've been adding support myself for various Acer laptops (since I know quite a few people who have them) to help out HAL and other users. If you want, I can add support for your laptop to HAL.

Can you post:

1) The output of:

dmidecode --string system-manufacturer
dmidecode --string system-product-name

2)
A list of all the keys which generate error messages in 'dmesg', and the
scancode they report (just try all the keys, and all valid Fn+Key
combinations, and report back those that generate an atkbd.c message in
dmesg).

e.g. On my laptop, pressing the wireless button (with wireless off) produces
this in dmesg:

atkbd.c: Use 'setkeycodes e056 <keycode>' to make it known.

The scancode I need from you is e056, so you would tell me something like:

wireless button (wireless off) = e056

For comparison, these are all the keys that generate messages in dmesg and the scancodes associated with them on my Aspire 5020 (the output from your laptop should be very similar, if not identical):

Fn+F1 = e025
Fn+F2 = e026
Fn+F3 = e027
Fn+F5 = e029
Fn+F7 (turn touchpad off) = e072
Fn+F7 (turn touchpad back on) = e071

Euro sign (the one left of "up" arrow) = e033
Dollar sign (the one right of "up" arrow) = e034

Acer "e" button = e074
Acer "P" button = e073

These next four scancodes might be a bit different on your laptop because the
on/ off thing may not quite work the same, or the hardware isn't there but
you have the button (e.g. bluetooth - if the button is there, press it
anyway):

Wireless button (wireless on) = e055
Wireless button (wireless off) = e056
Bluetooth button (bluetooth on) = e057
Bluetooth button (bluetooth off) = e058

Be aware that:

The wireless and bluetooth buttons will probably report different scancodes depending on whether you have enabled the device or not.

KKJensen
22nd July 2007, 09:10 PM
Thanks for the reply...it's a relief to hear that there's some action out there and I'm not the Acer guy!



1.


[root@biggirl ~]# dmidecode --string system-manufacturer
Acer
[root@biggirl ~]# dmidecode --string system-product-name
Aspire 3610


2.
Your summary of your 5020 includes the proper codes for all my keys that don't work.

I'm sure you know already but there's a package called "acer_acpi" that I installed which added some hardware support for acer computers. Perhaps your tweaks could somehow be combined with that to make a "acer laptop" bundle of some sort? In any case, thanks for the work you're doing.

If there's anything else I can provide, just let me know. Sorry I don't have enough experience yet to contribute more than the outputs you've asked for. Some day soon...

cathectic
23rd July 2007, 03:38 PM
I'm sure you know already but there's a package called "acer_acpi"I'm the maintainer :-) You e-mailed me your DSDT a week ago.


Perhaps your tweaks could somehow be combined with that to make a "acer laptop" bundle of some sort?This is not practical or really desireable - there's no easy way to add this kind of keyboard mapping to the driver, it isn't necessary, and violates kernel policy (I do try and stick reasonably close to it where possible).

Basically, unlike many other laptops, Acer laptops (from about 2004 onwards) already generate proper interrupts when keys are pressed. Anything not recognised by the kernel, it is the job of userspace applications to map, not kernel space.

Plus, acer_acpi is not available on all distributions, whereas HAL is (hence, I agree with the idea of the HAL developers that these quirks should be centralised in one place, and that place should be HAL). In future, this means that when new keyboards are added, you will only need to update one package, the 'hal-info' package which contains all of HAL's various quirks (rather than my releasing a new version of acer_acpi for every keyboard added).

However, as the acer_acpi maintainer, I do have access to more people with Acer laptops than anyone else, so felt it was only fair that I put that to use when HAL started this keyboard quirk project.


If there's anything else I can provide, just let me knowPhase 2 is to try and get a keyboard map added to X (basically, scancodes -> kernel key codes -> X key codes. If you haven't guessed, keyboards are a bit of a pain in the *nix world. However, from what I've seen so far, I think just one keyboard map will suffice for nearly all the Acer laptops from 2004 to present).

Can you start a terminal application in X (e.g. Konsole, or some equivalent) and run 'xev'. Then press the _other_ keys on your laptop (e.g. the multimedia keys, 'e' key', 'key that has a planet on it', fn+F4, Fn+f8 and any others I may have missed - basically, all the extra keys that _don't_ messages in dmesg) and report back the keycode from xev's output.

KKJensen
23rd July 2007, 05:28 PM
Heh heh...Sounds like you're that pot at the end of the rainbow for acer laptop users...or at least the leprechaun that guards it.

DSDT... you got this already

Here's the xev output of me pressing the FN-F1,F2,F3,F5,e,p,pound and dollar buttons.



[root@biggirl ~]# cat xev.output
Outer window is 0x3200001, inner window is 0x3200002

PropertyNotify event, serial 8, synthetic NO, window 0x3200001,
atom 0x27 (WM_NAME), time 4091190884, state PropertyNewValue

PropertyNotify event, serial 9, synthetic NO, window 0x3200001,
atom 0x22 (WM_COMMAND), time 4091190884, state PropertyNewValue

PropertyNotify event, serial 10, synthetic NO, window 0x3200001,
atom 0x28 (WM_NORMAL_HINTS), time 4091190884, state PropertyNewValue

CreateNotify event, serial 11, synthetic NO, window 0x3200001,
parent 0x3200001, window 0x3200002, (10,10), width 50, height 50
border_width 4, override NO

MapNotify event, serial 12, synthetic NO, window 0x3200001,
event 0x3200001, window 0x3200002, override NO

ConfigureNotify event, serial 15, synthetic NO, window 0x3200001,
event 0x3200001, window 0x3200001, (0,0), width 178, height 178,
border_width 0, above 0x220042d, override NO

ReparentNotify event, serial 15, synthetic NO, window 0x3200001,
event 0x3200001, window 0x3200001, parent 0x1009d77,
(0,0), override NO

PropertyNotify event, serial 15, synthetic NO, window 0x3200001,
atom 0x110 (_NET_WM_DESKTOP), time 4091190886, state PropertyNewValue

PropertyNotify event, serial 15, synthetic NO, window 0x3200001,
atom 0x110 (_NET_WM_DESKTOP), time 4091190886, state PropertyNewValue

PropertyNotify event, serial 15, synthetic NO, window 0x3200001,
atom 0x176 (_NET_FRAME_EXTENTS), time 4091190886, state PropertyNewValue

ConfigureNotify event, serial 15, synthetic NO, window 0x3200001,
event 0x3200001, window 0x3200001, (5,24), width 178, height 178,
border_width 0, above 0x0, override NO

PropertyNotify event, serial 15, synthetic NO, window 0x3200001,
atom 0x8c (WM_STATE), time 4091190886, state PropertyNewValue

PropertyNotify event, serial 15, synthetic NO, window 0x3200001,
atom 0x116 (_NET_WM_STATE), time 4091190886, state PropertyNewValue

ConfigureNotify event, serial 15, synthetic YES, window 0x3200001,
event 0x3200001, window 0x3200001, (76,89), width 178, height 178,
border_width 2, above 0x0, override NO

MapNotify event, serial 15, synthetic NO, window 0x3200001,
event 0x3200001, window 0x3200001, override NO

VisibilityNotify event, serial 15, synthetic NO, window 0x3200001,
state VisibilityUnobscured

Expose event, serial 15, synthetic NO, window 0x3200001,
(0,0), width 178, height 10, count 3

Expose event, serial 15, synthetic NO, window 0x3200001,
(0,10), width 10, height 58, count 2

Expose event, serial 15, synthetic NO, window 0x3200001,
(68,10), width 110, height 58, count 1

Expose event, serial 15, synthetic NO, window 0x3200001,
(0,68), width 178, height 110, count 0

PropertyNotify event, serial 15, synthetic NO, window 0x3200001,
atom 0x116 (_NET_WM_STATE), time 4091190887, state PropertyNewValue

FocusIn event, serial 15, synthetic NO, window 0x3200001,
mode NotifyNormal, detail NotifyNonlinear

KeymapNotify event, serial 15, synthetic NO, window 0x0,
keys: 0 0 0 0 16 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

PropertyNotify event, serial 15, synthetic NO, window 0x3200001,
atom 0x116 (_NET_WM_STATE), time 4091190888, state PropertyNewValue

PropertyNotify event, serial 15, synthetic NO, window 0x3200001,
atom 0x13a (XKLAVIER_STATE), time 4091190895, state PropertyNewValue

KeyRelease event, serial 15, synthetic NO, window 0x3200001,
root 0x69, subw 0x0, time 4091190901, (974,310), root:(1052,401),
state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,
" XLookupString gives 1 bytes: (0d) "
XFilterEvent returns: False

PropertyNotify event, serial 15, synthetic NO, window 0x3200001,
atom 0x153 (_NET_WM_ICON_GEOMETRY), time 4091190914, state PropertyNewValue

PropertyNotify event, serial 24, synthetic NO, window 0x3200001,
atom 0x153 (_NET_WM_ICON_GEOMETRY), time 4091190927, state PropertyNewValue

KeyPress event, serial 29, synthetic NO, window 0x3200001,
root 0x69, subw 0x0, time 4091231163, (974,310), root:(1052,401),
state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

FocusOut event, serial 29, synthetic NO, window 0x3200001,
mode NotifyGrab, detail NotifyAncestor

cathectic
23rd July 2007, 06:36 PM
Can you give me the xev output for the _other_ special keys (e.g. the multimedia ones, the ones that don't produce any error in dmesg) and in particular, I just want the keycode - i.e. in your case, you pressed the left Alt and it generated keycode 64 (unfortunately, the keys I want to know about don't tell you which key was pressed, they just say 'NoSymbol', so I also need to know which key it was you pressed as well).

Something like:

Fn+F4 (sleep) = keycode 223
Fn+F8 (mute) = keycode 160
Fn+Home (play/ pause) = keycode 162
Fn+Pg Up (Stop) = keycode 164
Fn+Pg Down (Back) = keycode 144
Fn+Pg Up (Next) = keycode 153
Fn+Up (Volume Up) = keycode 176
FN+Down (Volume Down) = keycode 174

KKJensen
27th July 2007, 12:29 PM
At this point in time (with acer_acpi installed) I get the errors showing up in dmesg and /var/log/messages about the following keys:

FN-F1,F2,F3,F5,e,p,pound, dollar, bluetooth & wifi (on front).

This covers all the buttons on my machine that aren't currently mappable using the gnome keyboard shortcuts GUI.

The following were mappable with a fairly minimal install of Fedora 7: FN+F4,F6,F7,F8,HOME,PgUp,Pg,Dn,End,Up arrow, down arrow.

I guess any tweak that will cover the alleged "standard" acer keyboard and the e,p and wireless buttons on the front would cover everything on my machine.


When would this next version of HAL be released?


(A bit off topic, but related): I have a bluetooth module coming for my machine. With acer_acpi activating or disactivating the wifi or bluetooth is as simple as changing the appropriate file to 1 or 0. I'm still pretty new to scripting in linux; you wouldn't, by chance, already have scripts to toggle the activation state of these devices by using the buttons on the front of the machine?

cathectic
27th July 2007, 12:36 PM
Thanks. I'll work on trying to get a new keymap up to X (something like "acer_laptop").

And unfortunately, no, I don't have any scripts I'm afraid - I always found such endeavours more hassle than they were worth and gave up quite quickly.

Although perhaps this might be of some help (it was from another acer_acpi user on one of the list discussions on this topic): http://frafra.netsons.org/files/acpi_acer.sh

KKJensen
27th July 2007, 12:40 PM
Thanks for the help and the work you've done.

kris

nwinkler
29th July 2007, 06:35 PM
This might actually be of some help:
http://hughsient.livejournal.com/29730.html