Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232580
b: refs/heads/master
c: 54e74b8
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Torokhov authored and Linus Torvalds committed Jan 31, 2011
1 parent 1c5c6b0 commit 11e04e7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1ca05b7fc2672ea870bd58f45dc8d36d2b980f94
refs/heads/master: 54e74b87e2a9941c6fa82189f270b47cceeba714
28 changes: 17 additions & 11 deletions trunk/drivers/media/rc/rc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,21 +458,27 @@ static int ir_getkeycode(struct input_dev *idev,
index = ir_lookup_by_scancode(rc_map, scancode);
}

if (index >= rc_map->len) {
if (!(ke->flags & INPUT_KEYMAP_BY_INDEX))
IR_dprintk(1, "unknown key for scancode 0x%04x\n",
scancode);
if (index < rc_map->len) {
entry = &rc_map->scan[index];

ke->index = index;
ke->keycode = entry->keycode;
ke->len = sizeof(entry->scancode);
memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode));

} else if (!(ke->flags & INPUT_KEYMAP_BY_INDEX)) {
/*
* We do not really know the valid range of scancodes
* so let's respond with KEY_RESERVED to anything we
* do not have mapping for [yet].
*/
ke->index = index;
ke->keycode = KEY_RESERVED;
} else {
retval = -EINVAL;
goto out;
}

entry = &rc_map->scan[index];

ke->index = index;
ke->keycode = entry->keycode;
ke->len = sizeof(entry->scancode);
memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode));

retval = 0;

out:
Expand Down

0 comments on commit 11e04e7

Please sign in to comment.