Skip to content

Commit

Permalink
Input: atkbd - add a quirk for OQO 01+ multimedia keys
Browse files Browse the repository at this point in the history
OQO 01+ multimedia keys produce 6x on press, e0 6x upon release.
As a result, Linux thinks that another key has been pressed (or is
repeating), when it is actually a release of the same key. Mangle the
release scancode when running on OQO so that driver recognizes it as
such.

Since the device does not have external PS/2 ports mangling is safe
since there is no chance that an external keyboard is connected.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Jamie Lentin authored and Dmitry Torokhov committed Oct 22, 2009
1 parent 3776989 commit e571306
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions drivers/input/keyboard/atkbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ struct atkbd {
*/
static void (*atkbd_platform_fixup)(struct atkbd *, const void *data);
static void *atkbd_platform_fixup_data;
static unsigned int (*atkbd_platform_scancode_fixup)(struct atkbd *, unsigned int);

static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf,
ssize_t (*handler)(struct atkbd *, char *));
Expand Down Expand Up @@ -393,6 +394,9 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,

input_event(dev, EV_MSC, MSC_RAW, code);

if (atkbd_platform_scancode_fixup)
code = atkbd_platform_scancode_fixup(atkbd, code);

if (atkbd->translated) {

if (atkbd->emul || atkbd_need_xlate(atkbd->xl_bit, code)) {
Expand Down Expand Up @@ -922,6 +926,22 @@ static unsigned int atkbd_volume_forced_release_keys[] = {
0xae, 0xb0, -1U
};

/*
* OQO 01+ multimedia keys (64--66) generate e0 6x upon release whereas
* they should be generating e4-e6 (0x80 | code).
*/
static unsigned int atkbd_oqo_01plus_scancode_fixup(struct atkbd *atkbd,
unsigned int code)
{
if (atkbd->translated && atkbd->emul == 1 &&
(code == 0x64 || code == 0x65 || code == 0x66)) {
atkbd->emul = 0;
code |= 0x80;
}

return code;
}

/*
* atkbd_set_keycode_table() initializes keyboard's keycode table
* according to the selected scancode set
Expand Down Expand Up @@ -1527,6 +1547,13 @@ static int __init atkbd_setup_forced_release(const struct dmi_system_id *id)
return 0;
}

static int __init atkbd_setup_scancode_fixup(const struct dmi_system_id *id)
{
atkbd_platform_scancode_fixup = id->driver_data;

return 0;
}

static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
{
.ident = "Dell Laptop",
Expand Down Expand Up @@ -1663,6 +1690,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
.callback = atkbd_setup_forced_release,
.driver_data = atkdb_soltech_ta12_forced_release_keys,
},
{
.ident = "OQO Model 01+",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
},
.callback = atkbd_setup_scancode_fixup,
.driver_data = atkbd_oqo_01plus_scancode_fixup,
},
{ }
};

Expand Down

0 comments on commit e571306

Please sign in to comment.