Skip to contentSkip to conversation

Enabling "extra" scancodes on some Acer laptops

DISCUSSION Carlos Corbacho 3 participants 5 messages Oct 14, 2007 – Dec 11, 2007 HID

lore
Share & tools
lore
#0 lore raw

Dimitry,

Here's an interesting one for you. With a few newer Acer laptops, a problem with some of the extra/ multimedia keys has been cropping up - they don't emit scancodes by default. The solution found was to resurrect an old quirk from acerhk to turn them on (acerhk calls this "enabling dritek keyboard extension"):

/*
* Keyboard controller ports
*/
#define ACER_KBD_STATUS_REG 0x64 /* Status register (R) */
#define ACER_KBD_CNTL_REG 0x64 /* Controller command register (W) */
#define ACER_KBD_DATA_REG 0x60 /* Keyboard data register (R/W) */

/*
* Wait for the keyboard controller to become ready */
static int wait_kbd_write(void)

{
	int i = 0;
	while ((inb(ACER_KBD_STATUS_REG) & 0x02) && (i < 10000)) {
		udelay(50);
		i++;
	}
	return -(i == 10000);
}

static void send_kbd_cmd(u8 cmd, u8 val)

{
	preempt_disable();
	if (!wait_kbd_write())
		outb(cmd, ACER_KBD_CNTL_REG);
	if (!wait_kbd_write())
		outb(val, ACER_KBD_DATA_REG);
	preempt_enable_no_resched();
}

static void set_keyboard_quirk(void)

{
	send_kbd_cmd(0x59, 0x90);
}

After calling set_keyboard_quirk(), the extra keys start generating proper scancodes, and can be mapped as normal via setkeycodes.

At the moment, I've added this quirk to acer_acpi (it's currently only applied on the few systems we know that need it via DMI matching), but I'm not really sure if this is the right place for it as:

1) acer_acpi is still out of tree

2) Does this really belong in acer_acpi (I'm not really sure if it falls under what I'm doing - this seems to border a bit too much on the input tree side), or somewhere further up the input tree (wistron-btns isn't much use here, as the quirk would then be limited to 32 bit only, whereas some of the machines that need this quirk can run a 64 bit kernel)?

-Carlos

Signature · 3 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
#1 lore raw

Hi Carlos,

Quoted 8 lines · Carlos Corbacho

After calling set_keyboard_quirk(), the extra keys start generating proper scancodes, and can be mapped as normal via setkeycodes.

At the moment, I've added this quirk to acer_acpi (it's currently only applied on the few systems we know that need it via DMI matching), but I'm not really sure if this is the right place for it as:

Quoted 8 lines

1) acer_acpi is still out of tree

2) Does this really belong in acer_acpi (I'm not really sure if it falls under what I'm doing - this seems to border a bit too much on the input tree side), or somewhere further up the input tree (wistron-btns isn't much use here, as the quirk would then be limited to 32 bit only, whereas some of the machines that need this quirk can run a 64 bit kernel)?

I think it could be added to i8042 driver to enable it. How messy is detection?

I am also going to apply the patch that exports i8042_command() so it can be used by other modules (Clevo LED driver needs it).

Signature · 1 line
Dmitry
#2 lore raw

Dimitry,

Quoted 2 lines · On Tuesday 16 October 2007 15:37:37 you wrote:

I think it could be added to i8042 driver to enable it. How messy is detection?

I use simple DMI matching in acer_acpi to do this on known broken laptops.

(acerhk calls directly into the BIOS to find this information - but I suspect the data from that could easily be extracted and converted to proper DMI table entries).

These are the the three that I know of (and are supported by acer_acpi) that require this quirk:

static struct dmi_system_id dritek_extension_quirk[] = {
        {
                .callback = dmi_matched,
                .ident = "Acer Aspire 5650",
                .matches = {
                        DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
                        DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
                },
        },
	{
		.callback = dmi_matched,
		.ident = "Acer Aspire 5680",
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
		},
	},
	{
		.callback = dmi_matched,
		.ident = "Acer TravelMate 2490",
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
			DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
		},
	},
	{}
};

-Carlos

Signature · 3 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
#3 lore raw
Quoted 34 lines · Carlos Corbacho

Dimitry,

Quoted 2 lines · On Tuesday 16 October 2007 15:37:37 you wrote:

I think it could be added to i8042 driver to enable it. How messy is detection?

I use simple DMI matching in acer_acpi to do this on known broken laptops.

(acerhk calls directly into the BIOS to find this information - but I suspect the data from that could easily be extracted and converted to proper DMI table entries).

These are the the three that I know of (and are supported by acer_acpi) that require this quirk:

static struct dmi_system_id dritek_extension_quirk[] = {
       {
               .callback = dmi_matched,
               .ident = "Acer Aspire 5650",
               .matches = {
                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
                       DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
               },
       },
       {
               .callback = dmi_matched,
               .ident = "Acer Aspire 5680",
               .matches = {
                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
                       DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
               },
       },
       {
               .callback = dmi_matched,
Quoted 9 lines
               .ident = "Acer TravelMate 2490",
               .matches = {
                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
                       DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
               },
       },
       {}
};

OK, we should be able to add it to i8042 pretty easily.

Signature · 1 line
Dmitry
#4 lore raw
Quoted 26 lines · On Tuesday 16 October 2007 16:52:17 Dmitry Torokhov wrote:
Quoted 23 lines · On Tuesday 16 October 2007 15:37:37 you wrote:
Quoted 2 lines

I think it could be added to i8042 driver to enable it. How messy is detection?

I use simple DMI matching in acer_acpi to do this on known broken laptops.

(acerhk calls directly into the BIOS to find this information - but I suspect the data from that could easily be extracted and converted to proper DMI table entries).

These are the the three that I know of (and are supported by acer_acpi) that require this quirk:

static struct dmi_system_id dritek_extension_quirk[] = {
       {
               .callback = dmi_matched,
               .ident = "Acer Aspire 5650",
               .matches = {
                       DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
                       DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
               },
       },
Quoted 2 lines

[etc...]
};

Quoted 1 line

OK, we should be able to add it to i8042 pretty easily.

Ok, I completely forgot about this thread...

Dmitry - where would be the best place to add this? Put the DMI matching in i8042-x86ia64io.h, and then run the quirk somewhere in i8042.c?

-Carlos

Signature · 3 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D