2003-07-29 11:37:34

by Diego SANTA CRUZ

[permalink] [raw]
Subject: Linux problems with USB HID keyboards and patches

[Not subscribed to l-k, so please CC me]

Hi,

I've been experiencing some problems with a Logitech iTouch Internet
Navigator USB connected keyboard (model Y-BF37). I solved some of them
by patching the kernel, while others I don't know how to handle. Kernel
is an ACPI enabled version of RH 2.4.20-19.9.

They problems are:

* Problem 1. Pressing Shift+Alt_R generates a fake Cltr_R key press
event with no Ctrl_R key up event, so the Ctrl key gets stuck. Pressing
the Ctrl_R key just after generates only a key release event and then
everything gets back to normal. I added some printk messages to keybdev,
hid-input and hid-core and this is what I got:

# ---> Press Right Shift
hid_core.c:hid_input_field: count = 8
hidinput_hid_event: page 0x7, usage 0xe5, code 54
hidinput_hid_event: key 54 (0x36), down = 1
hid_core.c:hid_input_field: count = 6
hidinput_hid_event: key 54 (0x36), down = 2
# ---> Press Right Alt
# but Right Ctrl synthetized in HW or hid_input_field()
hid_core.c:hid_input_field: count = 8
hidinput_hid_event: page 0x7, usage 0xe4, code 97
keybdev event key 97 (0x61), down = 1
hidinput_hid_event: page 0x7, usage 0xe6, code 100
keybdev event key 100 (0x64), down = 1
hid_core.c:hid_input_field: count = 6
# ---> Release Right Alt
hid_core.c:hid_input_field: count = 8
hidinput_hid_event: page 0x7, usage 0xe6, code 100
keybdev event key 100 (0x64), down = 0
hid_core.c:hid_input_field: count = 6
# ---> Release Right Shift
hid_core.c:hid_input_field: count = 8
hidinput_hid_event: page 0x7, usage 0xe5, code 54
hidinput_hid_event: key 54 (0x36), down = 0
hid_core.c:hid_input_field: count = 6
# ---> Press Right Shift
hid_core.c:hid_input_field: count = 8
hidinput_hid_event: page 0x7, usage 0xe5, code 54
keybdev event key 54 (0x36), down = 1
hid_core.c:hid_input_field: count = 6
keybdev event key 54 (0x36), down = 2
# ---> Press Right Alt
hid_core.c:hid_input_field: count = 8
hidinput_hid_event: page 0x7, usage 0xe6, code 100
keybdev event key 100 (0x64), down = 1
hid_core.c:hid_input_field: count = 6
# ---> Release Right Alt
hid_core.c:hid_input_field: count = 8
hidinput_hid_event: page 0x7, usage 0xe6, code 100
keybdev event key 100 (0x64), down = 0
hid_core.c:hid_input_field: count = 6
# ---> Release Right Shift
hid_core.c:hid_input_field: count = 8
hidinput_hid_event: page 0x7, usage 0xe5, code 54
keybdev event key 54 (0x36), down = 0
hid_core.c:hid_input_field: count = 6
# ---> Press and Release Right Ctrl, but only release reported
hid_core.c:hid_input_field: count = 8
hidinput_hid_event: page 0x7, usage 0xe4, code 97
keybdev event key 97 (0x61), down = 0
hid_core.c:hid_input_field: count = 6

In the above count is the count variable in hid_input_field(), page and
usage the page and usage parts of the usage->hid value in
hidinput_hid_event() and code is the usage->code value in the same
function. Finally key is the value of code in keybdev_event(), decimal
and hex.

Any ideas what's going wrong? Is it a buggy keyboard? Or a problem in
hid_input_field()? Or something else?

* Problem 2: The mapping of HID keys to event keys and from event keys
to PS/2 scancodes are not very nice for "internet" keyboards. I reworked
them to recognize many more HID keys and use the standard MS scancodes,
supplemented by the MS Office keyboard mappings too. That is implemented
by the patch linux-2.4.20-18.9.acpi.4-input.patch. These mappings could
be worth having in 2.4 and also in 2.6 (2.6 has better mappings, but
many are still non-standard).

* Problem 3: My keyboard (and I guess some others too) report some of
the special keys as buttons. They get assigned the BTN_* event keys.
However, these are interpreted by mousedev as regular mouse buttons and
are ignored by keybdev, which is quite annoying. The attached
linux-2.4.20-18.9.acpi.4-keyb-but.patch makes mousedev ignore those and
assigns KEY_PROG* event keys to those in keybdev, so that they behave as
programmable keys.

Any feedback about the patches is appreciated.

Best,

Diego


--
-------------------------------------------------------
Diego Santa Cruz - PhD
Publications available at http://ltswww.epfl.ch/~dsanta
Signal Processing Institute (LTS1 / ITS / STI)
Swiss Federal Institute of Technology (EPFL)
EPFL - STI - ITS, CH-1015 Lausanne, Switzerland
E-mail: [email protected]
Phone: +41 - 21 - 693 26 57
Fax: +41 - 21 - 693 76 00
-------------------------------------------------------


Attachments:
linux-2.4.20-18.9.acpi.4-input.patch (22.29 kB)
linux-2.4.20-18.9.acpi.4-keyb-but.patch (1.33 kB)
Download all attachments