* [PATCH v2] keymap: support for force_release quirk
@ 2009-12-14 13:50 Johannes Stezenbach
2009-12-14 18:20 ` Martin Pitt
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Stezenbach @ 2009-12-14 13:50 UTC (permalink / raw)
To: linux-hotplug
On Mon, Dec 14, 2009 at 02:32:45PM +0100, Martin Pitt wrote:
> Johannes Stezenbach [2009-12-14 13:55 +0100]:
> > Yes, that was my question: Can I just save the original at boot
> > (first "add" event) into a file (like /dev/.udev/force-release/serioX)?
>
> No, please don't; such external state keeping is very ugly and error
> prone IMHO, and not what udev is designed to do. I rather think we
> should do one of:
>
> (1) Demand to have complete force-release tables, and completely
> reset the value with each invocation of the udev rule.
>
> Pro: Can remove values
> Con: Hard to just fix a single key
>
> (2) Only ever add new values by reading the current value, appending
> our tables, and writing it back.
>
> Pro: Can fix single keys and potentially simplifies rules
> Con: Needs reboot for bad tables which set quirk erroneously
>
> I suppose that on computers which need these quirks, all Fn keys are
> affected equally, so the "fix single key" case is probably irrelevant.
> OTOH, I don't think we'll get too many errors like "erroneous quirk",
> so both approaches should work well in practice.
>
> Personally I tend to prefer (2).
OK, below is an updated patch which does (2).
I think I addressed all your comments, and also changed
- [ -n "$attr" ] && attr="$attr,$scancode" || attr="$scancode"
+ attr="$attr${attr:+,}$scancode"
I test booted with the changes, it still works.
Thanks,
Johannes
From a90bb0c00d08c3b09ddec9b7d8fe6d5c330fdf80 Mon Sep 17 00:00:00 2001
From: Johannes Stezenbach <js@sig21.net>
Date: Sun, 13 Dec 2009 23:54:05 +0100
Subject: [PATCH] keymap: handle 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>
---
Makefile.am | 6 +++++
| 24 +++++++++++++++++++++
| 22 +++++++++++++++++++
| 10 ++++++++
4 files changed, 62 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/force-release/samsung-other
diff --git a/Makefile.am b/Makefile.am
index 3e9713f..4435398 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -480,8 +480,10 @@ BUILT_SOURCES += $(nodist_extras_keymap_keymap_SOURCES)
EXTRA_DIST += extras/keymap/check-keymaps.sh
dist_udevrules_DATA += extras/keymap/95-keymap.rules
+dist_udevrules_DATA += extras/keymap/95-keyboard-force-release.rules
libexec_PROGRAMS += extras/keymap/keymap
dist_libexec_SCRIPTS += extras/keymap/findkeyboards
+dist_libexec_SCRIPTS += extras/keymap/keyboard-force-release.sh
dist_doc_DATA = extras/keymap/README.keymap.txt
CLEANFILES += \
@@ -535,6 +537,10 @@ dist_udevkeymap_DATA = \
extras/keymap/keymaps/toshiba-satellite_a110 \
extras/keymap/keymaps/zepto-znote
+udevkeymapforcereldir = $(libexecdir)/keymaps/force-release
+dist_udevkeymapforcerel_DATA = \
+ extras/keymap/keymaps/force-release/samsung-other
+
extras/keymap/keys.txt: /usr/include/linux/input.h
$(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@
--git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules
new file mode 100644
index 0000000..4d0a877
--- /dev/null
+++ b/extras/keymap/95-keyboard-force-release.rules
@@ -0,0 +1,24 @@
+# Set model specific atkbd force_release quirk
+#
+# Several 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|change", 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 $devpath samsung-other"
+
+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..b157ac3
--- /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/force-release/$2" ;;
+esac
+
+read attr <"/sys/$1/force_release"
+while read scancode dummy; do
+ case "$scancode" in
+ \#*) ;;
+ *)
+ scancode=$(($scancode))
+ attr="$attr${attr:+,}$scancode"
+ ;;
+ esac
+done <"$scf"
+echo "$attr" >"/sys/$1/force_release"
--git a/extras/keymap/keymaps/force-release/samsung-other b/extras/keymap/keymaps/force-release/samsung-other
new file mode 100644
index 0000000..c51123a
--- /dev/null
+++ b/extras/keymap/keymaps/force-release/samsung-other
@@ -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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] keymap: support for force_release quirk
2009-12-14 13:50 [PATCH v2] keymap: support for force_release quirk Johannes Stezenbach
@ 2009-12-14 18:20 ` Martin Pitt
0 siblings, 0 replies; 2+ messages in thread
From: Martin Pitt @ 2009-12-14 18:20 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 343 bytes --]
Hello Johannes,
Johannes Stezenbach [2009-12-14 14:50 +0100]:
> OK, below is an updated patch which does (2).
Thanks for your work on that! Looks fine now, I applied your patch to
trunk.
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-14 18:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-14 13:50 [PATCH v2] keymap: support for force_release quirk Johannes Stezenbach
2009-12-14 18:20 ` Martin Pitt
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).