1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#include <linux/device.h>
19#include <linux/hid.h>
20#include <linux/module.h>
21#include <linux/kernel.h>
22
23#include "hid-ids.h"
24
25
26
27
28static int xinmo_event(struct hid_device *hdev, struct hid_field *field,
29 struct hid_usage *usage, __s32 value)
30{
31 switch (usage->code) {
32 case ABS_X:
33 case ABS_Y:
34 case ABS_Z:
35 case ABS_RX:
36 if (value < -1) {
37 input_event(field->hidinput->input, usage->type,
38 usage->code, -1);
39 return 1;
40 }
41 break;
42 }
43
44 return 0;
45}
46
47static const struct hid_device_id xinmo_devices[] = {
48 { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) },
49 { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_THT_2P_ARCADE) },
50 { }
51};
52
53MODULE_DEVICE_TABLE(hid, xinmo_devices);
54
55static struct hid_driver xinmo_driver = {
56 .name = "xinmo",
57 .id_table = xinmo_devices,
58 .event = xinmo_event
59};
60
61module_hid_driver(xinmo_driver);
62MODULE_LICENSE("GPL");
63