0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/device.h>
0012 #include <linux/input.h>
0013 #include <linux/hid.h>
0014 #include <linux/module.h>
0015
0016 #include "hid-ids.h"
0017
0018 #define ks_map_key(c) hid_map_usage(hi, usage, bit, max, EV_KEY, (c))
0019
0020 static int ks_input_mapping(struct hid_device *hdev, struct hid_input *hi,
0021 struct hid_field *field, struct hid_usage *usage,
0022 unsigned long **bit, int *max)
0023 {
0024 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
0025 return 0;
0026
0027 switch (usage->hid & HID_USAGE) {
0028 case 0x01: ks_map_key(BTN_MIDDLE); break;
0029 case 0x02: ks_map_key(BTN_SIDE); break;
0030 default:
0031 return 0;
0032 }
0033 return 1;
0034 }
0035
0036 static const struct hid_device_id ks_devices[] = {
0037 { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
0038 { }
0039 };
0040 MODULE_DEVICE_TABLE(hid, ks_devices);
0041
0042 static struct hid_driver ks_driver = {
0043 .name = "kensington",
0044 .id_table = ks_devices,
0045 .input_mapping = ks_input_mapping,
0046 };
0047 module_hid_driver(ks_driver);
0048
0049 MODULE_LICENSE("GPL");