Bug 19012 - External Thinkpad USB keyboard Fn buttons not working
Summary: External Thinkpad USB keyboard Fn buttons not working
Status: RESOLVED FIXED
Alias: None
Product: hal
Classification: Unclassified
Component: hal-info (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: David Zeuthen (not reading bugmail)
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-10 17:11 UTC by Rui Tiago Matos
Modified: 2013-09-13 15:46 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
FDI file to remap the keys (1.43 KB, text/plain)
2009-02-10 16:57 UTC, Rui Tiago Matos
Details

Description Rui Tiago Matos 2008-12-10 17:11:46 UTC
I've recently bought a Thinkpad Ultranav USB keyboard which has several Fn buttons just like a laptop keyboard. Since I have this keyboard connected to my laptop which now stays out of reach on a stand I'd like to have those buttons working. Actually the sound volume up/down/mute, sleep

Here's the evtest output (commented):

[jman@hive ~]$ sudo ./evtest /dev/input/event8
[sudo] password for jman: 
Input driver version is 1.0.0
Input device ID: bus 0x3 vendor 0x4b3 product 0x3019 version 0x100
Input device name: "Lite-On Tech IBM USB Travel Keyboard with UltraNav"
Supported events:
  Event type 0 (Sync)
  Event type 1 (Key)
    Event code 113 (Mute)
    Event code 114 (VolumeDown)
    Event code 115 (VolumeUp)
    Event code 116 (Power)
    Event code 140 (Calc)
    Event code 142 (Sleep)
    Event code 143 (WakeUp)
    Event code 158 (Back)
    Event code 159 (Forward)
    Event code 163 (NextSong)
    Event code 165 (PreviousSong)
    Event code 256 (Btn0)
    Event code 257 (Btn1)
    Event code 258 (Btn2)
    Event code 259 (Btn3)
    Event code 260 (Btn4)
    Event code 261 (Btn5)
    Event code 262 (Btn6)
    Event code 263 (Btn7)
    Event code 264 (Btn8)
    Event code 265 (Btn9)
    Event code 266 (?)
    Event code 267 (?)
    Event code 268 (?)
    Event code 269 (?)
    Event code 270 (?)
    Event code 271 (?)
    Event code 272 (LeftBtn)
    Event code 273 (RightBtn)
    Event code 274 (MiddleBtn)
    Event code 275 (SideBtn)
    Event code 276 (ExtraBtn)
  Event type 4 (Misc)
    Event code 4 (ScanCode)
Grab succeeded, ungrabbing.
Testing ... (interrupt to exit)
Event: time 1228956251.042011, type 4 (Misc), code 4 (ScanCode), value 900f6
Event: time 1228956251.042039, type 1 (Key), code 266 (?), value 1
Event: time 1228956251.042050, -------------- Report Sync ------------
Event: time 1228956251.106015, type 4 (Misc), code 4 (ScanCode), value 900f6
Event: time 1228956251.106042, type 1 (Key), code 266 (?), value 0
Event: time 1228956251.106054, -------------- Report Sync ------------
>>> this is the blue IBM button (generic I think)

Event: time 1228956264.322706, type 4 (Misc), code 4 (ScanCode), value c00ea
Event: time 1228956264.322739, type 1 (Key), code 114 (VolumeDown), value 1
Event: time 1228956264.322756, -------------- Report Sync ------------
Event: time 1228956264.386708, type 4 (Misc), code 4 (ScanCode), value c00ea
Event: time 1228956264.386740, type 1 (Key), code 114 (VolumeDown), value 0
Event: time 1228956264.386756, -------------- Report Sync ------------
Event: time 1228956265.890791, type 4 (Misc), code 4 (ScanCode), value c00e9
Event: time 1228956265.890824, type 1 (Key), code 115 (VolumeUp), value 1
Event: time 1228956265.890842, -------------- Report Sync ------------
Event: time 1228956265.986797, type 4 (Misc), code 4 (ScanCode), value c00e9
Event: time 1228956265.986830, type 1 (Key), code 115 (VolumeUp), value 0
Event: time 1228956265.986847, -------------- Report Sync ------------
Event: time 1228956268.417943, type 4 (Misc), code 4 (ScanCode), value c00e2
Event: time 1228956268.417976, type 1 (Key), code 113 (Mute), value 1
Event: time 1228956268.417992, -------------- Report Sync ------------
Event: time 1228956268.514860, type 4 (Misc), code 4 (ScanCode), value c00e2
Event: time 1228956268.514891, type 1 (Key), code 113 (Mute), value 0
Event: time 1228956268.514906, -------------- Report Sync ------------
Event: time 1228956269.923004, type 4 (Misc), code 4 (ScanCode), value c00e2
Event: time 1228956269.923036, type 1 (Key), code 113 (Mute), value 1
Event: time 1228956269.923053, -------------- Report Sync ------------
Event: time 1228956270.019012, type 4 (Misc), code 4 (ScanCode), value c00e2
Event: time 1228956270.019046, type 1 (Key), code 113 (Mute), value 0
Event: time 1228956270.019062, -------------- Report Sync ------------
>>> all of the above ones already work

Event: time 1228956280.227546, type 4 (Misc), code 4 (ScanCode), value 900f0
Event: time 1228956280.227575, type 1 (Key), code 271 (?), value 1
Event: time 1228956280.227589, -------------- Report Sync ------------
Event: time 1228956280.291552, type 4 (Misc), code 4 (ScanCode), value 900f0
Event: time 1228956280.291581, type 1 (Key), code 271 (?), value 0
Event: time 1228956280.291593, -------------- Report Sync ------------
>>> Fn+F3, has a square and an X, turn off the screen?

Event: time 1228956281.251600, type 4 (Misc), code 4 (ScanCode), value 10082
Event: time 1228956281.251633, type 1 (Key), code 142 (Sleep), value 1
Event: time 1228956281.251642, -------------- Report Sync ------------
Event: time 1228956281.315605, type 4 (Misc), code 4 (ScanCode), value 10082
Event: time 1228956281.315636, type 1 (Key), code 142 (Sleep), value 0
Event: time 1228956281.315646, -------------- Report Sync ------------
>>> Fn+F4, seems to work too but I've set gnome-power-manager to ignore the sleep button

Event: time 1228956284.099753, type 4 (Misc), code 4 (ScanCode), value 900f1
Event: time 1228956284.099782, type 1 (Key), code 261 (Btn5), value 1
Event: time 1228956284.099795, -------------- Report Sync ------------
Event: time 1228956284.195684, type 4 (Misc), code 4 (ScanCode), value 900f1
Event: time 1228956284.195710, type 1 (Key), code 261 (Btn5), value 0
Event: time 1228956284.195722, -------------- Report Sync ------------
>>> Fn+F5, from the drawing seems to be a radio kill switch

Event: time 1228956286.627808, type 4 (Misc), code 4 (ScanCode), value 900f2
Event: time 1228956286.627831, type 1 (Key), code 262 (Btn6), value 1
Event: time 1228956286.627844, -------------- Report Sync ------------
Event: time 1228956286.691885, type 4 (Misc), code 4 (ScanCode), value 900f2
Event: time 1228956286.691913, type 1 (Key), code 262 (Btn6), value 0
Event: time 1228956286.691925, -------------- Report Sync ------------
>>> Fn+F7, has a screen and a laptop, seems to be the button to change from the internal LVDS to the external VGA and/or DVI connection

Event: time 1228957431.552605, type 4 (Misc), code 4 (ScanCode), value 900f7
Event: time 1228957431.552633, type 1 (Key), code 267 (?), value 1
Event: time 1228957431.552642, -------------- Report Sync ------------
Event: time 1228957431.648608, type 4 (Misc), code 4 (ScanCode), value 900f7
Event: time 1228957431.648635, type 1 (Key), code 267 (?), value 0
Event: time 1228957431.648646, -------------- Report Sync ------------
>>> Fn+F9, doesn't have a drawing, found it by accident

Event: time 1228956289.348032, type 4 (Misc), code 4 (ScanCode), value 900f3
Event: time 1228956289.348060, type 1 (Key), code 263 (Btn7), value 1
Event: time 1228956289.348071, -------------- Report Sync ------------
Event: time 1228956289.444033, type 4 (Misc), code 4 (ScanCode), value 900f3
Event: time 1228956289.444061, type 1 (Key), code 263 (Btn7), value 0
Event: time 1228956289.444072, -------------- Report Sync ------------
>>> Fn+F12, has a square and an arrow pointing from the square to a "hard disk", suspend to disk?

Event: time 1228956291.012037, type 4 (Misc), code 4 (ScanCode), value 900f4
Event: time 1228956291.012061, type 1 (Key), code 264 (Btn8), value 1
Event: time 1228956291.012073, -------------- Report Sync ------------
Event: time 1228956291.076119, type 4 (Misc), code 4 (ScanCode), value 900f4
Event: time 1228956291.076147, type 1 (Key), code 264 (Btn8), value 0
Event: time 1228956291.076158, -------------- Report Sync ------------
>>> Fn+Home, brightness up

Event: time 1228956292.068100, type 4 (Misc), code 4 (ScanCode), value 900f5
Event: time 1228956292.068127, type 1 (Key), code 265 (Btn9), value 1
Event: time 1228956292.068138, -------------- Report Sync ------------
Event: time 1228956292.132103, type 4 (Misc), code 4 (ScanCode), value 900f5
Event: time 1228956292.132126, type 1 (Key), code 265 (Btn9), value 0
Event: time 1228956292.132137, -------------- Report Sync ------------
>>> Fn+End, brightness down

Event: time 1228956299.396557, type 4 (Misc), code 4 (ScanCode), value 900f8
Event: time 1228956299.396585, type 1 (Key), code 268 (?), value 1
Event: time 1228956299.396594, -------------- Report Sync ------------
Event: time 1228956299.492567, type 4 (Misc), code 4 (ScanCode), value 900f8
Event: time 1228956299.492596, type 1 (Key), code 268 (?), value 0
Event: time 1228956299.492604, -------------- Report Sync ------------
>>> Fn+Space, has a looking glass with a + sign

I think pressed all the blue Fn buttons (and then some more).
Comment 1 Rui Tiago Matos 2008-12-10 17:12:44 UTC
(In reply to comment #0)
> Actually the sound volume up/down/mute, sleep
... already work.
Comment 2 Rui Tiago Matos 2008-12-11 18:04:33 UTC
I suppose I'm hitting bug #11227 since the keys that work have a keycode <= 255, right?

Is there a way to get around this?
Comment 3 Rui Tiago Matos 2009-02-10 16:34:11 UTC
lshal output for the event8 device which gets the Fn keys' events:

udi = '/org/freedesktop/Hal/devices/usb_device_4b3_3019_noserial_if1_logicaldev_input'
  info.addons.singleton = {'hald-addon-input'} (string list)
  info.callouts.add = {'fedora-setup-keyboard'} (string list)
  info.capabilities = {'input', 'input.keys', 'button'} (string list)
  info.category = 'input'  (string)
  info.parent = '/org/freedesktop/Hal/devices/usb_device_4b3_3019_noserial_if1'  (string)
  info.product = 'Lite-On Tech IBM USB Travel Keyboard with UltraNav'  (string)
  info.subsystem = 'input'  (string)
  info.udi = '/org/freedesktop/Hal/devices/usb_device_4b3_3019_noserial_if1_logicaldev_input'  (string)
  input.device = '/dev/input/event8'  (string)
  input.originating_device = '/org/freedesktop/Hal/devices/usb_device_4b3_3019_noserial_if1'  (string)
  input.product = 'Lite-On Tech IBM USB Travel Keyboard with UltraNav'  (string)
  input.x11_driver = 'evdev'  (string)
  input.xkb.layout = 'us'  (string)
  input.xkb.model = 'pc105+inet'  (string)
  input.xkb.rules = 'base'  (string)
  linux.device_file = '/dev/input/event8'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'input'  (string)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2.3/5-2.3:1.1/input/input8/event8'  (string)
Comment 4 Rui Tiago Matos 2009-02-10 16:35:11 UTC
lshal output for the event7 device which gets the regular keys' events:

udi = '/org/freedesktop/Hal/devices/usb_device_4b3_3019_noserial_if0_logicaldev_input'
  info.addons.singleton = {'hald-addon-input'} (string list)
  info.callouts.add = {'fedora-setup-keyboard'} (string list)
  info.capabilities = {'input', 'input.keyboard', 'input.keypad', 'input.keys', 'button'} (string list)
  info.category = 'input'  (string)
  info.parent = '/org/freedesktop/Hal/devices/usb_device_4b3_3019_noserial_if0'  (string)
  info.product = 'Lite-On Tech IBM USB Travel Keyboard with UltraNav'  (string)
  info.subsystem = 'input'  (string)
  info.udi = '/org/freedesktop/Hal/devices/usb_device_4b3_3019_noserial_if0_logicaldev_input'  (string)
  input.device = '/dev/input/event7'  (string)
  input.originating_device = '/org/freedesktop/Hal/devices/usb_device_4b3_3019_noserial_if0'  (string)
  input.product = 'Lite-On Tech IBM USB Travel Keyboard with UltraNav'  (string)
  input.x11_driver = 'evdev'  (string)
  input.xkb.layout = 'us'  (string)
  input.xkb.model = 'pc105+inet'  (string)
  input.xkb.rules = 'base'  (string)
  linux.device_file = '/dev/input/event7'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'input'  (string)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1d.0/usb5/5-2/5-2.3/5-2.3:1.0/input/input7/event7'  (string)
Comment 5 Rui Tiago Matos 2009-02-10 16:57:37 UTC
Created attachment 22783 [details]
FDI file to remap the keys

I've tried to make it work by doing a remap with a hal fdi file using the thinkpad one as reference but I've got 3 problems:

1. It doesn't actually work. Lines like this are appended to the X server log:

(WW) Lite-On Tech IBM USB Travel Keyboard with UltraNav: unable to handle keycode 265

2. The matching rule, as it is, will match both the regular keyboard's device and the Fn keys' device and adds the mapping to both.

3. I'm not sure how to name the file.
Comment 6 Martin Pitt 2009-02-12 11:38:28 UTC
> 1. It doesn't actually work. Lines like this are appended to the X server log:

Right now, X.org can only handle key codes up to 255, see bug 11227. If you find a key code < 256 which has a very similar meaning, then use that instead. Otherwise, we can still add the mapping, so that future X.org versions can handle it then.

> 2. The matching rule, as it is, will match both the regular keyboard's device
> and the Fn keys' device and adds the mapping to both.

I guess you only want the mapping on the device which has the Fn keys? Unfortunately you didn't attach your complete lshal output, but try adding this after your first <match> rule (and append another </match>, of course):

<match key="@info.parent:usb.interface.number" int="1">

> 3. I'm not sure how to name the file.

Don't worry about that. It will be integrated into the existing files, the committer can do that easily.
Comment 7 Rui Tiago Matos 2009-02-12 12:03:43 UTC
(In reply to comment #6)
> > 1. It doesn't actually work. Lines like this are appended to the X server log:
> 
> Right now, X.org can only handle key codes up to 255, see bug 11227. If you
> find a key code < 256 which has a very similar meaning, then use that instead.
> Otherwise, we can still add the mapping, so that future X.org versions can
> handle it then.

Shouldn't the FDI file I attached do that remaping already? The drawings on the keys and their positions are like any Thinkpad laptop's. It's the key codes that are apparently different but I thought the mapping I did was already enough.

For instance:

... 0x10f:screenlock ...

shouldn't this map the key code value 0x10f (271) to the value 152? I thought this would make hal configure the kernel so that the X server only saw the code 152.
Comment 8 Martin Pitt 2009-02-12 12:47:41 UTC
Yes, 152 will work, but in the X.org log you mentioned a key code "265", which doesn't work with X.org right now (for a different key, I suppose).
Comment 9 Rui Tiago Matos 2009-02-12 12:51:42 UTC
(In reply to comment #8)
> Yes, 152 will work, but in the X.org log you mentioned a key code "265", which
> doesn't work with X.org right now (for a different key, I suppose).

Then I don't know what's happening because those key codes being logged by the X server only show up when I have this FDI file in use.

/me is confused.

Thanks for the help Martin.
Comment 10 Martin Pitt 2009-02-12 13:18:27 UTC
Right, your fdi e. g. does

 <append key="input.keymap.data" type="strlist">0x10c:zoom</append> <!-- Fn+Space -->

and /usr/include/linux/input.h shows that as

  #define KEY_ZOOM                0x174

which is way bigger than 256 (0x100). Thus you can't use the zoom key under X.org. Likewise with KEY_RADIO (0x181) and KEY_VENDOR, and perhaps others.

So don't get me wrong, the .fdi is fine in that regard, you just can't use those keys. E. g. "vendor" can be replaced with "prog1" to make the key useful.

It just needs the additional <match> on the interface number (which I can't test here).
Comment 11 Rui Tiago Matos 2009-02-13 11:11:34 UTC
(In reply to comment #10)
> Right, your fdi e. g. does
> 
>  <append key="input.keymap.data" type="strlist">0x10c:zoom</append> <!--
> Fn+Space -->
> 
> and /usr/include/linux/input.h shows that as
> 
>   #define KEY_ZOOM                0x174
> 
> which is way bigger than 256 (0x100). Thus you can't use the zoom key under
> X.org. Likewise with KEY_RADIO (0x181) and KEY_VENDOR, and perhaps others.
> 
> So don't get me wrong, the .fdi is fine in that regard, you just can't use
> those keys. E. g. "vendor" can be replaced with "prog1" to make the key useful.

OK, I see now. I just assumed that as those names were used in the thinkpad fdi file they would be working (I don't actually have a thinkpad laptop). Anyway, other names like 'brightnessup' and 'brightnessdown' map to values 225 and 224 and should therefore work. Instead, I'm getting (for those key presses):

(WW) Lite-On Tech IBM USB Travel Keyboard with UltraNav: unable to handle keycode 265
(WW) Lite-On Tech IBM USB Travel Keyboard with UltraNav: unable to handle keycode 264

Clearly, something is wrong.
Comment 12 Rui Tiago Matos 2013-09-13 15:46:50 UTC
Don't know how or where but this was fixed at some point.


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.