2 * HID driver for Kensigton Slimblade Trackball
4 * Copyright (c) 2009 Jiri Kosina
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)
14 #include <linux/device.h>
15 #include <linux/input.h>
16 #include <linux/hid.h>
17 #include <linux/module.h>
21 #define ks_map_key(c) hid_map_usage(hi, usage, bit, max, EV_KEY, (c))
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
)
27 if ((usage
->hid
& HID_USAGE_PAGE
) != HID_UP_MSVENDOR
)
30 switch (usage
->hid
& HID_USAGE
) {
31 case 0x01: ks_map_key(BTN_MIDDLE
); break;
32 case 0x02: ks_map_key(BTN_SIDE
); break;
39 static const struct hid_device_id ks_devices
[] = {
40 { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON
, USB_DEVICE_ID_KS_SLIMBLADE
) },
43 MODULE_DEVICE_TABLE(hid
, ks_devices
);
45 static struct hid_driver ks_driver
= {
47 .id_table
= ks_devices
,
48 .input_mapping
= ks_input_mapping
,
50 module_hid_driver(ks_driver
);
52 MODULE_LICENSE("GPL");