2 * HID driver for Xin-Mo devices, currently only the Dual Arcade controller.
3 * Fixes the negative axis event values (the devices sends -2) to match the
4 * logical axis minimum of the HID report descriptor (the report announces
5 * -1). It is needed because hid-input discards out of bounds values.
6 * (This module is based on "hid-saitek" and "hid-lg".)
8 * Copyright (c) 2013 Olivier Scherler
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
18 #include <linux/device.h>
19 #include <linux/hid.h>
20 #include <linux/module.h>
21 #include <linux/kernel.h>
26 * Fix negative events that are out of bounds.
28 static int xinmo_event(struct hid_device
*hdev
, struct hid_field
*field
,
29 struct hid_usage
*usage
, __s32 value
)
31 switch (usage
->code
) {
37 input_event(field
->hidinput
->input
, usage
->type
,
47 static 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
) },
53 MODULE_DEVICE_TABLE(hid
, xinmo_devices
);
55 static struct hid_driver xinmo_driver
= {
57 .id_table
= xinmo_devices
,
61 module_hid_driver(xinmo_driver
);
62 MODULE_LICENSE("GPL");