Kay Sievers [2009-05-06 1:16 +0200]: > > - Would you prefer using input-utils or a copy of the input-kbd > > script in udev-extras? > > I think, we should put all of that, including the binary, in a subdir > in udev-extras, and install the binary in /lib/udev/. Then we are free > to change stuff as we need, and don't depend on stuff that might not > exist on some systems.
Done. I put the keymaps themselves into /lib/udev/keymaps/ for now (instead of /usr/share/udev/keymaps/, as in my first sketch). I have the keymap setting tool, build system changes, conversion tool, and the first set of converted keymaps ready now. I tested it on my Dell Latitude, and it's working well. I wasted half an hour trying to push my git branch to an ssh server and finally gave up after I managed to push it to remote, but pulling didn't update anything; so I use format-patch for now. Do these look okay so far? I'll continue keymap conversion in the next days, and will send further patches. BTW, what's necessary to get an account on git.kernel.org, so that I could continuously maintain keymaps in my own udev-extras branch there, and it's easy for you to pull from that? Thanks, Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
From c076cf1ecc41b87228a38953900dda52b05a0dc9 Mon Sep 17 00:00:00 2001 From: Martin Pitt <[email protected]> Date: Thu, 7 May 2009 10:05:14 +0200 Subject: [PATCH 1/7] add keymap directory and tool keymap assigns keycodes to scancodes, or dumps the current mapping of an evdev keyboard device. It replaces hal-setup-keymap. The former keymap fdi files from hal-info will be converted to udev rules for vendor/product matching, and simple text files for mapping scancodes to keycodes. See this discussion for details: http://lists.freedesktop.org/archives/devkit-devel/2009-May/000152.html --- Makefile.am | 1 + configure.ac | 1 + keymap/Makefile.am | 52 +++++++++++ keymap/keymap.c | 259 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 313 insertions(+), 0 deletions(-) create mode 100644 keymap/Makefile.am create mode 100644 keymap/keymap.c diff --git a/Makefile.am b/Makefile.am index 9cb51ae..e462d52 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,6 +5,7 @@ SUBDIRS = \ modem-probe \ modem-modeswitch \ udev-acl \ + keymap \ usb-db ACLOCAL_AMFLAGS = -I m4 diff --git a/configure.ac b/configure.ac index df85532..852ac85 100644 --- a/configure.ac +++ b/configure.ac @@ -112,6 +112,7 @@ rules.d/Makefile modem-probe/Makefile modem-modeswitch/Makefile udev-acl/Makefile +keymap/Makefile usb-db/Makefile ]) AC_OUTPUT diff --git a/keymap/Makefile.am b/keymap/Makefile.am new file mode 100644 index 0000000..10be735 --- /dev/null +++ b/keymap/Makefile.am @@ -0,0 +1,52 @@ +# keymap is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# keymap is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with keymap; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +include $(top_srcdir)/Makefile.am.inc + +# rules and keymaps + +udevrulesdir = $(udev_prefix)/lib/udev/rules.d +dist_udevrules_DATA = 95-keymap.rules + +udevkeymapdir = $(udevhomedir)/keymaps +udevkeymap_DATA = keymaps/* + +# keymap program + +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = keymap + +keymap_SOURCES = keymap.c keys-from-name.h keys-to-name.h +keymap_CPPFLAGS = $(AM_CPPFLAGS) + +BUILT_SOURCES = keys-from-name.h keys-to-name.h +CLEANFILES = keys.txt keys-from-name.gperf keys-from-name.h keys-to-name.h + +# +# generation of keys-{from,to}-name.h from linux/input.h and gperf +# + +keys.txt: /usr/include/linux/input.h + awk '/^#define.*KEY_/ { if ($$2 != "KEY_MAX" && $$2 != "KEY_CNT") { print $$2 } }' < $< > $@ + +keys-from-name.gperf: keys.txt + awk 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ + +keys-from-name.h: keys-from-name.gperf Makefile + gperf -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ + +keys-to-name.h: keys.txt Makefile + awk 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ + + diff --git a/keymap/keymap.c b/keymap/keymap.c new file mode 100644 index 0000000..b7ed547 --- /dev/null +++ b/keymap/keymap.c @@ -0,0 +1,259 @@ +/* + * keymap - dump keymap of an evdev device or set a new keymap from a file + * + * Based on keyfuzz by Lennart Poettering <[email protected]> + * Adapted for udev-extras by Martin Pitt <[email protected]> + * + * Copyright (C) 2006, Lennart Poettering + * Copyright (C) 2009, Canonical Ltd. + * + * keymap is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * keymap is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with keymap; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> +#include <limits.h> +#include <fcntl.h> +#include <sys/ioctl.h> + +#include <linux/input.h> + +const struct key* lookup_key (const char *str, unsigned int len); + +#include "keys-from-name.h" +#include "keys-to-name.h" + +#define MAX_SCANCODES 1024 + +/* If keymap file is given without a path, assume this one; must end with '/' * */ +#define DEFAULT_PATH "/lib/udev/keymaps/" + +static int evdev_open(const char *dev) { + int fd; + char fn[PATH_MAX]; + + if (strncmp(dev, "/dev", 4) != 0) { + snprintf(fn, sizeof(fn), "/dev/%s", dev); + dev = fn; + } + + if ((fd = open(dev, O_RDWR)) < 0) { + fprintf(stderr, "open('%s'): %s\n", dev, strerror(errno)); + return -1; + } + + return fd; +} + +static int evdev_get_keycode(int fd, int scancode, int e) { + int codes[2]; + + codes[0] = scancode; + if (ioctl(fd, EVIOCGKEYCODE, codes) < 0) { + if (e && errno == EINVAL) + return -2; + else { + fprintf(stderr, "EVIOCGKEYCODE: %s\n", strerror(errno)); + return -1; + } + } + + return codes[1]; +} + +static int evdev_set_keycode(int fd, int scancode, int keycode) { + int codes[2]; + + codes[0] = scancode; + codes[1] = keycode; + + if (ioctl(fd, EVIOCSKEYCODE, codes) < 0) { + fprintf(stderr, "EVIOCSKEYCODE: %s\n", strerror(errno)); + return -1; + } + + return 0; +} + +static int evdev_driver_version(int fd, char *v, size_t l) { + int version; + + if (ioctl(fd, EVIOCGVERSION, &version)) { + fprintf(stderr, "EVIOCGVERSION: %s\n", strerror(errno)); + return -1; + } + + snprintf(v, l, + "%i.%i.%i.", + version >> 16, + (version >> 8) & 0xff, + version & 0xff); + + return 0; +} + +static int evdev_device_name(int fd, char *n, size_t l) { + + if (ioctl(fd, EVIOCGNAME(l), n) < 0) { + fprintf(stderr, "EVIOCGNAME: %s\n", strerror(errno)); + return -1; + } + + return 0; +} + +/* Return a lower-case string with KEY_ prefix removed */ +static const char* format_keyname(const char* key) { + static char result[101]; + const char* s; + int len; + + for (s = key+4, len = 0; *s && len < 100; ++len, ++s) + result[len] = tolower(*s); + result[len] = '\0'; + + return result; +} + +static int dump_table(int fd) { + char version[256], name[256]; + int scancode, r = -1; + + if (evdev_driver_version(fd, version, sizeof(version)) < 0) + goto fail; + + if (evdev_device_name(fd, name, sizeof(name)) < 0) + goto fail; + + printf("### evdev %s, driver '%s'\n", version, name); + + r = 0; + + for (scancode = 0; scancode < MAX_SCANCODES; scancode++) { + int keycode; + + if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) { + if (keycode != -2) + r = -1; + + break; + } + + if (keycode < KEY_MAX && key_names[keycode]) + printf("0x%03x %s\n", scancode, format_keyname(key_names[keycode])); + else + printf("0x%03x 0x%03x\n", scancode, keycode); + } + +fail: + return r; +} + +static int merge_table(int fd, const char *filename) { + int r = 0; + int line = 0; + FILE* f; + + f = fopen(filename, "r"); + if (!f) { + perror(filename); + r = -1; + goto fail; + } + while (!feof(f)) { + char s[256], *p; + int scancode, new_keycode, old_keycode; + + if (!fgets(s, sizeof(s), f)) + break; + + line++; + + p = s+strspn(s, "\t "); + + if (*p == '#' || *p == '\n') + continue; + + if (sscanf(p, "%i %i", &scancode, &new_keycode) != 2) { + char t[105] = "KEY_UNKNOWN"; + const struct key *k; + + if (sscanf(p, "%i %100s", &scancode, t+4) != 2) { + fprintf(stderr, "WARNING: Parse failure at line %i, ignoring.\n", line); + r = -1; + continue; + } + + if (!(k = lookup_key(t, strlen(t)))) { + fprintf(stderr, "WARNING: Unknown key '%s' at line %i, ignoring.\n", t, line); + r = -1; + continue; + } + + new_keycode = k->id; + } + + + if ((old_keycode = evdev_get_keycode(fd, scancode, 0)) < 0) { + r = -1; + goto fail; + } + + if (evdev_set_keycode(fd, scancode, new_keycode) < 0) { + r = -1; + goto fail; + } + + if (new_keycode != old_keycode) + fprintf(stderr, "Remapped scancode 0x%02x to 0x%02x (prior: 0x%02x)\n", scancode, new_keycode, old_keycode); + } + +fail: + + return r; +} + +static const char* default_keymap_path(const char* path) { + static char result[PATH_MAX]; + + if (!strchr(path, '/')) { + snprintf(result, sizeof(result), "%s%s", DEFAULT_PATH, path); + return result; + } + return path; +} + +int main(int argc, char **argv) +{ + int fd = -1; + + if (argc < 2 || argc > 3) { + printf("Usage: %s <event device> [<map file>]\n", argv[0]); + exit(1); + } + + if ((fd = evdev_open(argv[1])) < 0) + return 1; + + if (argc == 3) + merge_table(fd, default_keymap_path(argv[2])); + else + dump_table(fd); + + return 0; +} -- 1.6.2.4
From cd29749155157180575d7a974d8cc882817dc776 Mon Sep 17 00:00:00 2001 From: Martin Pitt <[email protected]> Date: Thu, 7 May 2009 10:39:09 +0200 Subject: [PATCH 2/7] keymap: add fdi2rules.py Tool to convert hal keymap FDIs into udev rules and key map files. Please note that this is far from perfect, since the mapping between fdi and udev rules is not straightforward (and impossible in some cases). After running this, the result should be cleaned up, and errors from unknown operators etc. corrected manually. --- keymap/fdi2rules.py | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 152 insertions(+), 0 deletions(-) create mode 100755 keymap/fdi2rules.py diff --git a/keymap/fdi2rules.py b/keymap/fdi2rules.py new file mode 100755 index 0000000..da058b6 --- /dev/null +++ b/keymap/fdi2rules.py @@ -0,0 +1,152 @@ +#!/usr/bin/python +# Convert hal keymap FDIs into udev rules and key map files +# Please note that this is far from perfect, since the mapping between fdi and +# udev rules is not straightforward (and impossible in some cases). +# +# (C) 2009 Canonical Ltd. +# Author: Martin Pitt <[email protected]> +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# keymap is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with keymap; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +import sys, os.path, xml.dom.minidom + +def string_op2glob(node): + '''Convert FDI string match operator to a glob.''' + + if node.attributes.has_key('string'): + return node.attributes['string'].nodeValue + if node.attributes.has_key('prefix'): + return node.attributes['prefix'].nodeValue + '*' + if node.attributes.has_key('suffix'): + return '*' + node.attributes['suffix'].nodeValue + if node.attributes.has_key('contains'): + return '*' + node.attributes['contains'].nodeValue + '*' + if node.attributes.has_key('contains_outof'): + return '|'.join(['*%s*' % v for v in node.attributes['contains_outof'].nodeValue.split(';')]) + return '*' + node.attributes['contains_ncase'].nodeValue + '*' + #if node.attributes.has_key('contains_ncase'): + # # FIXME: This is incorrect! udev rules don't allow case insensitive matching + # return '*' + node.attributes['contains_ncase'].nodeValue + '*' + raise NotImplementedError, 'unknown string operator ' + str(node.attributes.keys()) + +def glob2fname(glob): + '''Create an appropriate file name from a glob''' + + return glob.replace('*', '').replace('|', '_').replace(' ', '_').lower() + +def get_node_comment(node): + '''Find the next comment node after node''' + + while node: + node = node.nextSibling + if node and node.nodeType == xml.dom.Node.COMMENT_NODE: + return node.nodeValue.strip() + return None + +def create_keylist(node, filename): + '''Parse key code assignmends from <append> notes and create map file.''' + + if not os.path.isdir('keymaps'): + os.mkdir('keymaps') + f = open(os.path.join('keymaps', filename), 'w') + #f = sys.stdout + #print '-------------- %s -------------' % filename + for c in node.childNodes: + if c.nodeName == 'append' and c.attributes.get('key').nodeValue == 'input.keymap.data': + content_node = c.childNodes[0] + assert content_node.nodeType == xml.dom.Node.TEXT_NODE + (code, name) = content_node.nodeValue.split(':') + comment = get_node_comment(c) + if comment: + print >> f, '0x%X %s # %s' % (int(code, 16) - 0xE000 + 128, name, comment) + else: + print >> f, '0x%X %s' % (int(code, 16) - 0xE000 + 128, name) + #print '---------------------------' + f.close() + +def get_vendor_node(node): + '''Find the node's parent which matches the system vendor.''' + + while True: + node = node.parentNode + if not node: + raise SystemError, 'no vendor parent node found' + if node.nodeName == 'match' and node.attributes['key'].nodeValue == \ + '/org/freedesktop/Hal/devices/computer:system.hardware.vendor': + return node + +def parse_fdi_vendor(node): + vendor_glob = string_op2glob(node) + fname = glob2fname (vendor_glob) + print 'ATTR{[dmi/id]sys_vendor}=="%s", RUN+="keymap $name %s"' % (vendor_glob, fname) + create_keylist(node, fname) + +def parse_fdi_product(node): + vendor_glob = string_op2glob(get_vendor_node(node)) + product_glob = string_op2glob(node) + fname = '%s-%s' % (glob2fname(vendor_glob), glob2fname (product_glob)) + print 'ATTR{[dmi/id]sys_vendor}=="%s", ATTR{[dmi/id]product_name}=="%s", RUN+="keymap $name %s"' % (vendor_glob, product_glob, fname) + create_keylist(node, fname) + +def parse_fdi_version(node): + vendor_glob = string_op2glob(get_vendor_node(node)) + product_glob = string_op2glob(node) + fname = '%s-%s' % (glob2fname(vendor_glob), glob2fname (product_glob)) + print 'ATTR{[dmi/id]sys_vendor}=="%s", ATTR{[dmi/id]product_version}=="%s", RUN+="keymap $name %s"' % (vendor_glob, product_glob, fname) + create_keylist(node, fname) + +def parse_fdi(fdi): + '''Parse keymaps from a fdi node.''' + + for match_node in fdi.getElementsByTagName('match'): + key = match_node.attributes['key'].nodeValue + if key == '/org/freedesktop/Hal/devices/computer:system.hardware.vendor': + # vendor list without model specific quirks + parse_fdi_vendor(match_node) + elif key == '/org/freedesktop/Hal/devices/computer:system.hardware.product': + # product specific list + parse_fdi_product(match_node) + elif key == '/org/freedesktop/Hal/devices/computer:system.hardware.version': + # product version specific list + parse_fdi_version(match_node) + elif key == '/org/freedesktop/Hal/devices/computer:system.formfactor': + # this assumes that a formfactor does not have product submatches + try: + vendor_glob = string_op2glob(get_vendor_node(match_node)) + fname = glob2fname (vendor_glob) + create_keylist(match_node, fname) + except SystemError: + # formfactor match is at toplevel + pass + elif key == '@input.originating_device:info.linux.driver': + # already covered in udev rules header + pass + else: + print >> sys.stderr, 'WARNING: I do not understand key type', key + +# udev rules header +print '''ACTION!="add", GOTO="keyboard_end" +SUBSYSTEM!="input", GOTO="keyboard_end" +DRIVERS=="atkbd", GOTO="keyboard_vendorcheck" +GOTO="keyboard_end" + +LABEL="keyboard_vendorcheck"''' + +# parse FDI files +for f in sys.argv[1:]: + parse_fdi(xml.dom.minidom.parse(f)) + +# udev rules footer +print '\nLABEL="keyboard_end"' -- 1.6.2.4
From c6e55da6d087a624ba6369ba4cb95a250752fa85 Mon Sep 17 00:00:00 2001 From: Martin Pitt <[email protected]> Date: Thu, 7 May 2009 10:42:23 +0200 Subject: [PATCH 3/7] keymap: Add Dell rules (from hal-info) Converted from 30-keymap-dell.fdi from hal-info 2009-05-07. The "Latitude XT" product case was merged into the general dell map, since there were no overlaps. The "Dell USB Keyboard Hub" was not converted yet. --- keymap/95-keymap.rules | 10 ++++++++++ keymap/keymaps/dell | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 0 deletions(-) create mode 100644 keymap/95-keymap.rules create mode 100644 keymap/keymaps/dell diff --git a/keymap/95-keymap.rules b/keymap/95-keymap.rules new file mode 100644 index 0000000..4dd11f8 --- /dev/null +++ b/keymap/95-keymap.rules @@ -0,0 +1,10 @@ +ACTION!="add", GOTO="keyboard_end" +SUBSYSTEM!="input", GOTO="keyboard_end" +DRIVERS=="atkbd", GOTO="keyboard_vendorcheck" +GOTO="keyboard_end" + +LABEL="keyboard_vendorcheck" + +ATTR{[dmi/id]sys_vendor}=="Dell*", RUN+="keymap $name dell" + +LABEL="keyboard_end" diff --git a/keymap/keymaps/dell b/keymap/keymaps/dell new file mode 100644 index 0000000..5ff44d6 --- /dev/null +++ b/keymap/keymaps/dell @@ -0,0 +1,27 @@ +0x81 playpause # Play/Pause +0x82 stopcd # Stop +0x83 previoussong # Previous song +0x84 nextsong # Next song +0x85 brightnessdown # Fn+Down arrow Brightness Down +0x86 brightnessup # Fn+Up arrow Brightness Up +0x87 battery # Fn+F3 battery icon +0x88 wlan # Fn+F2 Turn On/Off Wireless +0x89 ejectclosecd # Fn+F10 Eject CD +0x8A suspend # Fn+F1 hibernate +0x8B switchvideomode # Fn+F8 CRT/LCD (high keycode: "displaytoggle") +0x8C f23 # Fn+Right arrow Auto Brightness +0x8F switchvideomode # Fn+F7 aspect ratio +0x90 previoussong # Front panel previous song +0x91 prog1 # Wifi Catcher (DELL Specific) +0x92 media # MediaDirect button (house icon) +0x93 f23 # FIXME Fn+Left arrow Auto Brightness +0x95 camera # Shutter button Takes a picture if optional camera available +0x97 email # Tablet email button +0x98 f21 # FIXME: Tablet screen rotatation +0x99 nextsong # Front panel next song +0x9A setup # Tablet tools button +0x9B switchvideomode # Display Toggle button +0xA2 playpause # Front panel play/pause +0xA4 stopcd # Front panel stop +0xD8 screenlock # FIXME: Tablet lock button +0xED media # MediaDirect button -- 1.6.2.4
From 3b14ba0899bb2dcb6650e3ee9e095e2ca24dbede Mon Sep 17 00:00:00 2001 From: Martin Pitt <[email protected]> Date: Thu, 7 May 2009 10:54:24 +0200 Subject: [PATCH 4/7] keymap: Add Compaq rules (from hal-info) Converted from 30-keymap-compaq.fdi from hal-info 2009-05-07. --- keymap/95-keymap.rules | 1 + keymap/keymaps/compaq-e_evo | 4 ++++ 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 keymap/keymaps/compaq-e_evo diff --git a/keymap/95-keymap.rules b/keymap/95-keymap.rules index 4dd11f8..a6e4e6a 100644 --- a/keymap/95-keymap.rules +++ b/keymap/95-keymap.rules @@ -6,5 +6,6 @@ GOTO="keyboard_end" LABEL="keyboard_vendorcheck" ATTR{[dmi/id]sys_vendor}=="Dell*", RUN+="keymap $name dell" +ATTR{[dmi/id]sys_vendor}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N610c*|*Evo N600c*", RUN+="keymap $name compaq-e_evo" LABEL="keyboard_end" diff --git a/keymap/keymaps/compaq-e_evo b/keymap/keymaps/compaq-e_evo new file mode 100644 index 0000000..5fbc573 --- /dev/null +++ b/keymap/keymaps/compaq-e_evo @@ -0,0 +1,4 @@ +0xA3 www # I key +0x9A search +0x9E email +0x9F homepage -- 1.6.2.4
From cd5f208a22cbe10c3c2cd65acb6cc2626c3a1985 Mon Sep 17 00:00:00 2001 From: Martin Pitt <[email protected]> Date: Thu, 7 May 2009 11:07:17 +0200 Subject: [PATCH 5/7] keymap: fix fdi2rules.py for scan codes below 128 Previously, all codes were normalized with - 0xE000 + 128. Only do this for codes which are actually >= 0xE000. --- keymap/fdi2rules.py | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/keymap/fdi2rules.py b/keymap/fdi2rules.py index da058b6..b201cab 100755 --- a/keymap/fdi2rules.py +++ b/keymap/fdi2rules.py @@ -55,6 +55,12 @@ def get_node_comment(node): return node.nodeValue.strip() return None +def normalize_code(code): + code = int(code, 16) + if code >= 0xE000: + return code - 0xE000 + 128 + return code + def create_keylist(node, filename): '''Parse key code assignmends from <append> notes and create map file.''' @@ -70,9 +76,9 @@ def create_keylist(node, filename): (code, name) = content_node.nodeValue.split(':') comment = get_node_comment(c) if comment: - print >> f, '0x%X %s # %s' % (int(code, 16) - 0xE000 + 128, name, comment) + print >> f, '0x%X %s # %s' % (normalize_code(code), name, comment) else: - print >> f, '0x%X %s' % (int(code, 16) - 0xE000 + 128, name) + print >> f, '0x%X %s' % (normalize_code(code), name) #print '---------------------------' f.close() -- 1.6.2.4
From 05061493c75022432668480922d7fc3644727ab1 Mon Sep 17 00:00:00 2001 From: Martin Pitt <[email protected]> Date: Thu, 7 May 2009 11:08:41 +0200 Subject: [PATCH 6/7] keymap: Add Lenovo rules (from hal-info) Converted from 30-keymap-lenovo.fdi from hal-info 2009-05-07. --- keymap/95-keymap.rules | 3 +++ keymap/keymaps/lenovo-3000 | 5 +++++ keymap/keymaps/lenovo-thinkpad_x6_tablet | 8 ++++++++ 3 files changed, 16 insertions(+), 0 deletions(-) create mode 100644 keymap/keymaps/lenovo-3000 create mode 100644 keymap/keymaps/lenovo-thinkpad_x6_tablet diff --git a/keymap/95-keymap.rules b/keymap/95-keymap.rules index a6e4e6a..aec6183 100644 --- a/keymap/95-keymap.rules +++ b/keymap/95-keymap.rules @@ -8,4 +8,7 @@ LABEL="keyboard_vendorcheck" ATTR{[dmi/id]sys_vendor}=="Dell*", RUN+="keymap $name dell" ATTR{[dmi/id]sys_vendor}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N610c*|*Evo N600c*", RUN+="keymap $name compaq-e_evo" +ATTR{[dmi/id]sys_vendor}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" +ATTR{[dmi/id]sys_vendor}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x6_tablet" + LABEL="keyboard_end" diff --git a/keymap/keymaps/lenovo-3000 b/keymap/keymaps/lenovo-3000 new file mode 100644 index 0000000..5bd1656 --- /dev/null +++ b/keymap/keymaps/lenovo-3000 @@ -0,0 +1,5 @@ +0x8B switchvideomode # Fn+F7 video +0x96 wlan # Fn+F5 wireless +0x97 sleep # Fn+F4 suspend +0x98 suspend # Fn+F12 hibernate +0xB4 prog1 # Lenovo Care diff --git a/keymap/keymaps/lenovo-thinkpad_x6_tablet b/keymap/keymaps/lenovo-thinkpad_x6_tablet new file mode 100644 index 0000000..6fd16b5 --- /dev/null +++ b/keymap/keymaps/lenovo-thinkpad_x6_tablet @@ -0,0 +1,8 @@ +0x6C f21 # rotate +0x68 screenlock # screenlock +0x6B esc # escape +0x6D right # right on d-pad +0x6E left # left on d-pad +0x71 up # up on d-pad +0x6F down # down on d-pad +0x69 enter # enter on d-pad -- 1.6.2.4
From 73da4acd25f53a792a1a1600bea5b13285e104da Mon Sep 17 00:00:00 2001 From: Martin Pitt <[email protected]> Date: Thu, 7 May 2009 11:22:40 +0200 Subject: [PATCH 7/7] keymap: Add Asus rules (from hal-info) Converted from 30-keymap-module-asus-laptop.fdi from hal-info 2009-05-07. --- keymap/95-keymap.rules | 1 + keymap/keymaps/asus-w3j | 11 +++++++++++ 2 files changed, 12 insertions(+), 0 deletions(-) create mode 100644 keymap/keymaps/asus-w3j diff --git a/keymap/95-keymap.rules b/keymap/95-keymap.rules index aec6183..a7ab4ff 100644 --- a/keymap/95-keymap.rules +++ b/keymap/95-keymap.rules @@ -7,6 +7,7 @@ LABEL="keyboard_vendorcheck" ATTR{[dmi/id]sys_vendor}=="Dell*", RUN+="keymap $name dell" ATTR{[dmi/id]sys_vendor}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N610c*|*Evo N600c*", RUN+="keymap $name compaq-e_evo" +ATTR{[dmi/id]sys_vendor}=="ASUS*", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name asus-w3j" ATTR{[dmi/id]sys_vendor}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" ATTR{[dmi/id]sys_vendor}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x6_tablet" diff --git a/keymap/keymaps/asus-w3j b/keymap/keymaps/asus-w3j new file mode 100644 index 0000000..773e0b3 --- /dev/null +++ b/keymap/keymaps/asus-w3j @@ -0,0 +1,11 @@ +0x41 nextsong +0x45 playpause +0x43 stopcd +0x40 previoussong +0x4C ejectclosecd +0x32 mute +0x31 volumedown +0x30 volumeup +0x5D wlan +0x7E bluetooth +0x8A media # high keycode: "tv" -- 1.6.2.4
signature.asc
Description: Digital signature
_______________________________________________ devkit-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/devkit-devel
