Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58426
b: refs/heads/master
c: 2c1d8ae
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Kosina committed Jul 9, 2007
1 parent 604dfcb commit 629fc5f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3c5f4b25f3552c9bcb52eb956753a3c8140480b7
refs/heads/master: 2c1d8aea2ca76df1b1de2aed23e3ceda2a044ed1
25 changes: 25 additions & 0 deletions trunk/drivers/hid/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,16 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
field->dpad = usage->code;
}

/* for those devices which produce Consumer volume usage as relative,
* we emulate pressing volumeup/volumedown appropriate number of times
* in hidinput_hid_event()
*/
if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) &&
(usage->code == ABS_VOLUME)) {
set_bit(KEY_VOLUMEUP, input->keybit);
set_bit(KEY_VOLUMEDOWN, input->keybit);
}

hid_resolv_event(usage->type, usage->code);
#ifdef CONFIG_HID_DEBUG
printk("\n");
Expand Down Expand Up @@ -972,6 +982,21 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
if ((usage->type == EV_KEY) && (usage->code == 0)) /* Key 0 is "unassigned", not KEY_UNKNOWN */
return;

if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) &&
(usage->code == ABS_VOLUME)) {
int count = abs(value);
int direction = value > 0 ? KEY_VOLUMEUP : KEY_VOLUMEDOWN;
int i;

for (i = 0; i < count; i++) {
input_event(input, EV_KEY, direction, 1);
input_sync(input);
input_event(input, EV_KEY, direction, 0);
input_sync(input);
}
return;
}

input_event(input, usage->type, usage->code, value);

if ((field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->type == EV_KEY))
Expand Down

0 comments on commit 629fc5f

Please sign in to comment.