1 // SPDX-License-Identifier: GPL-2.0-only
3 * HID driver for some ITE "special" devices
4 * Copyright (c) 2017 Hans de Goede <hdegoede@redhat.com>
7 #include <linux/device.h>
8 #include <linux/input.h>
10 #include <linux/module.h>
14 static int ite_event(struct hid_device *hdev, struct hid_field *field,
15 struct hid_usage *usage, __s32 value)
17 struct input_dev *input;
19 if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput)
22 input = field->hidinput->input;
25 * The ITE8595 always reports 0 as value for the rfkill button. Luckily
26 * it is the only button in its report, and it sends a report on
27 * release only, so receiving a report means the button was pressed.
29 if (usage->hid == HID_GD_RFKILL_BTN) {
30 input_event(input, EV_KEY, KEY_RFKILL, 1);
32 input_event(input, EV_KEY, KEY_RFKILL, 0);
40 static const struct hid_device_id ite_devices[] = {
41 { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE8595) },
42 { HID_USB_DEVICE(USB_VENDOR_ID_258A, USB_DEVICE_ID_258A_6A88) },
45 MODULE_DEVICE_TABLE(hid, ite_devices);
47 static struct hid_driver ite_driver = {
49 .id_table = ite_devices,
52 module_hid_driver(ite_driver);
54 MODULE_LICENSE("GPL");