0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <linux/device.h>
0016 #include <linux/hid.h>
0017 #include <linux/module.h>
0018 #include <linux/kernel.h>
0019
0020 #include "hid-ids.h"
0021
0022
0023
0024
0025 static int xinmo_event(struct hid_device *hdev, struct hid_field *field,
0026 struct hid_usage *usage, __s32 value)
0027 {
0028 switch (usage->code) {
0029 case ABS_X:
0030 case ABS_Y:
0031 case ABS_Z:
0032 case ABS_RX:
0033 if (value < -1) {
0034 input_event(field->hidinput->input, usage->type,
0035 usage->code, -1);
0036 return 1;
0037 }
0038 break;
0039 }
0040
0041 return 0;
0042 }
0043
0044 static const struct hid_device_id xinmo_devices[] = {
0045 { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) },
0046 { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_THT_2P_ARCADE) },
0047 { }
0048 };
0049
0050 MODULE_DEVICE_TABLE(hid, xinmo_devices);
0051
0052 static struct hid_driver xinmo_driver = {
0053 .name = "xinmo",
0054 .id_table = xinmo_devices,
0055 .event = xinmo_event
0056 };
0057
0058 module_hid_driver(xinmo_driver);
0059 MODULE_LICENSE("GPL");