Root/
1 | /* |
2 | * HID driver for Kensigton Slimblade Trackball |
3 | * |
4 | * Copyright (c) 2009 Jiri Kosina |
5 | */ |
6 | |
7 | /* |
8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the Free |
10 | * Software Foundation; either version 2 of the License, or (at your option) |
11 | * any later version. |
12 | */ |
13 | |
14 | #include <linux/device.h> |
15 | #include <linux/input.h> |
16 | #include <linux/hid.h> |
17 | #include <linux/module.h> |
18 | |
19 | #include "hid-ids.h" |
20 | |
21 | #define ks_map_key(c) hid_map_usage(hi, usage, bit, max, EV_KEY, (c)) |
22 | |
23 | static int ks_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
24 | struct hid_field *field, struct hid_usage *usage, |
25 | unsigned long **bit, int *max) |
26 | { |
27 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR) |
28 | return 0; |
29 | |
30 | switch (usage->hid & HID_USAGE) { |
31 | case 0x01: ks_map_key(BTN_MIDDLE); break; |
32 | case 0x02: ks_map_key(BTN_SIDE); break; |
33 | default: |
34 | return 0; |
35 | } |
36 | return 1; |
37 | } |
38 | |
39 | static const struct hid_device_id ks_devices[] = { |
40 | { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, |
41 | { } |
42 | }; |
43 | MODULE_DEVICE_TABLE(hid, ks_devices); |
44 | |
45 | static struct hid_driver ks_driver = { |
46 | .name = "kensington", |
47 | .id_table = ks_devices, |
48 | .input_mapping = ks_input_mapping, |
49 | }; |
50 | |
51 | static int __init ks_init(void) |
52 | { |
53 | return hid_register_driver(&ks_driver); |
54 | } |
55 | |
56 | static void __exit ks_exit(void) |
57 | { |
58 | hid_unregister_driver(&ks_driver); |
59 | } |
60 | |
61 | module_init(ks_init); |
62 | module_exit(ks_exit); |
63 | MODULE_LICENSE("GPL"); |
64 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9