aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-input-quirks.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2007-11-26 07:18:00 -0500
committerJiri Kosina <jkosina@suse.cz>2008-01-28 08:51:21 -0500
commit36ccaad640737899b069a9a93a82765f0e675a20 (patch)
treef827fe9e5d59bcb2bdcba542070c8d9a790b0ce1 /drivers/hid/hid-input-quirks.c
parent87bc2aa9933afc032a93490e1642918121e7470b (diff)
HID: hid-input quirk for BTC 8193
BTC 8193 keyboard handles its scrollwheel in very non-standard way. It produces two non-standard usages for scrolling up and down, in both cases with postive value equaling to 1. We handle this by temporary mapping, which we then catch in quirk event handler, and remap to negative HWHEEL even in order to introduce correct behavior. Also the button requires special mapping, as it triggers standard-violating usage code. Reported in kernel.org bugzilla #9385 Reported-by: Kir Kolyshkin <kir@sacred.ru> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-input-quirks.c')
-rw-r--r--drivers/hid/hid-input-quirks.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
index 7f2f80b00d74..e378b4a5eeac 100644
--- a/drivers/hid/hid-input-quirks.c
+++ b/drivers/hid/hid-input-quirks.c
@@ -253,6 +253,27 @@ static int quirk_cherry_genius_29e(struct hid_usage *usage, struct input_dev *in
253 return 1; 253 return 1;
254} 254}
255 255
256static int quirk_btc_8193(struct hid_usage *usage, struct input_dev *input,
257 unsigned long *bit, int *max)
258{
259 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
260 return 0;
261
262 switch (usage->hid & HID_USAGE) {
263 case 0x230: map_key(BTN_MOUSE); break;
264 case 0x231: map_rel(REL_WHEEL); break;
265 /*
266 * this keyboard has a scrollwheel implemented in
267 * totally broken way. We map this usage temporarily
268 * to HWHEEL and handle it in the event quirk handler
269 */
270 case 0x232: map_rel(REL_HWHEEL); break;
271
272 default:
273 return 0;
274 }
275 return 1;
276}
256 277
257#define VENDOR_ID_BELKIN 0x1020 278#define VENDOR_ID_BELKIN 0x1020
258#define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006 279#define DEVICE_ID_BELKIN_WIRELESS_KEYBOARD 0x0006
@@ -263,6 +284,9 @@ static int quirk_cherry_genius_29e(struct hid_usage *usage, struct input_dev *in
263#define VENDOR_ID_CHICONY 0x04f2 284#define VENDOR_ID_CHICONY 0x04f2
264#define DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 285#define DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418
265 286
287#define VENDOR_ID_EZKEY 0x0518
288#define DEVICE_ID_BTC_8193 0x0002
289
266#define VENDOR_ID_LOGITECH 0x046d 290#define VENDOR_ID_LOGITECH 0x046d
267#define DEVICE_ID_LOGITECH_RECEIVER 0xc101 291#define DEVICE_ID_LOGITECH_RECEIVER 0xc101
268#define DEVICE_ID_S510_RECEIVER 0xc50c 292#define DEVICE_ID_S510_RECEIVER 0xc50c
@@ -291,6 +315,8 @@ static const struct hid_input_blacklist {
291 315
292 { VENDOR_ID_CHICONY, DEVICE_ID_CHICONY_TACTICAL_PAD, quirk_chicony_tactical_pad }, 316 { VENDOR_ID_CHICONY, DEVICE_ID_CHICONY_TACTICAL_PAD, quirk_chicony_tactical_pad },
293 317
318 { VENDOR_ID_EZKEY, DEVICE_ID_BTC_8193, quirk_btc_8193 },
319
294 { VENDOR_ID_LOGITECH, DEVICE_ID_LOGITECH_RECEIVER, quirk_logitech_ultrax_remote }, 320 { VENDOR_ID_LOGITECH, DEVICE_ID_LOGITECH_RECEIVER, quirk_logitech_ultrax_remote },
295 { VENDOR_ID_LOGITECH, DEVICE_ID_S510_RECEIVER, quirk_logitech_wireless }, 321 { VENDOR_ID_LOGITECH, DEVICE_ID_S510_RECEIVER, quirk_logitech_wireless },
296 { VENDOR_ID_LOGITECH, DEVICE_ID_S510_RECEIVER_2, quirk_logitech_wireless }, 322 { VENDOR_ID_LOGITECH, DEVICE_ID_S510_RECEIVER_2, quirk_logitech_wireless },
@@ -323,6 +349,7 @@ int hidinput_mapping_quirks(struct hid_usage *usage,
323 return 0; 349 return 0;
324} 350}
325 351
352#define IS_BTC8193(x) (x->vendor == 0x0518 && x->product == 0x0002)
326#define IS_MS_KB(x) (x->vendor == 0x045e && (x->product == 0x00db || x->product == 0x00f9)) 353#define IS_MS_KB(x) (x->vendor == 0x045e && (x->product == 0x00db || x->product == 0x00f9))
327 354
328void hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) 355void hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value)
@@ -384,6 +411,13 @@ void hidinput_event_quirks(struct hid_device *hid, struct hid_field *field, stru
384 input_event(input, usage->type, last_key, 0); 411 input_event(input, usage->type, last_key, 0);
385 } 412 }
386 } 413 }
414
415 /* handle the temporary quirky mapping to HWHEEL */
416 if (hid->quirks & HID_QUIRK_HWHEEL_WHEEL_INVERT &&
417 usage->type == EV_REL && usage->code == REL_HWHEEL) {
418 input_event(input, usage->type, REL_WHEEL, -value);
419 return;
420 }
387} 421}
388 422
389 423