diff options
author | Wattos <Wattos@gmail.com> | 2013-11-24 10:10:00 -0800 |
---|---|---|
committer | Wattos <Wattos@gmail.com> | 2013-11-24 10:10:00 -0800 |
commit | 4a60defe292b7a2ca29121db32e8348fd3494e7b (patch) | |
tree | 9df18aa138c447334ef6f4ed5b73a438db287288 | |
parent | 3f56a4ee048bf5a30633c1ec02f1a70f5c72edbf (diff) | |
parent | ff65b9d6079c8a4e2d71adfe8adc47087051c43a (diff) |
Merge pull request #10 from felixrg/hid_quirk
Use HID_QUIRK_NOGET to prevent wrong first HID report
-rw-r--r-- | src/kernel/hid-lg-g710-plus.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/kernel/hid-lg-g710-plus.c b/src/kernel/hid-lg-g710-plus.c index f3f2577..5100b0b 100644 --- a/src/kernel/hid-lg-g710-plus.c +++ b/src/kernel/hid-lg-g710-plus.c @@ -62,8 +62,6 @@ struct lg_g710_plus_data { struct hid_report *other_buttons_led_report; /* Controls the backlight of other buttons */ struct hid_report *gamemode_report; /* Controls the backlight of other buttons */ - u8 first_event; - u16 macro_button_state; /* Holds the last state of the G1-G6, M1-MR buttons. Required to know which buttons were pressed and which were released */ struct hid_device *hdev; struct input_dev *input_dev; @@ -125,13 +123,6 @@ static int lg_g710_plus_extra_led_keys_event(struct hid_device *hdev, struct hid static int lg_g710_plus_raw_event(struct hid_device *hdev, struct hid_report *report, u8 *data, int size) { - struct lg_g710_plus_data* g710_data = lg_g710_plus_get_data(hdev); - /* Ignore the first event. It will send a key down event for certain buttons, but never the key up event*/ - if (g710_data->first_event) { - memset(data, 0, size); - g710_data->first_event= 0; - return 0; - } switch(report->id) { case 3: return lg_g710_plus_extra_key_event(hdev, report, data, size); case 6: return lg_g710_plus_extra_led_mr_event(hdev, report, data, size); @@ -198,7 +189,6 @@ static struct lg_g710_plus_data* lg_g710_plus_create(struct hid_device *hdev) data->attr_group.name= "logitech-g710"; data->attr_group.attrs= lg_g710_plus_attrs; - data->first_event= 1; data->hdev= hdev; spin_lock_init(&data->lock); @@ -219,6 +209,12 @@ static int lg_g710_plus_probe(struct hid_device *hdev, const struct hid_device_i } hid_set_drvdata(hdev, data); + /* + * Without this, the device would send a first report with a key down event for + * certain buttons, but never the key up event + */ + hdev->quirks |= HID_QUIRK_NOGET; + ret = hid_parse(hdev); if (ret) { hid_err(hdev, "parse failed\n"); |