* [REPOST] [PATCH] Add support for OQO 01+ multimedia keys (fwd) @ 2009-06-30 22:06 Jamie Lentin 2009-10-20 1:38 ` Dmitry Torokhov 0 siblings, 1 reply; 6+ messages in thread From: Jamie Lentin @ 2009-06-30 22:06 UTC (permalink / raw) To: dmitry.torokhov; +Cc: linux-input Apologies for reposting, but it'd be nice to get something along these lines merged. If there's suggestions of other things I could try, or you'd prefer a patch to make the "up" and "down" keycodes auto-release, please let me know. Many thanks, ---------- Forwarded message ---------- Date: Thu, 30 Apr 2009 22:35:51 +0100 (BST) From: Jamie Lentin <jm@lentin.co.uk> To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org Subject: [PATCH] Add support for OQO 01+ multimedia keys 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. Remap e0 6x to a release of 6x. Signed-off-by: Jamie Lentin <jm@lentin.co.uk> --- Comments welcome---I'm rather aware that I'm adding a fair chunk of extra code for 3 keys on a fairly obscure device and that my C is rusty to say the least, but I thought I'd give it a go anyway. If there are major objections to this, my fallback plan is to make both 6x and e0 6x auto-release, which may in fact be preferred. If I've missed something really obvious please point it out :) drivers/input/keyboard/atkbd.c | 41 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 1 deletions(-) diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 444dec0..ecf9e9d 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -227,10 +227,12 @@ struct atkbd { }; /* - * System-specific ketymap fixup routine + * System-specific keymap fixup routine */ static void (*atkbd_platform_fixup)(struct atkbd *, const void *data); static void *atkbd_platform_fixup_data; +static unsigned int (*atkbd_platform_fixup_function)(struct atkbd *, + unsigned int); static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, ssize_t (*handler)(struct atkbd *, char *)); @@ -431,6 +433,12 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, code = atkbd_compat_scancode(atkbd, code); + /* + * Perform platform-specific fixups + */ + if (unlikely(atkbd_platform_fixup_function)) + code = atkbd_platform_fixup_function(atkbd, code); + if (atkbd->emul && --atkbd->emul) goto out; @@ -895,6 +903,21 @@ static unsigned int atkbd_amilo_pa1510_forced_release_keys[] = { }; /* + * OQO 01+ multimedia keys (64--66), say e0 6x when they mean f0 6x, i.e. upon + * release. Remap e4--e6 (from compat_scancode) to a release of 64--66. + */ +static unsigned int atkbd_oqo_01plus_remap_release_keys(struct atkbd *atkbd, + unsigned int code) +{ + if (code == 0xe4 || code == 0xe5 || code == 0xe6) { + atkbd->release = 1; + code &= 0x7f; + } + + return code; +} + +/* * atkbd_set_keycode_table() initializes keyboard's keycode table * according to the selected scancode set */ @@ -1478,6 +1501,13 @@ static int __init atkbd_setup_forced_release(const struct dmi_system_id *id) return 0; } +static int __init atkbd_setup_inline_fix(const struct dmi_system_id *id) +{ + atkbd_platform_fixup_function = id->driver_data; + + return 0; +} + static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { { .ident = "Dell Laptop", @@ -1560,6 +1590,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = { .callback = atkbd_setup_forced_release, .driver_data = atkbd_amilo_pa1510_forced_release_keys, }, + { + .ident = "OQO Model 01+", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "OQO"), + DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"), + }, + .callback = atkbd_setup_inline_fix, + .driver_data = atkbd_oqo_01plus_remap_release_keys, + }, { } }; -- 1.6.2.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [REPOST] [PATCH] Add support for OQO 01+ multimedia keys (fwd) 2009-06-30 22:06 [REPOST] [PATCH] Add support for OQO 01+ multimedia keys (fwd) Jamie Lentin @ 2009-10-20 1:38 ` Dmitry Torokhov 2009-10-20 20:12 ` Jamie Lentin 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Torokhov @ 2009-10-20 1:38 UTC (permalink / raw) To: Jamie Lentin; +Cc: linux-input Hi Jamie, On Tue, Jun 30, 2009 at 11:06:49PM +0100, Jamie Lentin wrote: > Apologies for reposting, but it'd be nice to get something along these > lines merged. If there's suggestions of other things I could try, or > you'd prefer a patch to make the "up" and "down" keycodes auto-release, > please let me know. > I am sorry, I completely missed your patch and just now was going through my inbox and saw it... Could you please tell me if OQO has external PS/2 port? And also if you could give me the raw data stream from these keys (reported with i8042.debug) that would be grand. Plus, who is the keyboard identified in dmesg? Is it "AT Translated Set 2" or 'AT Raw set 2"? Thanks! -- Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [REPOST] [PATCH] Add support for OQO 01+ multimedia keys (fwd) 2009-10-20 1:38 ` Dmitry Torokhov @ 2009-10-20 20:12 ` Jamie Lentin 2009-10-21 4:49 ` Dmitry Torokhov 0 siblings, 1 reply; 6+ messages in thread From: Jamie Lentin @ 2009-10-20 20:12 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input On Mon, 19 Oct 2009, Dmitry Torokhov wrote: > On Tue, Jun 30, 2009 at 11:06:49PM +0100, Jamie Lentin wrote: >> Apologies for reposting, but it'd be nice to get something along these >> lines merged. If there's suggestions of other things I could try, or >> you'd prefer a patch to make the "up" and "down" keycodes auto-release, >> please let me know. >> > > I am sorry, I completely missed your patch and just now was going > through my inbox and saw it... Not to worry---so long as the patch wasn't so offensive you couldn't bring yourself to reply :) > Could you please tell me if OQO has external PS/2 port? No, it has a PS/2 trackpoint and gravity mouse (easter-egg mode where the firmware turns accelerometer input into mouse) built-in, but I doubt they'll provide much useful info. > And also if you could give me the raw data stream from these keys > (reported with i8042.debug) that would be grand. Using a vanilla linux-2.6.31.1, this is the output from both i8042.debug and evtest when holding keys momentarily. NB: I've applied a map to change the "multimedia" keycodes to be something useful, but that's probably not relevant. Every other key works as you'd expect. # Video -- down/up separate keys drivers/input/serio/i8042.c: 66 <- i8042 (interrupt, 0, 1) [85408] drivers/input/serio/i8042.c: 66 <- i8042 (interrupt, 0, 1) [85478] drivers/input/serio/i8042.c: 66 <- i8042 (interrupt, 0, 1) [85487] drivers/input/serio/i8042.c: 66 <- i8042 (interrupt, 0, 1) [85496] drivers/input/serio/i8042.c: 66 <- i8042 (interrupt, 0, 1) [85505] drivers/input/serio/i8042.c: 66 <- i8042 (interrupt, 0, 1) [85513] drivers/input/serio/i8042.c: e0 <- i8042 (interrupt, 0, 1) [85518] drivers/input/serio/i8042.c: 66 <- i8042 (interrupt, 0, 1) [85518] Event: time 1256067968.926933, type 4 (Misc), code 4 (ScanCode), value 66 Event: time 1256067968.927715, type 1 (Key), code 227 (?), value 2 Event: time 1256067968.927848, -------------- Report Sync ------------ Event: time 1256067969.110362, type 4 (Misc), code 4 (ScanCode), value e6 Event: time 1256067969.110613, type 1 (Key), code 360 (Vendor), value 2 Event: time 1256067969.110704, -------------- Report Sync ------------ # Mute -- down/up separate keys drivers/input/serio/i8042.c: 65 <- i8042 (interrupt, 0, 1) [94782] drivers/input/serio/i8042.c: 65 <- i8042 (interrupt, 0, 1) [94852] drivers/input/serio/i8042.c: 65 <- i8042 (interrupt, 0, 1) [94861] drivers/input/serio/i8042.c: 65 <- i8042 (interrupt, 0, 1) [94870] drivers/input/serio/i8042.c: 65 <- i8042 (interrupt, 0, 1) [94878] drivers/input/serio/i8042.c: 65 <- i8042 (interrupt, 0, 1) [94887] drivers/input/serio/i8042.c: 65 <- i8042 (interrupt, 0, 1) [94896] drivers/input/serio/i8042.c: 65 <- i8042 (interrupt, 0, 1) [94907] drivers/input/serio/i8042.c: 65 <- i8042 (interrupt, 0, 1) [94916] drivers/input/serio/i8042.c: e0 <- i8042 (interrupt, 0, 1) [94920] drivers/input/serio/i8042.c: 65 <- i8042 (interrupt, 0, 1) [94920] Event: time 1256068003.897484, type 4 (Misc), code 4 (ScanCode), value 65 Event: time 1256068003.897784, type 1 (Key), code 113 (Mute), value 2 Event: time 1256068003.897877, -------------- Report Sync ------------ Event: time 1256068003.906448, type 4 (Misc), code 4 (ScanCode), value e5 Event: time 1256068003.906745, type 1 (Key), code 360 (Vendor), value 2 Event: time 1256068003.906860, -------------- Report Sync ------------ # WiFi -- down/up separate keys drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100145] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100215] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100223] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100232] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100241] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100250] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100258] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100269] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100278] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100287] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100296] drivers/input/serio/i8042.c: e0 <- i8042 (interrupt, 0, 1) [100304] drivers/input/serio/i8042.c: 64 <- i8042 (interrupt, 0, 1) [100304] Event: time 1256068069.298454, type 4 (Misc), code 4 (ScanCode), value 64 Event: time 1256068069.298664, type 1 (Key), code 226 (Media), value 2 Event: time 1256068069.298756, -------------- Report Sync ------------ Event: time 1256068069.509059, type 4 (Misc), code 4 (ScanCode), value e4 Event: time 1256068069.509274, type 1 (Key), code 360 (Vendor), value 2 Event: time 1256068069.509370, -------------- Report Sync ------------ > Plus, who is the keyboard identified > in dmesg? Is it "AT Translated Set 2" or 'AT Raw set 2"? PNP: PS/2 Controller [PNP0303:KBC,PNP0f13:PS2M] at 0x60,0x64 irq 1,12 serio: i8042 KBD port at 0x60,0x64 irq 1 serio: i8042 AUX port at 0x60,0x64 irq 12 mice: PS/2 mouse device common for all mice input: PC Speaker as /devices/platform/pcspkr/input/input0 input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1 [ An entire (albeit old) log here: http://jamie.lentin.co.uk/hardware/oqo_01plus/dmesg.txt ] I did try forcing the keyboard into raw set 2 and set 3, however it seemed to ignore the command---keypresses were still sent as translated set 2, and Linux couldn't interpret the keypresses anymore since it was expecting raw. I've lost the notes on how I did this and the resulting dumps, but can try again if it's interesting. > > Thanks! > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [REPOST] [PATCH] Add support for OQO 01+ multimedia keys (fwd) 2009-10-20 20:12 ` Jamie Lentin @ 2009-10-21 4:49 ` Dmitry Torokhov 2009-10-21 18:15 ` Jamie Lentin 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Torokhov @ 2009-10-21 4:49 UTC (permalink / raw) To: Jamie Lentin; +Cc: linux-input On Tue, Oct 20, 2009 at 09:12:38PM +0100, Jamie Lentin wrote: > On Mon, 19 Oct 2009, Dmitry Torokhov wrote: > >> On Tue, Jun 30, 2009 at 11:06:49PM +0100, Jamie Lentin wrote: >>> Apologies for reposting, but it'd be nice to get something along these >>> lines merged. If there's suggestions of other things I could try, or >>> you'd prefer a patch to make the "up" and "down" keycodes auto-release, >>> please let me know. >>> >> >> I am sorry, I completely missed your patch and just now was going >> through my inbox and saw it... > > Not to worry---so long as the patch wasn't so offensive you couldn't bring > yourself to reply :) ;) > >> Could you please tell me if OQO has external PS/2 port? > > No, it has a PS/2 trackpoint and gravity mouse (easter-egg mode where the > firmware turns accelerometer input into mouse) built-in, but I doubt > they'll provide much useful info. > OK, I was just concerned about the scancode mangling screwing up external keyboard but in absence of PS/2 ports this point is moot. I rearranged the code a bit, could yo please try it out to make sure I did not screw it up and I will apply it. Thanks! -- Dmitry Input: Add support for OQO 01+ multimedia keys (fwd) From: Jamie Lentin <jamie@lentin.co.uk> 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> --- drivers/input/keyboard/atkbd.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index a651237..4452eab 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -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 *)); @@ -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)) { @@ -923,6 +927,22 @@ static unsigned int atkbd_volume_forced_release_keys[] = { }; /* + * 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 */ @@ -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", @@ -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, + }, { } }; ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [REPOST] [PATCH] Add support for OQO 01+ multimedia keys (fwd) 2009-10-21 4:49 ` Dmitry Torokhov @ 2009-10-21 18:15 ` Jamie Lentin 2009-10-22 6:52 ` Dmitry Torokhov 0 siblings, 1 reply; 6+ messages in thread From: Jamie Lentin @ 2009-10-21 18:15 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: linux-input On Tue, 20 Oct 2009, Dmitry Torokhov wrote: > On Tue, Oct 20, 2009 at 09:12:38PM +0100, Jamie Lentin wrote: >> On Mon, 19 Oct 2009, Dmitry Torokhov wrote: >> >>> On Tue, Jun 30, 2009 at 11:06:49PM +0100, Jamie Lentin wrote: >>>> Apologies for reposting, but it'd be nice to get something along these >>>> lines merged. If there's suggestions of other things I could try, or >>>> you'd prefer a patch to make the "up" and "down" keycodes auto-release, >>>> please let me know. >>>> >>> >>> I am sorry, I completely missed your patch and just now was going >>> through my inbox and saw it... >> >> Not to worry---so long as the patch wasn't so offensive you couldn't bring >> yourself to reply :) > > ;) > >> >>> Could you please tell me if OQO has external PS/2 port? >> >> No, it has a PS/2 trackpoint and gravity mouse (easter-egg mode where the >> firmware turns accelerometer input into mouse) built-in, but I doubt >> they'll provide much useful info. >> > > OK, I was just concerned about the scancode mangling screwing up > external keyboard but in absence of PS/2 ports this point is moot. > > I rearranged the code a bit, could yo please try it out to make sure I > did not screw it up and I will apply it. Tried it, works fine. Applying this would be much appreciated! Thankyou for all your work. > > Thanks! > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [REPOST] [PATCH] Add support for OQO 01+ multimedia keys (fwd) 2009-10-21 18:15 ` Jamie Lentin @ 2009-10-22 6:52 ` Dmitry Torokhov 0 siblings, 0 replies; 6+ messages in thread From: Dmitry Torokhov @ 2009-10-22 6:52 UTC (permalink / raw) To: Jamie Lentin; +Cc: linux-input On Wed, Oct 21, 2009 at 07:15:54PM +0100, Jamie Lentin wrote: > On Tue, 20 Oct 2009, Dmitry Torokhov wrote: >> On Tue, Oct 20, 2009 at 09:12:38PM +0100, Jamie Lentin wrote: >>> On Mon, 19 Oct 2009, Dmitry Torokhov wrote: >>> >>>> On Tue, Jun 30, 2009 at 11:06:49PM +0100, Jamie Lentin wrote: >>>>> Apologies for reposting, but it'd be nice to get something along these >>>>> lines merged. If there's suggestions of other things I could try, or >>>>> you'd prefer a patch to make the "up" and "down" keycodes auto-release, >>>>> please let me know. >>>>> >>>> >>>> I am sorry, I completely missed your patch and just now was going >>>> through my inbox and saw it... >>> >>> Not to worry---so long as the patch wasn't so offensive you couldn't bring >>> yourself to reply :) >> >> ;) >> >>> >>>> Could you please tell me if OQO has external PS/2 port? >>> >>> No, it has a PS/2 trackpoint and gravity mouse (easter-egg mode where the >>> firmware turns accelerometer input into mouse) built-in, but I doubt >>> they'll provide much useful info. >>> >> >> OK, I was just concerned about the scancode mangling screwing up >> external keyboard but in absence of PS/2 ports this point is moot. >> >> I rearranged the code a bit, could yo please try it out to make sure I >> did not screw it up and I will apply it. > > Tried it, works fine. Applying this would be much appreciated! > Applied, thank you Jamie. it will be in mainline next time Linus pulls from my tree. -- Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-10-22 6:52 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-06-30 22:06 [REPOST] [PATCH] Add support for OQO 01+ multimedia keys (fwd) Jamie Lentin 2009-10-20 1:38 ` Dmitry Torokhov 2009-10-20 20:12 ` Jamie Lentin 2009-10-21 4:49 ` Dmitry Torokhov 2009-10-21 18:15 ` Jamie Lentin 2009-10-22 6:52 ` Dmitry Torokhov
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.