aboutsummaryrefslogtreecommitdiff
path: root/x11-servers
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2009-02-04 18:31:01 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2009-02-04 18:31:01 +0000
commit68bcf49d3692c9e4c78ede27db7006bed405c863 (patch)
treef87fbd5e66933ae3a387a658250950d751fd1860 /x11-servers
parent2560dc431d4315cdfc562a3d357badf58c5bf223 (diff)
downloadports-68bcf49d3692c9e4c78ede27db7006bed405c863.tar.gz
ports-68bcf49d3692c9e4c78ede27db7006bed405c863.zip
- Replace open(2)/close(2) pairs with stat(2). Closing mouse device has
a side effect of changing current operation level and sysmouse(4) lets you open /dev/sysmouse multiple times unlike other mouse drivers. - Check if /dev/mouse is linked to /dev/psm0 or /dev/ums0. - Simplify the patches a little while I am here.
Notes
Notes: svn path=/head/; revision=227623
Diffstat (limited to 'x11-servers')
-rw-r--r--x11-servers/xorg-server/Makefile2
-rw-r--r--x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c88
2 files changed, 62 insertions, 28 deletions
diff --git a/x11-servers/xorg-server/Makefile b/x11-servers/xorg-server/Makefile
index 03602f20ab0b..133cbc7caa3f 100644
--- a/x11-servers/xorg-server/Makefile
+++ b/x11-servers/xorg-server/Makefile
@@ -8,7 +8,7 @@
PORTNAME= xorg-server
PORTVERSION= 1.5.3
PORTEPOCH= 1
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= x11-servers
MASTER_SITES= http://xorg.freedesktop.org/releases/individual/xserver/
DISTFILES= xorg-server-${PORTVERSION}.tar.bz2
diff --git a/x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c b/x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c
index ebfb02c8e37b..4d6e1f91b1f2 100644
--- a/x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c
+++ b/x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c
@@ -1,5 +1,5 @@
--- hw/xfree86/os-support/bsd/bsd_mouse.c.orig 2008-11-05 11:52:17.000000000 -0500
-+++ hw/xfree86/os-support/bsd/bsd_mouse.c 2009-02-02 15:56:11.000000000 -0500
++++ hw/xfree86/os-support/bsd/bsd_mouse.c 2009-02-04 12:54:48.000000000 -0500
@@ -1,4 +1,3 @@
-
/*
@@ -65,29 +65,25 @@
int i;
mousehw_t hw;
mousemode_t mode;
-@@ -191,10 +217,20 @@
+@@ -191,10 +217,16 @@
if (pInfo->fd == -1)
return NULL;
+#ifdef XPS2_SUPPORT
/* set the driver operation level, if applicable */
-+ if ((dev = xf86FindOptionValue(pInfo->options, "Device"))) {
-+ if (!strncmp(dev, DEFAULT_PS2_DEV, 8))
-+ i = 2;
-+ else
-+ i = 1;
-+ ioctl(pInfo->fd, MOUSE_SETLEVEL, &i);
-+ }
-+#else
++ dev = xf86FindOptionValue(pInfo->options, "Device");
++ if (dev != NULL && !strncmp(dev, DEFAULT_PS2_DEV, 8))
++ i = 2;
++ else
++#endif
i = 1;
ioctl(pInfo->fd, MOUSE_SETLEVEL, &i);
-
-+#endif
+
/* interrogate the driver and get some intelligence on the device. */
hw.iftype = MOUSE_IF_UNKNOWN;
hw.model = MOUSE_MODEL_GENERIC;
-@@ -210,9 +246,18 @@
+@@ -210,9 +242,18 @@
protoPara[0] = mode.syncmask[0];
protoPara[1] = mode.syncmask[1];
}
@@ -108,7 +104,7 @@
}
}
}
-@@ -235,41 +280,41 @@
+@@ -235,41 +276,41 @@
(protocol && xf86NameCmp(protocol, "SysMouse") == 0)) {
/*
* As the FreeBSD sysmouse driver defaults to protocol level 0
@@ -167,10 +163,48 @@
}
return FALSE;
}
-@@ -309,15 +354,23 @@
+@@ -277,17 +318,17 @@
+ static const char *
+ FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
+ {
+- int fd = -1;
++ int ret = -1;
+ const char **pdev, *dev = NULL;
+ Bool devMouse = FALSE;
+ struct stat devMouseStat;
+ struct stat sb;
+
+ for (pdev = mouseDevs; *pdev; pdev++) {
+- SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
+- if (fd == -1) {
++ SYSCALL (ret = stat(*pdev, &sb));
++ if (ret == -1) {
+ #ifdef DEBUG
+- ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno));
++ ErrorF("Cannot stat %s (%s)\n", *pdev, strerror(errno));
+ #endif
+ } else {
+ /*
+@@ -296,28 +337,32 @@
+ * the test for whether /dev/sysmouse is usable can be made.
+ */
+ if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) {
+- if (fstat(fd, &devMouseStat) == 0)
+- devMouse = TRUE;
+- close(fd);
++ memcpy(&devMouseStat, &sb, sizeof(devMouseStat));
++ devMouse = TRUE;
+ continue;
+ } else if (!strcmp(*pdev, DEFAULT_SYSMOUSE_DEV)) {
+ /* Check if /dev/mouse is the same as /dev/sysmouse. */
+- if (devMouse && fstat(fd, &sb) == 0 &&
+- devMouseStat.st_dev == sb.st_dev &&
++ if (devMouse && devMouseStat.st_dev == sb.st_dev &&
+ devMouseStat.st_ino == sb.st_ino) {
+ /* If the same, use /dev/sysmouse. */
devMouse = FALSE;
}
- close(fd);
+- close(fd);
- if (MousedRunning())
+ if (MousedRunning(NULL))
break;
@@ -180,24 +214,24 @@
-#endif
- }
} else {
- close(fd);
-+ /*
-+ * If moused(8) owns the device, open(2) should have failed
-+ * but just in case...
-+ */
+- close(fd);
++ /* Check if /dev/mouse is the same as this device. */
++ if (devMouse && devMouseStat.st_dev == sb.st_dev &&
++ devMouseStat.st_ino == sb.st_ino) {
++ /* If the same, use this device. */
++ devMouse = FALSE;
++ }
+ if (MousedRunning(*pdev))
+ continue;
-+ /*
-+ * ums(4) does not support anything but SysMouse protocol.
-+ */
++ /* ums(4) does not support anything but SysMouse protocol. */
+ if (!strncmp(*pdev, DEFAULT_USB_DEV, 8) && protocol &&
-+ strcasecmp(protocol, "auto") &&
-+ strcasecmp(protocol, "sysmouse"))
-+ continue;
++ xf86NameCmp(protocol, "auto") != 0 &&
++ xf86NameCmp(protocol, "sysmouse") != 0)
++ continue;
break;
}
}
-@@ -775,7 +828,9 @@
+@@ -775,7 +820,9 @@
p->CheckProtocol = CheckProtocol;
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE)
p->SetupAuto = SetupAuto;