19 #include <linux/device.h>
20 #include <linux/hid.h>
21 #include <linux/module.h>
22 #include <linux/random.h>
23 #include <linux/sched.h>
24 #include <linux/wait.h>
29 #define LG_RDESC 0x001
30 #define LG_BAD_RELATIVE_KEYS 0x002
31 #define LG_DUPLICATE_USAGES 0x004
32 #define LG_EXPANDED_KEYMAP 0x010
33 #define LG_IGNORE_DOUBLED_WHEEL 0x020
34 #define LG_WIRELESS 0x040
35 #define LG_INVERT_HWHEEL 0x080
36 #define LG_NOGET 0x100
39 #define LG_RDESC_REL_ABS 0x800
44 #define DFP_RDESC_ORIG_SIZE 97
54 static __u8 dfp_rdesc_fixed[] = {
113 if ((drv_data->
quirks &
LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 &&
114 rdesc[84] == 0x8c && rdesc[85] == 0x02) {
116 "fixing up Logitech keyboard report descriptor\n");
117 rdesc[84] = rdesc[89] = 0x4d;
118 rdesc[85] = rdesc[90] = 0x10;
121 rdesc[32] == 0x81 && rdesc[33] == 0x06 &&
122 rdesc[49] == 0x81 && rdesc[50] == 0x06) {
124 "fixing up rel/abs in Logitech report descriptor\n");
125 rdesc[33] = rdesc[50] = 0x02;
128 rdesc[41] == 0x95 && rdesc[42] == 0x0B &&
129 rdesc[47] == 0x05 && rdesc[48] == 0x09) {
130 hid_info(hdev,
"fixing up Logitech Speed Force Wireless button descriptor\n");
141 "fixing up Logitech Driving Force Pro report descriptor\n");
142 rdesc = dfp_rdesc_fixed;
143 *rsize =
sizeof(dfp_rdesc_fixed);
151 #define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
154 static int lg_ultrax_remote_mapping(
struct hid_input *hi,
188 unsigned long **
bit,
int *
max)
204 unsigned long **bit,
int *max)
266 unsigned long **bit,
int *max)
270 static const u8 e_keymap[] = {
271 0,216, 0,213,175,156, 0, 0, 0, 0,
272 144, 0, 0, 0, 0, 0, 0, 0, 0,212,
273 174,167,152,161,112, 0, 0, 0,154, 0,
274 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
275 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
276 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
277 0, 0, 0, 0, 0,183,184,185,186,187,
278 188,189,190,191,192,193,194, 0, 0, 0
280 struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
281 unsigned int hid = usage->
hid;
284 lg_ultrax_remote_mapping(hi, usage, bit, max))
288 lg_dinovo_mapping(hi, usage, bit, max))
291 if ((drv_data->
quirks &
LG_WIRELESS) && lg_wireless_mapping(hi, usage, bit, max))
302 (hid == 7 || hid == 8))
307 e_keymap[hid] != 0) {
308 hid_map_usage(hi, usage, bit, max,
EV_KEY,
319 unsigned long **bit,
int *max)
321 struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
337 struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
359 hid_err(hdev,
"Insufficient memory, cannot allocate driver data\n");
362 drv_data->
quirks =
id->driver_data;
364 hid_set_drvdata(hdev, (
void *)drv_data);
369 ret = hid_parse(hdev);
371 hid_err(hdev,
"parse failed\n");
378 ret = hid_hw_start(hdev, connect_mask);
380 hid_err(hdev,
"hw start failed\n");
386 unsigned char buf[] = { 0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
419 static void lg_remove(
struct hid_device *hdev)
421 struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
460 .driver_data =
LG_FF },
462 .driver_data =
LG_FF },
464 .driver_data =
LG_FF },
466 .driver_data =
LG_FF },
482 .driver_data =
LG_FF },
498 .id_table = lg_devices,
499 .report_fixup = lg_report_fixup,
500 .input_mapping = lg_input_mapping,
501 .input_mapped = lg_input_mapped,
507 static int __init lg_init(
void)
512 static void __exit lg_exit(
void)