Skip to content

Commit

Permalink
HID: hid-microsoft: Do the check for the ms usage page per device
Browse files Browse the repository at this point in the history
For some devices we may also want to do custom mappings for other pages.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Hans de Goede authored and Jiri Kosina committed Feb 3, 2014
1 parent 5820e4d commit aac59f6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/hid/hid-microsoft.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ static int ms_ergonomy_kb_quirk(struct hid_input *hi, struct hid_usage *usage,
{
struct input_dev *input = hi->input;

if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
return 0;

switch (usage->hid & HID_USAGE) {
case 0xfd06: ms_map_key_clear(KEY_CHAT); break;
case 0xfd07: ms_map_key_clear(KEY_PHONE); break;
Expand All @@ -83,6 +86,9 @@ static int ms_ergonomy_kb_quirk(struct hid_input *hi, struct hid_usage *usage,
static int ms_presenter_8k_quirk(struct hid_input *hi, struct hid_usage *usage,
unsigned long **bit, int *max)
{
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
return 0;

set_bit(EV_REP, hi->input->evbit);
switch (usage->hid & HID_USAGE) {
case 0xfd08: ms_map_key_clear(KEY_FORWARD); break;
Expand All @@ -102,9 +108,6 @@ static int ms_input_mapping(struct hid_device *hdev, struct hid_input *hi,
{
unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);

if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
return 0;

if (quirks & MS_ERGONOMY) {
int ret = ms_ergonomy_kb_quirk(hi, usage, bit, max);
if (ret)
Expand Down

0 comments on commit aac59f6

Please sign in to comment.