[PATCH 2/3] UBUNTU: SAUCE: Add WMI hotkeys support for Dell All-In-One series

Matthew Garrett mjg59 at srcf.ucam.org
Sat Nov 27 19:27:44 GMT 2010


On Fri, Nov 19, 2010 at 07:16:46PM +0000, Colin King wrote:
> +#define EVENT_GUID	"284A0E6B-380E-472A-921F-E52786257FB4"
> +
> +MODULE_ALIAS("wmi:"EVENT_GUID);
> +
> +/* Temporary workaround until the WMI sysfs interface goes in.
> +   Borrowed from acer-wmi */
> +MODULE_ALIAS("dmi:*:*Dell*:*:");

The WMI sysfs interface is present. Do you really need this?

> +struct key_entry {
> +	char type;		/* See KE_* below */
> +	u16 code;
> +	u16 keycode;
> +};
> +
> +enum { KE_KEY, KE_SW, KE_IGNORE, KE_END };
>
> +/*
> + * Certain keys are flagged as KE_IGNORE. All of these are either
> + * notifications (rather than requests for change) or are also sent
> + * via the keyboard controller so should not be sent again.
> + */

No they're not :)

> +static struct key_entry dell_wmi_aio_keymap[] = {
> +	{ KE_KEY, 0xc0, KEY_VOLUMEUP },
> +	{ KE_KEY, 0xc1, KEY_VOLUMEDOWN },
> +	{ KE_END, 0 }
> +};

You ought to use sparse keymaps here. They'll let you get rid of a lot 
of this boilerplate.

> +		case KE_SW:
> +			set_bit(EV_SW, dell_wmi_aio_input_dev->evbit);
> +			set_bit(key->keycode, dell_wmi_aio_input_dev->swbit);
> +			break;

There aren't any switches, and there's no interface to add one.

-- 
Matthew Garrett | mjg59 at srcf.ucam.org



More information about the kernel-team mailing list