2 * HID driver for Speedlink Vicious and Divine Cezanne (USB mouse).
3 * Fixes "jumpy" cursor and removes nonexistent keyboard LEDS from
6 * Copyright (c) 2011 Stefan Kriwanek <mail@stefankriwanek.de>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
16 #include <linux/device.h>
17 #include <linux/hid.h>
18 #include <linux/module.h>
19 #include <linux/usb.h>
22 #include "usbhid/usbhid.h"
24 static const struct hid_device_id speedlink_devices[] = {
25 { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE)},
29 static int speedlink_input_mapping(struct hid_device *hdev,
31 struct hid_field *field, struct hid_usage *usage,
32 unsigned long **bit, int *max)
35 * The Cezanne mouse has a second "keyboard" USB endpoint for it is
36 * able to map keyboard events to the button presses.
37 * It sends a standard keyboard report descriptor, though, whose
40 switch (usage->hid & HID_USAGE_PAGE) {
47 static int speedlink_event(struct hid_device *hdev, struct hid_field *field,
48 struct hid_usage *usage, __s32 value)
50 /* No other conditions due to usage_table. */
51 /* Fix "jumpy" cursor (invalid events sent by device). */
54 /* Drop useless distance 0 events (on button clicks etc.) as well */
61 MODULE_DEVICE_TABLE(hid, speedlink_devices);
63 static const struct hid_usage_id speedlink_grabbed_usages[] = {
64 { HID_GD_X, EV_REL, 0 },
65 { HID_GD_Y, EV_REL, 1 },
66 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
69 static struct hid_driver speedlink_driver = {
71 .id_table = speedlink_devices,
72 .usage_table = speedlink_grabbed_usages,
73 .input_mapping = speedlink_input_mapping,
74 .event = speedlink_event,
77 static int __init speedlink_init(void)
79 return hid_register_driver(&speedlink_driver);
82 static void __exit speedlink_exit(void)
84 hid_unregister_driver(&speedlink_driver);
87 module_init(speedlink_init);
88 module_exit(speedlink_exit);
89 MODULE_LICENSE("GPL");