From: Len Brown <lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Henrique de Moraes Holschuh
<hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
Cc: ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 6/7] ACPI: thinkpad-acpi: dequeue all pending hot key events at once
Date: Thu, 20 Sep 2007 20:42:22 -0400 [thread overview]
Message-ID: <200709202042.22724.lenb@kernel.org> (raw)
In-Reply-To: <11902962613565-git-send-email-hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
On Thursday 20 September 2007 09:50, Henrique de Moraes Holschuh wrote:
> Receive all pending hot key events at once from a single notification, and
> don't complain if the queue is empty.
>
> Signed-off-by: Henrique de Moraes Holschuh <hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
> ---
> drivers/misc/thinkpad_acpi.c | 52 ++++++++++++++++++++++++++++-------------
> 1 files changed, 35 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
> index 9a61140..de415fe 100644
> --- a/drivers/misc/thinkpad_acpi.c
> +++ b/drivers/misc/thinkpad_acpi.c
> @@ -1196,9 +1196,31 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
> {
> u32 hkey;
> unsigned int keycode, scancode;
> - int send_acpi_ev = 0;
> + int send_acpi_ev;
> +
> + if (event != 0x80) {
> + printk(IBM_ERR "unknown hotkey notification event %d\n", event);
> + /* forward it to userspace, maybe it knows how to handle it */
> + acpi_bus_generate_proc_event(ibm->acpi->device, event, 0);
> + acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
> + ibm->acpi->device->dev.bus_id,
> + event, 0);
If this is really an event due to an hotkey (emphasis on the word KEY:-),
why is it being sent via netlink instead of via input?
thanks,
-Len
> + return;
> + }
> +
> + while (1) {
> + if (!acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
> + printk(IBM_ERR "failed to retrieve hot key event\n");
> + return;
> + }
> +
> + if (hkey == 0) {
> + /* queue empty */
> + return;
> + }
> +
> + send_acpi_ev = 0;
>
> - if (event == 0x80 && acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
> switch (hkey >> 12) {
> case 1:
> /* 0x1000-0x1FFF: key presses */
> @@ -1220,8 +1242,8 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
> * eat up known LID events */
> if (hkey != 0x5001 && hkey != 0x5002) {
> printk(IBM_ERR
> - "unknown LID-related hotkey event: 0x%04x\n",
> - hkey);
> + "unknown LID-related hotkey event: 0x%04x\n",
> + hkey);
> send_acpi_ev = 1;
> }
> break;
> @@ -1240,21 +1262,17 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
> printk(IBM_NOTICE "unhandled HKEY event 0x%04x\n", hkey);
> send_acpi_ev = 1;
> }
> - } else {
> - printk(IBM_ERR "unknown hotkey notification event %d\n", event);
> - hkey = 0;
> - send_acpi_ev = 1;
> - }
>
> - /* Legacy events */
> - if (send_acpi_ev || hotkey_report_mode < 2)
> - acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey);
> + /* Legacy events */
> + if (send_acpi_ev || hotkey_report_mode < 2)
> + acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey);
>
> - /* netlink events */
> - if (send_acpi_ev) {
> - acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
> - ibm->acpi->device->dev.bus_id,
> - event, hkey);
> + /* netlink events */
> + if (send_acpi_ev) {
> + acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
> + ibm->acpi->device->dev.bus_id,
> + event, hkey);
> + }
> }
> }
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2007-09-21 0:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-20 13:50 [GIT PATCH] thinkpad-acpi changes for the merge window (part 1) Henrique de Moraes Holschuh
2007-09-20 13:50 ` [PATCH 1/7] ACPI: thinkpad-acpi: make room for more features in tp_features bitfield Henrique de Moraes Holschuh
2007-09-20 13:50 ` [PATCH 2/7] ACPI: thinkpad-acpi: issue EV_SYNC after EV_SWITCH Henrique de Moraes Holschuh
2007-09-20 13:50 ` [PATCH 3/7] ACPI: thinkpad-acpi: add mutex-based locking to input device event send path Henrique de Moraes Holschuh
[not found] ` <11902962603691-git-send-email-hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
2007-09-20 13:50 ` [PATCH 4/7] ACPI: thinkpad-acpi: keep track of module state Henrique de Moraes Holschuh
2007-09-20 13:50 ` [PATCH 5/7] ACPI: thinkpad-acpi: check version of hot key firmware Henrique de Moraes Holschuh
2007-09-20 13:50 ` [PATCH 6/7] ACPI: thinkpad-acpi: dequeue all pending hot key events at once Henrique de Moraes Holschuh
[not found] ` <11902962613565-git-send-email-hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org>
2007-09-21 0:42 ` Len Brown [this message]
[not found] ` <200709202042.22724.lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2007-09-21 13:53 ` Henrique de Moraes Holschuh
2007-09-24 2:33 ` Len Brown
2007-09-20 13:51 ` [PATCH 7/7] ACPI: thinkpad-acpi: fix regression on HKEY LID event handling Henrique de Moraes Holschuh
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=200709202042.22724.lenb@kernel.org \
--to=lenb-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=hmh-N3TV7GIv+o9fyO9Q7EP/yw@public.gmane.org \
--cc=ibm-acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/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 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.