rpms/hal/OLPC-2 hald-only-grab-olpc.patch, NONE, 1.1 hal.spec, 1.140, 1.141 hal-grab-input.patch, 1.1, NONE

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Fri Jul 20 23:01:03 UTC 2007


Author: dcbw

Update of /cvs/extras/rpms/hal/OLPC-2
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1529

Modified Files:
	hal.spec 
Added Files:
	hald-only-grab-olpc.patch 
Removed Files:
	hal-grab-input.patch 
Log Message:
* Fri Jul 20 2007 Dan Williams <dcbw at redhat.com> - 0.5.10-0.4.20070710git
- Only grab OLPC input devices, not, for example, QEMU ones


hald-only-grab-olpc.patch:

--- NEW FILE hald-only-grab-olpc.patch ---
diff --git a/hald/linux/addons/addon-input.c b/hald/linux/addons/addon-input.c
index 2ba923b..5ebba08 100644
--- a/hald/linux/addons/addon-input.c
+++ b/hald/linux/addons/addon-input.c
@@ -39,6 +39,7 @@
 #include <linux/input.h>
 #include <glib/gmain.h>
 #include <glib/gprintf.h>
+#include <glib/gstring.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
 #include "libhal/libhal.h"
@@ -346,7 +347,8 @@ add_device (LibHalContext *ctx,
 	InputData *data;
 	int len = strlen (udi);
 	const char* device_file;
-
+	char name[256] = "Unknown"; /* input device name */
+	
 	data = (InputData*) g_malloc (sizeof (InputData) + len);
 
 	memcpy (&(data->udi), udi, len+1);
@@ -377,6 +379,18 @@ add_device (LibHalContext *ctx,
 	channel = g_io_channel_unix_new (eventfp);
 	g_io_channel_set_encoding (channel, NULL, NULL);
 
+	/* Get the name of the device. */
+	if (ioctl(g_io_channel_unix_get_fd(channel), EVIOCGNAME(sizeof(name)), name) >= 0)
+		HAL_DEBUG (("Input device name: \"%s\"\n", name));
+	else
+		HAL_DEBUG (("ioctl EVIOCGRAB failed"));
+
+	if ((g_ascii_strncasecmp("OLPC ", name, 5) == 0)) {
+		/* 0: PM, 1: lid switch, 2: ebook sensor */
+		HAL_DEBUG (("grabbing %s\n", device_file));
+		if (ioctl(g_io_channel_unix_get_fd(channel), EVIOCGRAB, (void *)1) < 0)
+        		HAL_DEBUG (("ioctl EVIOCGRAB failed"));
+	}
 	g_hash_table_insert (inputs, g_strdup(udi), channel);
 	g_io_add_watch_full (channel,
 			     G_PRIORITY_DEFAULT, G_IO_IN | G_IO_ERR | G_IO_HUP,


Index: hal.spec
===================================================================
RCS file: /cvs/extras/rpms/hal/OLPC-2/hal.spec,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -r1.140 -r1.141
--- hal.spec	16 Jul 2007 02:00:34 -0000	1.140
+++ hal.spec	20 Jul 2007 23:00:30 -0000	1.141
@@ -26,13 +26,13 @@
 Summary: Hardware Abstraction Layer
 Name: hal
 Version: 0.5.10
-Release: 0.3.%{alphatag}%{?dist}
+Release: 0.4.%{alphatag}%{?dist}
 URL: http://www.freedesktop.org/Software/hal
 Source0: http://people.freedesktop.org/~david/dist/%{name}-%{version}-0.%{alphatag}.tar.gz
 Source1: 99-redhat-storage-policy-fixed-drives.fdi
 
 # OLPC specific
-Patch0: hal-grab-input.patch
+Patch0: hald-only-grab-olpc.patch
 
 License: AFL/GPL
 Group: System Environment/Libraries
@@ -242,6 +242,9 @@
 %{_datadir}/gtk-doc/html/libhal-storage/*
 
 %changelog
+* Fri Jul 20 2007 Dan Williams <dcbw at redhat.com> - 0.5.10-0.4.20070710git
+- Only grab OLPC input devices, not, for example, QEMU ones
+
 * Sun Jul 15 2007 Dan Williams <dcbw at redhat.com> - 0.5.10-0.3.20070710git
 - Grab input devices that OHM will use away from X so X doesn't have them
   exclusively (patch from Chris Ball)


--- hal-grab-input.patch DELETED ---




More information about the scm-commits mailing list