Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / hid / hid-lcpower.c
blob8acd3ee5ada5f0fe0297b9339214db0e269e0c7e
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * HID driver for LC Power Model RC1000MCE
5 * Copyright (c) 2011 Chris Schlund
6 * based on hid-topseed module
7 */
9 /*
12 #include <linux/device.h>
13 #include <linux/hid.h>
14 #include <linux/module.h>
16 #include "hid-ids.h"
18 #define ts_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
19 EV_KEY, (c))
20 static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi,
21 struct hid_field *field, struct hid_usage *usage,
22 unsigned long **bit, int *max)
24 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
25 return 0;
27 switch (usage->hid & HID_USAGE) {
28 case 0x046: ts_map_key_clear(KEY_YELLOW); break;
29 case 0x047: ts_map_key_clear(KEY_GREEN); break;
30 case 0x049: ts_map_key_clear(KEY_BLUE); break;
31 case 0x04a: ts_map_key_clear(KEY_RED); break;
32 case 0x00d: ts_map_key_clear(KEY_HOME); break;
33 case 0x025: ts_map_key_clear(KEY_TV); break;
34 case 0x048: ts_map_key_clear(KEY_VCR); break;
35 case 0x024: ts_map_key_clear(KEY_MENU); break;
36 default:
37 return 0;
40 return 1;
43 static const struct hid_device_id ts_devices[] = {
44 { HID_USB_DEVICE( USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000) },
45 { }
47 MODULE_DEVICE_TABLE(hid, ts_devices);
49 static struct hid_driver ts_driver = {
50 .name = "LC RC1000MCE",
51 .id_table = ts_devices,
52 .input_mapping = ts_input_mapping,
54 module_hid_driver(ts_driver);
56 MODULE_LICENSE("GPL");