From: Johannes Stezenbach <js@sig21.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: udev keymaps: support for force_release quirk
Date: Sun, 06 Dec 2009 21:49:58 +0000 [thread overview]
Message-ID: <20091206214958.GA5912@sig21.net> (raw)
In-Reply-To: <20091126173912.GA25185@sig21.net>
Hi,
On Wed, Dec 02, 2009 at 07:12:51PM -0800, Dmitry Torokhov wrote:
>
> Yes, I would go with separate utilities and separate maps. They are
> conceptually different, work on different devices and map is not
> necessarily the same. It will be much cleaner this way.
Below is a version that seems to work, not yet tested thouroughly
but I wanted to find out if I'm on the right track.
There are two issues:
- I used shell arithmetic expansion to convert from hex to dec
(works with busybox ash, dash and bash, but not guaranteed by POSIX).
Is it OK? Or should I use bc or rewrite as awk script?
- I hardcoded /lib/udev/keymaps/ path, probably needs LIBEXEC
substition by autoconf
Let me know what you think.
Thanks
Johannes
From efa08417aa9487dbc4d5381aeff4892b1321f29b Mon Sep 17 00:00:00 2001
From: Johannes Stezenbach <js@sig21.net>
Date: Sun, 6 Dec 2009 22:28:28 +0100
Subject: [PATCH 1/1] Add support for the atkbd force_release quirk.
Some laptop keyboards don't generate release events
for some hotkeys. Since linux-2.6.32 the list of scancodes
for which to enable the force_release quirk can be set
via sysfs.
Apply this to Samsung N130.
Signed-off-by: Johannes Stezenbach <js@sig21.net>
---
| 24 +++++++++++++++++++++
| 22 +++++++++++++++++++
| 10 ++++++++
3 files changed, 56 insertions(+), 0 deletions(-)
create mode 100644 extras/keymap/95-keyboard-force-release.rules
create mode 100644 extras/keymap/keyboard-force-release.sh
create mode 100644 extras/keymap/keymaps/samsung-other-force-release
--git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules
new file mode 100644
index 0000000..f231af9
--- /dev/null
+++ b/extras/keymap/95-keyboard-force-release.rules
@@ -0,0 +1,24 @@
+# Set model specific atkbd force_release quirk
+#
+# Serveral laptops have hotkeys which don't generate release events,
+# which can cause problems with software key repeat.
+# The atkbd driver has a quirk handler for generating synthetic
+# release events, which can be configured via sysfs since 2.6.32.
+# Simply add a file with a list of scancodes for your laptop model
+# in /lib/udev/keymaps, and add a rule here.
+# If the hotkeys also need a keymap assignment you can copy the
+# scancodes from the keymap file, otherwise you can run
+# /lib/udev/keymap -i /dev/input/eventX
+# on a Linux vt to find out.
+
+ACTION!="add", GOTO="force_release_end"
+SUBSYSTEM!="serio", GOTO="force_release_end"
+KERNEL!="serio*", GOTO="force_release_end"
+DRIVER!="atkbd", GOTO="force_release_end"
+
+ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}"
+
+
+ENV{DMI_VENDOR}="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}="*N130*", RUN+="keyboard-force-release.sh $sys$devpath samsung-other-force-release"
+
+LABEL="force_release_end"
--git a/extras/keymap/keyboard-force-release.sh b/extras/keymap/keyboard-force-release.sh
new file mode 100644
index 0000000..c76ef42
--- /dev/null
+++ b/extras/keymap/keyboard-force-release.sh
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+# read list of scancodes, convert hex to decimal and
+# append to the atkbd force_release sysfs attribute
+# $1 sysfs devpath for serioX
+# $2 file with scancode list (hex or dec)
+
+case "$2" in
+ /*) scf="$2" ;;
+ *) scf="/lib/udev/keymaps/$2" ;;
+esac
+
+attr=`cat "$1/force_release"`
+while read scancode dummy; do
+ case "$scancode" in
+ \#*) ;;
+ *)
+ scancode=$(($scancode))
+ [ -n "$attr" ] && attr="$attr,$scancode" || attr="$scancode"
+ ;;
+ esac
+done <"$scf"
+echo "$attr" >"$1/force_release"
--git a/extras/keymap/keymaps/samsung-other-force-release b/extras/keymap/keymaps/samsung-other-force-release
new file mode 100644
index 0000000..c51123a
--- /dev/null
+++ b/extras/keymap/keymaps/samsung-other-force-release
@@ -0,0 +1,10 @@
+# list of scancodes (hex or decimal), optional comment
+0x82 # Fn+F4 CRT/LCD
+0x83 # Fn+F2 battery
+0x84 # Fn+F5 backlight on/off
+0x86 # Fn+F9 WLAN
+0x88 # Fn-Up brightness up
+0x89 # Fn-Down brightness down
+0xB3 # Fn+F8 switch power mode (battery/dynamic/performance)
+0xF7 # Fn+F10 Touchpad on
+0xF9 # Fn+F10 Touchpad off
--
1.6.5.4
prev parent reply other threads:[~2009-12-06 21:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-26 17:39 udev keymaps: support for force_release quirk Johannes Stezenbach
2009-11-27 15:33 ` Martin Pitt
2009-11-27 15:48 ` Johannes Stezenbach
2009-11-27 15:57 ` Martin Pitt
2009-11-28 19:14 ` Greg KH
2009-11-28 21:36 ` Johannes Stezenbach
2009-11-30 23:27 ` Johannes Stezenbach
2009-12-01 1:28 ` Kay Sievers
2009-12-01 1:37 ` Dmitry Torokhov
2009-12-01 1:49 ` Kay Sievers
2009-12-01 1:52 ` Johannes Stezenbach
2009-12-01 1:55 ` Kay Sievers
2009-12-01 2:21 ` Johannes Stezenbach
2009-12-03 3:12 ` Dmitry Torokhov
2009-12-06 21:49 ` Johannes Stezenbach [this message]
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=20091206214958.GA5912@sig21.net \
--to=js@sig21.net \
--cc=linux-hotplug@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 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.