Bug 2340

Summary: Logitech navigator keyboard fails function and media key codes
Product: Drivers Reporter: Brian M Hunt (bmh_ca)
Component: Input DevicesAssignee: Dmitry Torokhov (dmitry.torokhov)
Status: REJECTED INVALID    
Severity: low CC: nmirthes, vojtech
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.3 Subsystem:
Regression: --- Bisected commit-id:

Description Brian M Hunt 2004-03-20 20:44:20 UTC
Distribution: Debian unstable

Hardware Environment:
USB Logitech Internet Navigator Keyboard
Model No.: Y-BF37
Part No.: 867224-0100

Problem Description:
Many of the media keys (E-Mail, Messenger/SMS, Webcam, etc) and all the function
keys (F1-F12) fail and are reported in /var/log/messages as, e.g. F1:
Mar 20 23:38:10 fuji kernel: atkbd.c: Unknown key pressed (translated set 2,
code 0xbb on isa0060/serio0).
Mar 20 23:38:10 fuji kernel: atkbd.c: Use 'setkeycodes e03b <keycode>' to make
it known.
Mar 20 23:38:10 fuji kernel: atkbd.c: Unknown key released (translated set 2,
code 0xbb on isa0060/serio0).
Mar 20 23:38:10 fuji kernel: atkbd.c: Use 'setkeycodes e03b <keycode>' to make
it known.

The media keys that work are reported as expected pursuant to KDE's Logitech
Internet Navigator key bindings (i.e. volume, mute, play/pause, etc. all work).

Steps to reproduce:
Replace your existing working keyboard with this one and some of your keys will
stop working.
It does not matter if you use the keyboard as a USB or PS/2 keyboard.
Comment 1 Brian M Hunt 2004-04-04 18:51:48 UTC
The problematic codes are
1. some media keys, and
2. function keys without their "F-lock" engaged.

To clarify:
The function keys are accessible and give proper scancodes when "F-lock" is engaged.
Comment 2 Niko Mirthes 2004-12-04 17:22:11 UTC
I've just purchased this keyboard myself (Logitech Internet Navigator Keyboard
Model No.: Y-BF37) and i'm seeing pretty much the same behaviour. I've been
experimenting a fair bit. Using the PS/2 port, about 17 keys are reported to be
lacking keycode assignments by atkbd.c. Testing with both Fedora Core 3's kernel
tree and vanilla 2.6.10-rc3, the missing keys, and how to make them work using
the ps/2 port, are (from left to right):

Wheel button press: e016 - setkeycodes e016 196
Messenger/SMS:      e011 - not found *
Webcam:             e012 - setkeycodes e012 152
iTouch:             e013 - setkeycodes e013 147
Shopping:           e014 - setkeycodes e014 222

* e011 seems not to have a corresponding entry in driver/char/keyboard.c in the
field(array?) at about line 947. It's mentioned in a comment after an article at
linuxgazette.com. - http://www.linuxgazette.com/node/9028

The above assignments correspond to the keycodes Xorg is expecting. That is, xev
reports they match what's listed in /etc/X11/xkb/keycodes/xfree86. I'm using

XkbModel "logiinkse"

The remainder of the keys besides the alternate F keys appear to work. This
keyboard has an F-lock key on the left side with a corresponding LED. With
F-Lock off none of the alternate F key events have assigned keycodes, and I
haven't sorted them out yet. Here they are anyway:

F1 (New)             scancode e03b
F2  (Reply)          scancode e03c
F3  (Forward)        scancode e03d
F4  (Send)           scancode e03e

F5  (Undo)           scancode e03f
F6  (Redo)           scancode e040
F7  (Print)          scancode e041
F8  (Save)           scancode e042

F9  (My Computer)    scancode e043
F10 (My Documents)   scancode e044
F11 (My Pictures)    scancode e057
F12 (My Music)       scancode e058

Shortly I'll try to match these up to what X expects.

This is with the keyboard in the PS/2 port. Plugging the keyboard in to a usb
port results in a whole new set of problems, mainly some of the keys are
reporting mouse button events and the alternate F keys report nothing using xev.
I'm about to investigate these over the next week and will add my findings here.
Comment 3 Niko Mirthes 2004-12-05 14:47:18 UTC
I've tracked down the remainder of the required kernel keycodes.
Most of this is taken from the Linux Gazette post i linked earlier.

Logitech Internet Navigator Keyboard (Model No.: Y-BF37)

The keyboard is plugged in to the PS/2 port.

Wheel button press   scancode e016 = 278 = keycode 196
Messenger/SMS        scancode e011 = 273 = not found! *
Webcam               scancode e012 = 274 = keycode 152
iTouch               scancode e013 = 275 = keycode 147
Shopping             scancode e014 = 276 = keycode 222

New     (F1)         scancode e03b = 315 = keycode 212
Reply   (F2)         scancode e03c = 316 = keycode 137
Forward (F3)         scancode e03d = 317 = keycode 213
Send    (F4)         scancode e03e = 318 = keycode 214

Undo    (F5)         scancode e03f = 319 = keycode 215
Redo    (F6)         scancode e040 = 320 = keycode 216
Print   (F7)         scancode e041 = 321 = keycode 136
Save    (F8)         scancode e042 = 322 = keycode 218

My Computer  (F9)    scancode e043 = 323 = keycode 219
My Documents (F10)   scancode e044 = 324 = keycode 220
My Pictures  (F11)   scancode e057 = 343 = keycode 228
My Music     (F12)   scancode e058 = 344 = keycode 229

The middle value is the corresponding figure in the field found in
drivers/char/keyboard.c in the kernel source tree. The keycode is
derived from that number's position in the field:

static unsigned short x86_keycodes[256] =
        { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
         16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
         32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
         48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
         64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
         80, 81, 82, 83, 84,118, 86, 87, 88,115,120,119,121,112,123, 92,
        284,285,309,298,312, 91,327,328,329,331,333,335,336,337,338,339,
        367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349,
        360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355,
        103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361,
        291,108,381,281,290,272,292,305,280, 99,112,257,258,359,113,114,
        264,117,271,374,379,265,266, 93, 94, 95, 85,259,375,260, 90,116,
        377,109,111,277,278,282,283,295,296,297,299,300,301,293,303,307,
        308,310,313,314,315,317,318,319,320,357,322,323,324,325,276,330,
        332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 };

e0 in this case amounts to 256+0 or 256.

Knowing that,

    echo "ibase=16;some-hex-value" | bc

gets the value to add to 256.

So,

    echo "ibase=16;12" | bc

converts to 18. 256 + 18 = 274, which is found at index 152
in the field above, leading to scancode e012 = keycode 152.

Another example:

    echo "ibase=16;3B" | bc

converts to 59. 256 + 59 = 315, which is found at index 212
in the field above, leading to scancode e03b = keycode 212.

Set these using setkeycode (man setkeycode).

setkeycode scancode keycode

e.g.

setkeycode e03b 212

I hope this gets a proper fix soon.
Comment 4 Dmitry Torokhov 2005-12-29 14:35:57 UTC
The kernel will only provide mappings for the standard keys because different 
keyboards assign different meaning to the same scancodes. Extended maps should 
be loaded with 'setkeycodes' utility, as kernel suggests.

I am rejecting this bug as invalid.