0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <linux/device.h>
0014 #include <linux/hid.h>
0015 #include <linux/module.h>
0016
0017 #include "hid-ids.h"
0018
0019 static const struct hid_device_id speedlink_devices[] = {
0020 { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE)},
0021 { }
0022 };
0023
0024 static int speedlink_input_mapping(struct hid_device *hdev,
0025 struct hid_input *hi,
0026 struct hid_field *field, struct hid_usage *usage,
0027 unsigned long **bit, int *max)
0028 {
0029
0030
0031
0032
0033
0034
0035 switch (usage->hid & HID_USAGE_PAGE) {
0036 case HID_UP_LED:
0037 return -1;
0038 }
0039 return 0;
0040 }
0041
0042 static int speedlink_event(struct hid_device *hdev, struct hid_field *field,
0043 struct hid_usage *usage, __s32 value)
0044 {
0045
0046
0047
0048
0049
0050
0051
0052 if (abs(value) >= 256)
0053 return 1;
0054
0055 if (value == 0)
0056 return 1;
0057
0058 return 0;
0059 }
0060
0061 MODULE_DEVICE_TABLE(hid, speedlink_devices);
0062
0063 static const struct hid_usage_id speedlink_grabbed_usages[] = {
0064 { HID_GD_X, EV_REL, 0 },
0065 { HID_GD_Y, EV_REL, 1 },
0066 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
0067 };
0068
0069 static struct hid_driver speedlink_driver = {
0070 .name = "speedlink",
0071 .id_table = speedlink_devices,
0072 .usage_table = speedlink_grabbed_usages,
0073 .input_mapping = speedlink_input_mapping,
0074 .event = speedlink_event,
0075 };
0076 module_hid_driver(speedlink_driver);
0077
0078 MODULE_LICENSE("GPL");