1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#include <linux/device.h>
17#include <linux/hid.h>
18#include <linux/module.h>
19
20#include "hid-ids.h"
21
22static const struct hid_device_id speedlink_devices[] = {
23 { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE)},
24 { }
25};
26
27static int speedlink_input_mapping(struct hid_device *hdev,
28 struct hid_input *hi,
29 struct hid_field *field, struct hid_usage *usage,
30 unsigned long **bit, int *max)
31{
32
33
34
35
36
37
38 switch (usage->hid & HID_USAGE_PAGE) {
39 case HID_UP_LED:
40 return -1;
41 }
42 return 0;
43}
44
45static int speedlink_event(struct hid_device *hdev, struct hid_field *field,
46 struct hid_usage *usage, __s32 value)
47{
48
49
50
51
52
53
54
55 if (abs(value) >= 256)
56 return 1;
57
58 if (value == 0)
59 return 1;
60
61 return 0;
62}
63
64MODULE_DEVICE_TABLE(hid, speedlink_devices);
65
66static const struct hid_usage_id speedlink_grabbed_usages[] = {
67 { HID_GD_X, EV_REL, 0 },
68 { HID_GD_Y, EV_REL, 1 },
69 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
70};
71
72static struct hid_driver speedlink_driver = {
73 .name = "speedlink",
74 .id_table = speedlink_devices,
75 .usage_table = speedlink_grabbed_usages,
76 .input_mapping = speedlink_input_mapping,
77 .event = speedlink_event,
78};
79module_hid_driver(speedlink_driver);
80
81MODULE_LICENSE("GPL");
82