From d25360c7a5abe5d2774648f8f268672d62d38759 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Tue, 15 Apr 2008 18:01:15 +0000 Subject: [PATCH] - Auto-detect and use native extended PS/2 protocols with the latest psm(4). Since psm has gained write(2) support, it can be directly driven by X.org input drivers without help of moused(8) or SysMouse protocol. - Fix regressions without moused running. PR: ports/122363, ports/122405 --- x11-servers/xorg-server/Makefile | 2 +- ...rver-hw-xfree86-os-support-bsd-bsd_mouse.c | 121 +++++++++++++----- ...Xserver-hw-xfree86-os-support-xf86_OSlib.h | 12 ++ 3 files changed, 102 insertions(+), 33 deletions(-) create mode 100644 x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-xf86_OSlib.h diff --git a/x11-servers/xorg-server/Makefile b/x11-servers/xorg-server/Makefile index 4f2695587268..64bb6924949a 100644 --- a/x11-servers/xorg-server/Makefile +++ b/x11-servers/xorg-server/Makefile @@ -7,7 +7,7 @@ PORTNAME= xorg-server PORTVERSION= 1.4 -PORTREVISION= 7 +PORTREVISION= 8 PORTEPOCH= 1 CATEGORIES= x11-servers MASTER_SITES= http://xorg.freedesktop.org/releases/individual/xserver/:fdo \ 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 325604ea277c..ecb848b22600 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 2007-08-23 15:05:48.000000000 -0400 -+++ hw/xfree86/os-support/bsd/bsd_mouse.c 2008-03-28 13:49:17.000000000 -0400 ++++ hw/xfree86/os-support/bsd/bsd_mouse.c 2008-04-08 15:41:42.000000000 -0400 @@ -1,4 +1,3 @@ - /* @@ -21,57 +21,97 @@ NULL }; #elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT) -@@ -184,6 +187,7 @@ +@@ -101,7 +104,11 @@ + #if defined(__NetBSD__) + return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; + #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +- return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC; ++ return MSE_SERIAL | MSE_BUS | MSE_PS2 | ++#ifdef XPS2_SUPPORT ++ MSE_XPS2 | ++#endif ++ MSE_AUTO | MSE_MISC; + #else + return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO; + #endif +@@ -180,10 +187,31 @@ + { MOUSE_PROTO_THINK, "ThinkingMouse" }, + { MOUSE_PROTO_SYSMOUSE, "SysMouse" } + }; +- ++ ++#ifdef XPS2_SUPPORT ++static struct { ++ int dmodel; ++ char *name; ++} ps2proto[] = { ++ { MOUSE_MODEL_NETSCROLL, "NetScrollPS/2" }, ++ { MOUSE_MODEL_NET, "NetMousePS/2" }, ++ { MOUSE_MODEL_GLIDEPOINT, "GlidePointPS/2" }, ++ { MOUSE_MODEL_THINK, "ThinkingMousePS/2" }, ++ { MOUSE_MODEL_INTELLI, "IMPS/2" }, ++ { MOUSE_MODEL_MOUSEMANPLUS, "MouseManPlusPS/2" }, ++ { MOUSE_MODEL_EXPLORER, "ExplorerPS/2" }, ++ { MOUSE_MODEL_4D, "IMPS/2" }, ++ { MOUSE_MODEL_4DPLUS, "IMPS/2" }, ++}; ++#endif ++ static const char * SetupAuto(InputInfoPtr pInfo, int *protoPara) { ++#ifdef XPS2_SUPPORT + char *dev; ++#endif ++ const char *proto; int i; mousehw_t hw; mousemode_t mode; -@@ -192,9 +196,12 @@ +@@ -191,10 +219,20 @@ + if (pInfo->fd == -1) return NULL; ++#ifdef XPS2_SUPPORT /* set the driver operation level, if applicable */ -- i = 1; -- ioctl(pInfo->fd, MOUSE_SETLEVEL, &i); -- -+ if ((dev = xf86FindOptionValue(pInfo->options, "Device")) && -+ !strcmp(dev, DEFAULT_SYSMOUSE_DEV)) { -+ i = 1; ++ 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 + 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,8 +217,8 @@ +@@ -210,9 +248,18 @@ protoPara[0] = mode.syncmask[0]; protoPara[1] = mode.syncmask[1]; } -- xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", ++ proto = devproto[i].name; ++#ifdef XPS2_SUPPORT ++ if (mode.protocol == MOUSE_PROTO_PS2) ++ for (i = 0; i < sizeof(ps2proto)/sizeof(ps2proto[0]); ++i) ++ if (hw.model == ps2proto[i].dmodel) { ++ proto = ps2proto[i].name; ++ break; ++ } ++#endif + xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n", - pInfo->name, devproto[i].name); -+ xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s, level is %d\n", -+ pInfo->name, devproto[i].name, mode.level); - return devproto[i].name; +- return devproto[i].name; ++ pInfo->name, proto); ++ return proto; } } -@@ -222,6 +229,7 @@ - static void - SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res) - { -+ char *dev; - mousemode_t mode; - MouseDevPtr pMse; - -@@ -231,11 +239,11 @@ - mode.resolution = res > 0 ? res : -1; - mode.accelfactor = -1; - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -- if (pMse->autoProbe || -- (protocol && xf86NameCmp(protocol, "SysMouse") == 0)) { -+ if ((dev = xf86FindOptionValue(pInfo->options, "Device")) && -+ !strcmp(dev, DEFAULT_SYSMOUSE_DEV)) { + } +@@ -235,41 +282,41 @@ + (protocol && xf86NameCmp(protocol, "SysMouse") == 0)) { /* * As the FreeBSD sysmouse driver defaults to protocol level 0 - * everytime it is opened we enforce protocol level 1 again at @@ -79,7 +119,14 @@ * this point. */ mode.level = 1; -@@ -249,27 +257,29 @@ + } else +- mode.level = -1; +-#else +- mode.level = -1; + #endif ++ mode.level = -1; + ioctl(pInfo->fd, MOUSE_SETMODE, &mode); + } #endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) @@ -122,7 +169,7 @@ } return FALSE; } -@@ -309,15 +319,12 @@ +@@ -309,15 +356,12 @@ devMouse = FALSE; } close(fd); @@ -141,3 +188,13 @@ break; } } +@@ -775,7 +819,9 @@ + p->CheckProtocol = CheckProtocol; + #if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE) + p->SetupAuto = SetupAuto; ++#ifndef XPS2_SUPPORT + p->SetPS2Res = SetSysMouseRes; ++#endif + p->SetBMRes = SetSysMouseRes; + p->SetMiscRes = SetSysMouseRes; + #endif diff --git a/x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-xf86_OSlib.h b/x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-xf86_OSlib.h new file mode 100644 index 000000000000..169034d2a7bf --- /dev/null +++ b/x11-servers/xorg-server/files/patch-Xserver-hw-xfree86-os-support-xf86_OSlib.h @@ -0,0 +1,12 @@ +--- hw/xfree86/os-support/xf86_OSlib.h.orig 2007-08-23 15:04:53.000000000 -0400 ++++ hw/xfree86/os-support/xf86_OSlib.h 2008-04-08 16:20:04.000000000 -0400 +@@ -495,6 +495,9 @@ + # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) + # if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013) + # include ++# if (__FreeBSD_kernel_version >= 700106) ++# define XPS2_SUPPORT ++# endif + # else + # undef MOUSE_GETINFO + # include