-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HID: plantronics: fix errant mouse events
This version of the driver prevents Telephony pages which are not mapped as Consumer Control applications AND are not on the Consumer Page from being registered by the hid-input driver. Signed-off-by: JD Cole <jd.cole@plantronics.com> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
- Loading branch information
JD Cole
authored and
Jiri Kosina
committed
Nov 3, 2014
1 parent
7f474df
commit 1a3f83f
Showing
6 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Plantronics USB HID Driver | ||
* | ||
* Copyright (c) 2014 JD Cole <jd.cole@plantronics.com> | ||
* Copyright (c) 2014 Terry Junge <terry.junge@plantronics.com> | ||
*/ | ||
|
||
/* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation; either version 2 of the License, or (at your option) | ||
* any later version. | ||
*/ | ||
|
||
#include "hid-ids.h" | ||
|
||
#include <linux/hid.h> | ||
#include <linux/module.h> | ||
|
||
static int plantronics_input_mapping(struct hid_device *hdev, | ||
struct hid_input *hi, | ||
struct hid_field *field, | ||
struct hid_usage *usage, | ||
unsigned long **bit, int *max) | ||
{ | ||
if (field->application == HID_CP_CONSUMERCONTROL | ||
&& (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) { | ||
hid_dbg(hdev, "usage: %08x (appl: %08x) - defaulted\n", | ||
usage->hid, field->application); | ||
return 0; | ||
} | ||
|
||
hid_dbg(hdev, "usage: %08x (appl: %08x) - ignored\n", | ||
usage->hid, field->application); | ||
|
||
return -1; | ||
} | ||
|
||
static int plantronics_probe(struct hid_device *hdev, | ||
const struct hid_device_id *id) | ||
{ | ||
int ret; | ||
|
||
ret = hid_parse(hdev); | ||
if (ret) { | ||
hid_err(hdev, "parse failed\n"); | ||
goto err; | ||
} | ||
|
||
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
if (ret) { | ||
hid_err(hdev, "hw start failed\n"); | ||
goto err; | ||
} | ||
|
||
return 0; | ||
err: | ||
return ret; | ||
} | ||
|
||
static const struct hid_device_id plantronics_devices[] = { | ||
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, | ||
{ } | ||
}; | ||
MODULE_DEVICE_TABLE(hid, plantronics_devices); | ||
|
||
static struct hid_driver plantronics_driver = { | ||
.name = "plantronics", | ||
.id_table = plantronics_devices, | ||
.input_mapping = plantronics_input_mapping, | ||
.probe = plantronics_probe, | ||
}; | ||
module_hid_driver(plantronics_driver); | ||
|
||
MODULE_AUTHOR("JD Cole <jd.cole@plantronics.com>"); | ||
MODULE_AUTHOR("Terry Junge <terry.junge@plantronics.com>"); | ||
MODULE_DESCRIPTION("Plantronics USB HID Driver"); | ||
MODULE_LICENSE("GPL"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters