Commit 53932760 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

media: rc: mce_kbd protocol encodes two scancodes

If two keys are pressed, then both keys are encoded in the scancode. This
makes the mce keyboard more responsive.
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent c421c62a
...@@ -147,13 +147,14 @@ static enum mce_kbd_mode mce_kbd_mode(struct mce_kbd_dec *data) ...@@ -147,13 +147,14 @@ static enum mce_kbd_mode mce_kbd_mode(struct mce_kbd_dec *data)
static void ir_mce_kbd_process_keyboard_data(struct rc_dev *dev, u32 scancode) static void ir_mce_kbd_process_keyboard_data(struct rc_dev *dev, u32 scancode)
{ {
struct mce_kbd_dec *data = &dev->raw->mce_kbd; struct mce_kbd_dec *data = &dev->raw->mce_kbd;
u8 keydata = (scancode >> 8) & 0xff; u8 keydata1 = (scancode >> 8) & 0xff;
u8 keydata2 = (scancode >> 16) & 0xff;
u8 shiftmask = scancode & 0xff; u8 shiftmask = scancode & 0xff;
unsigned char keycode, maskcode; unsigned char maskcode;
int i, keystate; int i, keystate;
dev_dbg(&dev->dev, "keyboard: keydata = 0x%02x, shiftmask = 0x%02x\n", dev_dbg(&dev->dev, "keyboard: keydata2 = 0x%02x, keydata1 = 0x%02x, shiftmask = 0x%02x\n",
keydata, shiftmask); keydata2, keydata1, shiftmask);
for (i = 0; i < 7; i++) { for (i = 0; i < 7; i++) {
maskcode = kbd_keycodes[MCIR2_MASK_KEYS_START + i]; maskcode = kbd_keycodes[MCIR2_MASK_KEYS_START + i];
...@@ -164,10 +165,12 @@ static void ir_mce_kbd_process_keyboard_data(struct rc_dev *dev, u32 scancode) ...@@ -164,10 +165,12 @@ static void ir_mce_kbd_process_keyboard_data(struct rc_dev *dev, u32 scancode)
input_report_key(data->idev, maskcode, keystate); input_report_key(data->idev, maskcode, keystate);
} }
if (keydata) { if (keydata1)
keycode = kbd_keycodes[keydata]; input_report_key(data->idev, kbd_keycodes[keydata1], 1);
input_report_key(data->idev, keycode, 1); if (keydata2)
} else { input_report_key(data->idev, kbd_keycodes[keydata2], 1);
if (!keydata1 && !keydata2) {
for (i = 0; i < MCIR2_MASK_KEYS_START; i++) for (i = 0; i < MCIR2_MASK_KEYS_START; i++)
input_report_key(data->idev, kbd_keycodes[i], 0); input_report_key(data->idev, kbd_keycodes[i], 0);
} }
...@@ -319,7 +322,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev) ...@@ -319,7 +322,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev)
switch (data->wanted_bits) { switch (data->wanted_bits) {
case MCIR2_KEYBOARD_NBITS: case MCIR2_KEYBOARD_NBITS:
scancode = data->body & 0xffff; scancode = data->body & 0xffffff;
dev_dbg(&dev->dev, "keyboard data 0x%08x\n", dev_dbg(&dev->dev, "keyboard data 0x%08x\n",
data->body); data->body);
if (scancode) { if (scancode) {
......
...@@ -51,7 +51,7 @@ static const struct { ...@@ -51,7 +51,7 @@ static const struct {
[RC_PROTO_SANYO] = { .name = "sanyo", [RC_PROTO_SANYO] = { .name = "sanyo",
.scancode_bits = 0x1fffff, .repeat_period = 125 }, .scancode_bits = 0x1fffff, .repeat_period = 125 },
[RC_PROTO_MCIR2_KBD] = { .name = "mcir2-kbd", [RC_PROTO_MCIR2_KBD] = { .name = "mcir2-kbd",
.scancode_bits = 0xffff, .repeat_period = 100 }, .scancode_bits = 0xffffff, .repeat_period = 100 },
[RC_PROTO_MCIR2_MSE] = { .name = "mcir2-mse", [RC_PROTO_MCIR2_MSE] = { .name = "mcir2-mse",
.scancode_bits = 0x1fffff, .repeat_period = 100 }, .scancode_bits = 0x1fffff, .repeat_period = 100 },
[RC_PROTO_RC6_0] = { .name = "rc-6-0", [RC_PROTO_RC6_0] = { .name = "rc-6-0",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment