[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#259080: xserver-xfree86: Please special case mouse setup for GNU/Hurd



Hi,

Better way: making /dev/mouse the default :)
Here is a patch.

Samuel
--- hw/xfree86/os-support/hurd/hurd_mouse.c.orig	2007-08-11 23:02:09.000000000 +0200
+++ hw/xfree86/os-support/hurd/hurd_mouse.c	2007-08-11 23:10:46.785313000 +0200
@@ -47,6 +47,8 @@
 #include <mach.h>
 #include <sys/ioctl.h>
 
+#define DEFAULT_MOUSE_DEV	"/dev/mouse"
+
 typedef unsigned short kev_type;		/* kd event type */
 typedef unsigned char Scancode;
 
@@ -247,6 +249,26 @@
     return TRUE;
 }
 
+static const char *
+FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+    const char path[] = DEFAULT_MOUSE_DEV;
+    int fd;
+
+    SYSCALL (fd = open(path, O_RDWR | O_NONBLOCK | O_EXCL));
+
+    if (fd == -1)
+	return NULL;
+
+    close(fd);
+    pInfo->conf_idev->commonOptions = 
+	xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", path);
+    xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", pInfo->name,
+	    path);
+
+    return path;
+}
+
 static int
 SupportedInterfaces(void)
 {
@@ -276,7 +298,6 @@
     return FALSE;
 }
 
-/* XXX Is this appropriate?  If not, this function should be removed. */
 static const char *
 DefaultProtocol(void)
 {
@@ -293,6 +314,7 @@
 	return NULL;
     p->SupportedInterfaces = SupportedInterfaces;
     p->BuiltinNames = BuiltinNames;
+    p->FindDevice = FindDevice;
     p->DefaultProtocol = DefaultProtocol;
     p->CheckProtocol = CheckProtocol;
     p->PreInit = OsMousePreInit;

Reply to: