Chicony USB Keyboard
PATCH 1/1 Chicony USB Keyboard
Hi,
I've got a Chicony KU-0108 USB keyboard with some multimedial keys: most of them works fine, but there is no chance to use the 'cut', 'copy' and 'paste' keys with the official kernels: the problem is that the keyboard reports strange usages for those keys, so I write a little patch that fixes the bug.
This patch (against 2.6.6) modifies the hidinput_configure_usage function in drivers/usb/input/hid-input.c: it checks for the usages reported by the keyboard and fixes the values so that they can be seen as "standard" keys.
Comments are appreciated
[I've subscribed only linux-usb-devel, so plese CC replies from linux-kernel]
cheers,
Antonio
usb/input/hid-input.c renamed from usb/input/hid-input.c.orig +16 -0
@@ -122,6 +122,22 @@ static void hidinput_configure_usage(strcase HID_GD_GAMEPAD : usage->code +=0x10 ;case HID_GD_JOYSTICK : usage->code +=0x10 ;case HID_GD_MOUSE : usage->code +=0x10 ;break ; + +case 0x000C0003 : +/* reported on a Chicony KU-0108 USB Keyboard. +* The 'cut', 'copy' and 'paste' keys are seen as +* HID_UP_BUTTON instead of, e.g., +* HID_UP_CONSUMER. The keys report a keycode > 255, +* so we need to fix it. +*/ + +switch (usage->code) { +case 0x10f : usage->code =KEY_CUT ;break ; +case 0x100 : usage->code =KEY_COPY ;break ; +case 0x101 : usage->code =KEY_PASTE ;break ; + } +break ; +default :if (field->physical ==HID_GD_POINTER ) usage->code +=0x10 ;