Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 308550 Details for
Bug 450326
hal/ Fixing non-mapped vendor buttons
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch hal to support keymapping
hal-0.5.8.1-keymap.patch (text/plain), 11.57 KB, created by
ritz
on 2008-06-06 17:39:12 UTC
(
hide
)
Description:
patch hal to support keymapping
Filename:
MIME Type:
Creator:
ritz
Created:
2008-06-06 17:39:12 UTC
Size:
11.57 KB
patch
obsolete
>diff -Naur hal-0.5.8.1.orig/configure.in hal-0.5.8.1/configure.in >--- hal-0.5.8.1.orig/configure.in 2008-05-31 04:59:41.000000000 +0530 >+++ hal-0.5.8.1/configure.in 2008-05-31 05:19:21.000000000 +0530 >@@ -297,6 +297,21 @@ > dnl DBUS API is subject to changes > AC_DEFINE_UNQUOTED(DBUS_API_SUBJECT_TO_CHANGE, ,DBUS API is subject to change) > >+AC_ARG_WITH([keymaps], AS_HELP_STRING([--with-keymaps], [Re-map multimedia keys (auto)])) >+BUILD_KEYMAPS=no >+if test "x$with_keymaps" = "xyes" ; then >+ BUILD_KEYMAPS=yes >+elif test "x$with_keymaps" = "x" ; then >+ case "${HALD_BACKEND}" in >+ linux) >+ BUILD_KEYMAPS=yes >+ ;; >+ *) >+ ;; >+ esac >+fi >+AM_CONDITIONAL(BUILD_KEYMAPS, [test x$BUILD_KEYMAPS = xyes]) >+ > # check for PolicyKit > AM_CONDITIONAL(HAVE_POLKIT, false) > AC_ARG_ENABLE(policy-kit, [ --disable-policy-kit Build without PolicyKit (strongly discouraged)]) >@@ -384,6 +399,16 @@ > have_xmllint=yes > fi > >+AC_PATH_PROG(GPERF, [gperf], [no]) >+AC_MSG_CHECKING([whether to rebuild gperf header files]) >+if test x$GPERF = xno ; then >+ have_gperf=no >+else >+ have_gperf=yes >+fi >+AC_SUBST(HAVE_GPERF) >+AM_CONDITIONAL(HAVE_GPERF, [test x$have_gperf = xyes]) >+ > if test x$enable_docbook_docs = xauto ; then > if test x$have_docbook = xno || test x$have_xmllint = xno ; then > enable_docbook_docs=no >@@ -568,6 +593,7 @@ > use PolicyKit: ${msg_polkit} > > build Macbook Pro utils: ${BUILD_MACBOOKPRO} >+ Re-map multimedia keys: ${BUILD_KEYMAPS} (Linux only) > > Maintainer mode: ${USE_MAINTAINER_MODE} > Building verbose mode: ${enable_verbose_mode} >diff -Naur hal-0.5.8.1.orig/doc/spec/hal-spec-properties.xml hal-0.5.8.1/doc/spec/hal-spec-properties.xml >--- hal-0.5.8.1.orig/doc/spec/hal-spec-properties.xml 2008-05-31 04:59:41.000000000 +0530 >+++ hal-0.5.8.1/doc/spec/hal-spec-properties.xml 2008-05-31 05:05:15.000000000 +0530 >@@ -3774,6 +3774,45 @@ > </tgroup> > </informaltable> > </sect2> >+ <sect2 id="device-properties-input-keymap"> >+ <title> >+ input.keymap namespace >+ </title> >+ <para> >+ Device objects with the capability <literal>input.keymap</literal> >+ provide facilities to remap keyboard buttons. >+ </para> >+ <informaltable> >+ <tgroup cols="2"> >+ <thead> >+ <row> >+ <entry>Key (type)</entry> >+ <entry>Values</entry> >+ <entry>Mandatory</entry> >+ <entry>Description</entry> >+ </row> >+ </thead> >+ <tbody> >+ <row> >+ <entry> >+ <literal>input.keymap.data</literal> (strlist) >+ </entry> >+ <entry>e.g. "e017:brightnessup"</entry> >+ <entry>No</entry> >+ <entry> >+ The scancode is represented in hex and the keycode name as >+ as string. The keycode name is not case sensitive. >+ On Linux, the keycode name should be the same constant as >+ present in /usr/include/linux/input.h with the 'KEY_' >+ prefix removed, e.g. 'KEY_SLEEP' -> 'sleep'. >+ You can append as many <literal>input.keymap.data</literal> >+ values as there are keys to remap. >+ </entry> >+ </row> >+ </tbody> >+ </tgroup> >+ </informaltable> >+ </sect2> > <sect2 id="device-properties-pcmcia_socket"> > <title> > <literal>pcmcia_socket namespace</literal> >diff -Naur hal-0.5.8.1.orig/fdi/policy/10osvendor/10-keymap.fdi hal-0.5.8.1/fdi/policy/10osvendor/10-keymap.fdi >--- hal-0.5.8.1.orig/fdi/policy/10osvendor/10-keymap.fdi 1970-01-01 05:30:00.000000000 +0530 >+++ hal-0.5.8.1/fdi/policy/10osvendor/10-keymap.fdi 2008-05-31 05:05:30.000000000 +0530 >@@ -0,0 +1,9 @@ >+<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- --> >+<deviceinfo version="0.2"> >+ <device> >+ <match key="info.capabilities" contains="input.keymap"> >+ <append key="info.callouts.add" type="strlist">hal-setup-keymap</append> >+ </match> >+ </device> >+</deviceinfo> >+ >diff -Naur hal-0.5.8.1.orig/fdi/policy/10osvendor/Makefile.am hal-0.5.8.1/fdi/policy/10osvendor/Makefile.am >--- hal-0.5.8.1.orig/fdi/policy/10osvendor/Makefile.am 2008-05-31 04:59:41.000000000 +0530 >+++ hal-0.5.8.1/fdi/policy/10osvendor/Makefile.am 2008-05-31 05:06:25.000000000 +0530 >@@ -9,6 +9,10 @@ > 15-storage-luks.fdi \ > 20-storage-methods.fdi > >+if BUILD_KEYMAPS >+dist_fdi_DATA += 10-keymap.fdi >+endif >+ > check: > for f in $(dist_fdi_DATA); do \ > echo -n "Validate XML in $$f : "; \ >diff -Naur hal-0.5.8.1.orig/tools/hal-setup-keymap.c hal-0.5.8.1/tools/hal-setup-keymap.c >--- hal-0.5.8.1.orig/tools/hal-setup-keymap.c 1970-01-01 05:30:00.000000000 +0530 >+++ hal-0.5.8.1/tools/hal-setup-keymap.c 2008-05-31 05:22:50.000000000 +0530 >@@ -0,0 +1,168 @@ >+/* >+ * Licensed under the GNU General Public License Version 2 >+ * >+ * Copyright (C) 2007 Richard Hughes <richard@hughsie.com> >+ * >+ * 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. >+ * >+ * This program 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 this program; if not, write to the Free Software >+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA >+ * 02110-1301, USA. >+ */ >+ >+#ifdef HAVE_CONFIG_H >+# include <config.h> >+#endif >+ >+#include <stdio.h> >+#include <stdlib.h> >+#include <errno.h> >+#include <string.h> >+#include <fcntl.h> >+#include <unistd.h> >+#include <sys/ioctl.h> >+ >+#ifdef HAL_LINUX_INPUT_HEADER_H >+ #include HAL_LINUX_INPUT_HEADER_H >+#else >+ #include <linux/input.h> >+#endif >+ >+#include "libhal/libhal.h" >+#include "hal-setup-keymap-hash-name.h" >+ >+static LibHalContext *ctx = NULL; >+static char* udi; >+ >+static int >+evdev_open (const char *dev) >+{ >+ int fd; >+ >+ /* requires root privs */ >+ fd = open (dev, O_RDWR); >+ if (fd < 0) { >+ fprintf (stderr, "hal-setup-keymap: failed to open('%s'): %s\n", >+ dev, strerror (errno)); >+ return -1; >+ } >+ >+ return fd; >+} >+ >+static int >+evdev_set_keycode (int fd, int scancode, int keycode) >+{ >+ int ret; >+ int codes[2]; >+ >+ codes[0] = scancode; >+ codes[1] = keycode; >+ >+ ret = ioctl (fd, EVIOCSKEYCODE, codes); >+ if (ret < 0) { >+ fprintf (stderr, "hal-setup-keymap: failed to set scancode %x to keycode %d: %s\n", >+ scancode, keycode, strerror(errno)); >+ return -1; >+ } >+ >+ return 0; >+} >+ >+int >+main (int argc, char **argv) >+{ >+ char **keymap_list; >+ int i = 0; >+ int fd; >+ unsigned int scancode = 0; >+ int keycode = 0; >+ char keyname[128]; >+ int values; >+ char *device; >+ DBusError error; >+ const struct key *name; >+ >+ udi = getenv ("UDI"); >+ if (udi == NULL) { >+ fprintf (stderr, "hal-setup-keymap: Failed to get UDI\n"); >+ return 1; >+ } >+ dbus_error_init (&error); >+ if ((ctx = libhal_ctx_init_direct (&error)) == NULL) { >+ fprintf (stderr, "hal-setup-keymap: Unable to initialise libhal context: %s\n", error.message); >+ return 1; >+ } >+ >+ dbus_error_init (&error); >+ if (!libhal_device_addon_is_ready (ctx, udi, &error)) { >+ return 1; >+ } >+ >+ /* get the string list data */ >+ dbus_error_init (&error); >+ keymap_list = libhal_device_get_property_strlist (ctx, udi, "input.keymap.data", &error); >+ if (dbus_error_is_set (&error) == TRUE) { >+ fprintf (stderr, "hal-setup-keymap: Failed to get keymap list: '%s'\n", error.message); >+ return 1; >+ } >+ >+ /* get the device */ >+ device = libhal_device_get_property_string (ctx, udi, "input.device", &error); >+ if (dbus_error_is_set (&error) == TRUE) { >+ fprintf (stderr, "hal-setup-keymap: Failed to get input device list: '%s'\n", error.message); >+ return 1; >+ } >+ >+ /* get a file descriptor to the device */ >+ fprintf (stderr, "hal-setup-keymap: Using device %s\n", device); >+ fd = evdev_open (device); >+ if (fd < 0) { >+ fprintf (stderr, "hal-setup-keymap: Could not open device\n"); >+ return 1; >+ } >+ >+ /* add each of the keys */ >+ do { >+ values = sscanf (keymap_list[i], "%x:%s", &scancode, keyname); >+ if (values == 2) { >+ /* fix for high scancodes on i8042 KBD - we do this here >+ * and not in the fdi as the high value is displayed in >+ * dmesg and we don't want the user to do more work */ >+ if (scancode > 127) { >+ scancode -= 0xe000; >+ scancode += 128; >+ } >+ >+ /* use gperf to convert as it's really quick */ >+ name = lookup_key (keyname, strlen(keyname)); >+ if (name != NULL) { >+ keycode = name->id; >+ fprintf (stderr, "hal-setup-keymap: parsed %s to (0x%x, %i)\n", >+ keymap_list[i], scancode, keycode); >+ evdev_set_keycode (fd, scancode, keycode); >+ } else { >+ fprintf (stderr, "hal-setup-keymap: failed to find key '%s'\n", keyname); >+ } >+ } else { >+ fprintf (stderr, "hal-setup-keymap: Failed to parse %s\n", keymap_list[i]); >+ } >+ } while (keymap_list[++i] != NULL); >+ >+ libhal_free_string_array (keymap_list); >+ close (fd); >+ >+ /* we do not have to poll anything, so exit */ >+ return 0; >+} >+ >+ >diff -Naur hal-0.5.8.1.orig/tools/Makefile.am hal-0.5.8.1/tools/Makefile.am >--- hal-0.5.8.1.orig/tools/Makefile.am 2008-05-31 04:59:41.000000000 +0530 >+++ hal-0.5.8.1/tools/Makefile.am 2008-05-31 05:18:54.000000000 +0530 >@@ -31,6 +31,13 @@ > hal-find-by-property \ > hal-device > >+BUILT_SOURCES = >+DISTCLEANFILES = >+ >+if BUILD_KEYMAPS >+bin_PROGRAMS += hal-setup-keymap >+endif >+ > lshal_SOURCES = lshal.c > lshal_LDADD = @GLIB_LIBS@ $(top_builddir)/libhal/libhal.la > >@@ -49,6 +56,24 @@ > hal_device_SOURCES = hal-device.c > hal_device_LDADD = @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la > >+if BUILD_KEYMAPS >+ >+if HAVE_GPERF >+hal-setup-keymap-keys.txt: /usr/include/linux/input.h >+ awk '/^#define.*KEY_/ { if ($$2 != "KEY_MAX") { print substr($$2, 5) } }' < $< > $@ >+ >+hal-setup-keymap-hash-name.gperf: hal-setup-keymap-keys.txt >+ awk 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", KEY_" $$1 }' < $< > $@ >+ >+hal-setup-keymap-hash-name.h: hal-setup-keymap-hash-name.gperf >+ gperf -t --ignore-case -N lookup_key -H hash_input_names -p -C < $< > $@ >+endif #HAVE_GPERF >+ >+hal_setup_keymap_SOURCES = hal-setup-keymap.c hal-setup-keymap-hash-name.h >+hal_setup_keymap_LDADD = $(top_builddir)/libhal/libhal.la >+ >+endif #BUILD_KEYMAPS >+ > libexec_PROGRAMS = \ > hal-storage-mount \ > hal-storage-unmount \ >@@ -97,6 +122,18 @@ > > EXTRA_DIST=$(man_MANS) $(MAN_IN_FILES) gen-libgphoto-hal-fdi $(script_SCRIPTS) > >+if HAVE_GPERF >+DISTCLEANFILES += \ >+ hal-setup-keymap-hash-name.h \ >+ hal-setup-keymap-hash-name.gperf \ >+ hal-setup-keymap-keys.txt >+ >+BUILT_SOURCES += \ >+ hal-setup-keymap-hash-name.h \ >+ hal-setup-keymap-hash-name.gperf \ >+ hal-setup-keymap-keys.txt >+endif >+ > check: > for f in $(script_SCRIPTS); do \ > echo -n "Validate bash syntax in $$f : "; \ >--- hal-0.5.8.1.orig/hald/linux/classdev.c 2008-05-31 04:59:41.000000000 +0530 >+++ hal-0.5.8.1/hald/linux/classdev.c 2008-05-31 07:43:49.000000000 +0530 >@@ -69,6 +69,7 @@ > if (physdev != NULL) { > hal_device_property_set_string (d, "input.physical_device", physdev->udi); > hal_device_property_set_string (d, "info.parent", physdev->udi); >+ hal_device_property_set_string (d, "input.originating_device", physdev->udi); > } else { > hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer"); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 450326
:
308549
| 308550