linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor@insightbb.com>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Richard Hughes <hughsient@gmail.com>,
	linux-acpi@vger.kernel.org, linux-input@atrey.karlin.mff.cuni.cz,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: document the proper usage of EV_KEY and KEY_UNKNOWN (v2)
Date: Fri, 29 Jun 2007 01:04:52 -0400	[thread overview]
Message-ID: <200706290104.53909.dtor@insightbb.com> (raw)
In-Reply-To: <20070606165509.GB18984@khazad-dum.debian.net>

Hi Henrique,

On Wednesday 06 June 2007 12:55, Henrique de Moraes Holschuh wrote:
> We have most of the pieces needed to have sane, generic userland keyboard
> handling in place for a while now, but it is not sufficiently documented.
> 
> This patch documents the requirements and best practices for EV_KEY input
> drivers.
> 
> Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: Richard Hughes <hughsient@gmail.com>
> ---
> 
>  I have changed the KEY_UNKNOWN preference over positional keycodes around,
>  and also added a small paragraph on the expected behaviour of userland
>  applications re. EV_MSC MSC_SCAN events.
> 
>  Comments?

Finally gottent to the patch. It seems a little long-winded, how about
the patch below instead?

-- 
Dmitry

Subject: Input: document the proper usage of EV_KEY and KEY_UNKNOWN
From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>


We have most of the pieces needed to have sane, generic userland keyboard
handling in place for a while now, but it is not sufficiently documented.

This patch documents the requirements and best practices for EV_KEY input
drivers.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 Documentation/input/input-programming.txt |   36 ++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

Index: work/Documentation/input/input-programming.txt
===================================================================
--- work.orig/Documentation/input/input-programming.txt
+++ work/Documentation/input/input-programming.txt
@@ -263,7 +263,38 @@ getkeycode() and setkeycode() callbacks 
 keycode/keycodesize/keycodemax mapping mechanism provided by input core
 and implement sparse keycode maps.
 
-1.8 Key autorepeat
+1.8 Keymaps and KEY_UNKNOWN
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Follow these rules when creating a default keymap for an input device:
+
+- If a key has a specific function that is known to the driver, it should
+  generate keycode corresponding to that function. FOr example, in a laptop
+  where FN+F1 key combination is always marked "HELP" the driver should
+  generate KEY_HELP and not KEY_FN_F1.
+
+- If a positional keycode for a key already exists in input.h (e.g. KEY_FN_F1
+  for FN+F1), it should be used instead of KEY_UNKNOWN. When such a code
+  doesn't exist KEY_UNKNOWN should be used.
+
+- Non-positional keycodes like KEY_PROG1 should be avoided.
+
+Input drivers that generate EV_KEY events should always support either
+dev->getkeycode()/dev->setkeycode(), or keycode, keycodemax and keycodesize
+methods of reprogramming their keymaps. Drivers that do not allow changing
+keycode map should not genrate KEY_UNKNOWN events.
+
+In addition to EV_KEY events drivers should also generate EV_MSC/MSC_SCAN
+events. This event provides assistance to a generic userspace keyboard helper
+in remapping keys and assigning them specific function.
+
+MSC_SCAN event should be sent in the same event block (marked by
+EV_SYN/SYN_REPORT event) as corresponding EV_KEY event. The scan code
+reported must be a valid index in the keycode map, as implemented by
+dev->getkeycode()/dev->setkeycode(), or keycode, keycodemax and keycodesize
+for the device.
+
+1.9 Key autorepeat
 ~~~~~~~~~~~~~~~~~~
 
 ... is simple. It is handled by the input.c module. Hardware autorepeat is
@@ -272,7 +303,8 @@ present, it is broken sometimes (at keyb
 autorepeat for your device, just set EV_REP in dev->evbit. All will be
 handled by the input system.
 
-1.9 Other event types, handling output events
+
+1.10 Other event types, handling output events
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 The other event types up to now are:

  reply	other threads:[~2007-06-29  5:04 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <11802004861625-git-send-email-hmh@hmh.eng.br>
     [not found] ` <11802006651698-git-send-email-hmh@hmh.eng.br>
     [not found]   ` <11802006652128-git-send-email-hmh@hmh.eng.br>
     [not found]     ` <11802006652058-git-send-email-hmh@hmh.eng.br>
2007-05-26 17:31       ` [PATCH] ACPI: thinkpad-acpi: add thinkpad keys to input.h Henrique de Moraes Holschuh
2007-05-27  3:40         ` Dmitry Torokhov
2007-05-27 12:15           ` Henrique de Moraes Holschuh
2007-05-27 18:10             ` Henrique de Moraes Holschuh
     [not found]             ` <20070527121513.GC19562-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2007-05-29  3:16               ` Dmitry Torokhov
     [not found]                 ` <200705282316.32173.dtor-xOqKmqBdiMhF6kxbq+BtvQ@public.gmane.org>
2007-05-29 13:05                   ` Henrique de Moraes Holschuh
2007-05-30 13:57                     ` Dmitry Torokhov
2007-05-30 14:04                       ` Matthew Garrett
2007-05-30 14:18                         ` Dmitry Torokhov
2007-05-30 14:25                           ` Matthew Garrett
2007-05-30 14:31                             ` Dmitry Torokhov
2007-05-30 14:42                               ` Matthew Garrett
2007-05-30 15:07                           ` Henrique de Moraes Holschuh
2007-05-30 15:24                       ` Henrique de Moraes Holschuh
2007-05-30 16:04                         ` Dmitry Torokhov
2007-05-30 17:24                           ` Henrique de Moraes Holschuh
2007-05-30 20:25                             ` Dmitry Torokhov
2007-05-30 23:01                               ` [ibm-acpi-devel] " Matthew Garrett
2007-05-31  0:53                               ` Making KEY_UNKNOWN really useful to userland Henrique de Moraes Holschuh
2007-05-31  4:33                                 ` Dmitry Torokhov
2007-05-31 22:28                                   ` [PATCH] Input: document the proper usage of EV_KEY and KEY_UNKNOWN Henrique de Moraes Holschuh
2007-05-31 23:33                                     ` Matthew Garrett
2007-06-01  0:13                                       ` Henrique de Moraes Holschuh
2007-06-01  0:24                                         ` Matthew Garrett
2007-06-01  1:29                                           ` Henrique de Moraes Holschuh
2007-06-01  1:44                                             ` Matthew Garrett
2007-06-01  2:11                                               ` Henrique de Moraes Holschuh
2007-06-01  3:33                                               ` Dmitry Torokhov
2007-06-01  4:08                                                 ` Matthew Garrett
2007-06-01  4:37                                                   ` Dmitry Torokhov
2007-06-01 13:13                                                     ` Matthew Garrett
2007-06-01 14:04                                                       ` Dmitry Torokhov
2007-06-01 14:19                                                         ` Matthew Garrett
2007-06-01 15:06                                                         ` Henrique de Moraes Holschuh
2007-06-01 15:21                                                           ` Dmitry Torokhov
2007-06-01 14:51                                                       ` Henrique de Moraes Holschuh
2007-06-01 14:19                                                   ` Henrique de Moraes Holschuh
2007-06-20 10:21                                                     ` Helge Hafting
2007-06-06 16:55                                     ` [PATCH] Input: document the proper usage of EV_KEY and KEY_UNKNOWN (v2) Henrique de Moraes Holschuh
2007-06-29  5:04                                       ` Dmitry Torokhov [this message]
2007-06-30 18:20                                         ` Henrique de Moraes Holschuh
     [not found]                                 ` <20070531005305.GC6883-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2007-05-31 10:37                                   ` Making KEY_UNKNOWN really useful to userland Richard Hughes
2007-05-31 12:48                                     ` Henrique de Moraes Holschuh
2007-05-31 14:37                                       ` 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=200706290104.53909.dtor@insightbb.com \
    --to=dtor@insightbb.com \
    --cc=hmh@hmh.eng.br \
    --cc=hughsient@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-kernel@vger.kernel.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 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).