linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Joey Lee <jlee@novell.com>
Cc: corentin.chary@gmail.com, Takashi Iwai <tiwai@novell.com>,
	Thomas Renninger <trenn@novell.com>,
	mjg59@srcf.ucam.org, carlos@strangeworlds.co.uk, jbenc@suse.cz,
	linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 1/3] Add acer wmi hotkey events support
Date: Mon, 18 Oct 2010 01:12:18 -0700	[thread overview]
Message-ID: <20101018081218.GA8655@core.coreip.homeip.net> (raw)
In-Reply-To: <4CBC6D60020000230002205C@novprvlin0050.provo.novell.com>

On Sun, Oct 17, 2010 at 10:53:04PM -0600, Joey Lee wrote:
> Hi Dmitry, 
> 
> 於 三,2010-10-13 於 11:24 -0700,Dmitry Torokhov 提到:
> > Hi Joey,
> > 
> > On Wed, Oct 13, 2010 at 11:47:40AM +0800, Lee, Chun-Yi wrote:
> >  +
> > > +	status = wmi_install_notify_handler(ACERWMID_EVENT_GUID,
> > > +						acer_wmi_notify, NULL);
> > > +	if (ACPI_FAILURE(status)) {
> > > +		err = -EIO;
> > > +		goto err_unregister_input;
> > > +	}
> > > +
> > > +	return 0;
> > > +
> > > +err_unregister_input:
> > > +	input_unregister_device(acer_wmi_input_dev);
> > > +err_free_keymap:
> > > +	sparse_keymap_free(acer_wmi_input_dev);
> > > +err_free_dev:
> > > +	input_free_device(acer_wmi_input_dev);
> > 
> > If wmi_install_notify_handler() fails you'll end up doing
> > input_unregister_device() + input_free_device() which is forbidden. To
> > avoid this issue register the device after installing the handler. As
> > long as input device is properly allocated (by calling
> > input_allocate_device) it is safe to use it to send events (although
> > they will not go anywhere).
> > 
> > BTW, I think it is high time we allocate a dedicated key for touchpad
> > on/off....
> > 
> 
> Thank's for your review.
> I changed the error handler priority:
> 
> >From 9e31867c348a1f2119d16ddbcf9cf0b7de111cf9 Mon Sep 17 00:00:00 2001
> From: Lee, Chun-Yi <jlee@novell.com>
> Date: Mon, 18 Oct 2010 12:12:49 +0800
> Subject: [PATCH 1/3] Add acer wmi hotkey events support
> 
> Add acer wmi hotkey event support. Install a wmi notify handler to
> transfer wmi event key to key code, then send out keycode through acer
> wmi input device to userland.
> 
> Signed-off-by: Lee, Chun-Yi <jlee@novell.com>

Looks good to me, thank you for making changes.

>  
> @@ -48,6 +50,7 @@ MODULE_LICENSE("GPL");
>  #define ACER_ERR KERN_ERR ACER_LOGPREFIX
>  #define ACER_NOTICE KERN_NOTICE ACER_LOGPREFIX
>  #define ACER_INFO KERN_INFO ACER_LOGPREFIX
> +#define ACER_WARNING KERN_WARNING ACER_LOGPREFIX
>  

As a separate change could you please move the driver to using pr_err()
and friends?

>  /*
>   * Magic Number
> @@ -83,8 +86,39 @@ MODULE_LICENSE("GPL");
>  #define WMID_GUID1		"6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3"
>  #define WMID_GUID2		"95764E09-FB56-4e83-B31A-37761F60994A"
>  
> +/*
> + * Acer ACPI event GUIDs
> + */
> +#define ACERWMID_EVENT_GUID "676AA15E-6A47-4D9F-A2CC-1E6D18D14026"
> +
>  MODULE_ALIAS("wmi:67C3371D-95A3-4C37-BB61-DD47B491DAAB");
>  MODULE_ALIAS("wmi:6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3");
> +MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026");
> +
> +enum acer_wmi_event_ids {
> +	WMID_HOTKEY_EVENT = 0x1,
> +};
> +
> +static const struct key_entry acer_wmi_keymap[] = {
> +	{KE_KEY, 0x01, {KEY_WLAN} },     /* WiFi */
> +	{KE_KEY, 0x12, {KEY_BLUETOOTH} },	/* BT */
> +	{KE_KEY, 0x21, {KEY_PROG1} },    /* Backup */
> +	{KE_KEY, 0x22, {KEY_PROG2} },    /* Aracade */
> +	{KE_KEY, 0x23, {KEY_PROG3} },    /* P_Key */
> +	{KE_KEY, 0x24, {KEY_PROG4} },    /* Social networking_Key */
> +	{KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} },	/* Display Switch */
> +	{KE_KEY, 0x82, {KEY_F22} },      /* Touch Pad On/Off */

We need to standardize this. Some people use F13/F14, here we have
F22...

-- 
Dmitry

  reply	other threads:[~2010-10-18  8:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18  4:53 [PATCH 1/3] Add acer wmi hotkey events support Joey Lee
2010-10-18  8:12 ` Dmitry Torokhov [this message]
2010-10-18  8:19   ` Corentin Chary
2010-10-18  8:25     ` Dmitry Torokhov
2010-10-18  8:47       ` Corentin Chary
2010-10-18  9:26         ` Takashi Iwai
2010-10-18  9:23     ` Matthew Garrett
2010-10-18 23:48       ` Dmitry Torokhov
  -- strict thread matches above, loose matches on Subject: below --
2010-10-19  9:43 Joey Lee
2010-10-19 15:53 ` Dmitry Torokhov
2010-10-19  9:35 Joey Lee
2010-10-19  9:31 Joey Lee
2010-10-13  3:47 Lee, Chun-Yi
2010-10-13 18:24 ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101018081218.GA8655@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=carlos@strangeworlds.co.uk \
    --cc=corentin.chary@gmail.com \
    --cc=jbenc@suse.cz \
    --cc=jlee@novell.com \
    --cc=linux-input@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=tiwai@novell.com \
    --cc=trenn@novell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).