pkgsrc-WIP-changes archive

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

xf86-input-ws: Import xf86-input-ws-1.3.0.20151010 as wip/xf86-input-ws-dfbsd



Module Name:	pkgsrc-wip
Committed By:	David Shao <davshao%gmail.com@localhost>
Pushed By:	dshao
Date:		Mon Jul 22 22:24:30 2019 -0700
Changeset:	09d4ce258c82fde1c03ffa9ab949282fac4bbfb0

Modified Files:
	Makefile
Added Files:
	xf86-input-ws-dfbsd/DESCR
	xf86-input-ws-dfbsd/MESSAGE
	xf86-input-ws-dfbsd/Makefile
	xf86-input-ws-dfbsd/PLIST
	xf86-input-ws-dfbsd/distinfo
	xf86-input-ws-dfbsd/patches/patch-src_emumb.c
	xf86-input-ws-dfbsd/patches/patch-src_emuwheel.c
	xf86-input-ws-dfbsd/patches/patch-src_ws.c
	xf86-input-ws-dfbsd/patches/patch-src_ws.h

Log Message:
xf86-input-ws: Import xf86-input-ws-1.3.0.20151010 as wip/xf86-input-ws-dfbsd

Try to merge patches from NetBSD xsrc

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=09d4ce258c82fde1c03ffa9ab949282fac4bbfb0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                         |   1 +
 xf86-input-ws-dfbsd/DESCR                        |   1 +
 xf86-input-ws-dfbsd/MESSAGE                      |  12 ++
 xf86-input-ws-dfbsd/Makefile                     |  87 ++++++++
 xf86-input-ws-dfbsd/PLIST                        |   4 +
 xf86-input-ws-dfbsd/distinfo                     |  10 +
 xf86-input-ws-dfbsd/patches/patch-src_emumb.c    |  81 ++++++++
 xf86-input-ws-dfbsd/patches/patch-src_emuwheel.c |  33 ++++
 xf86-input-ws-dfbsd/patches/patch-src_ws.c       | 240 +++++++++++++++++++++++
 xf86-input-ws-dfbsd/patches/patch-src_ws.h       |  42 ++++
 10 files changed, 511 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 150eea00e2..5eea68a121 100644
--- a/Makefile
+++ b/Makefile
@@ -5009,6 +5009,7 @@ SUBDIR+=	xesam-glib
 SUBDIR+=	xf86-input-mouse-dfbsd
 SUBDIR+=	xf86-input-synaptics
 SUBDIR+=	xf86-input-vboxmouse
+SUBDIR+=	xf86-input-ws-dfbsd
 SUBDIR+=	xf86-video-ati-dfbsd
 SUBDIR+=	xf86-video-geode
 SUBDIR+=	xf86-video-intel-dfbsd
diff --git a/xf86-input-ws-dfbsd/DESCR b/xf86-input-ws-dfbsd/DESCR
new file mode 100644
index 0000000000..837ca787ee
--- /dev/null
+++ b/xf86-input-ws-dfbsd/DESCR
@@ -0,0 +1 @@
+Matthieu Herrb's wscons pointing device driver for modular X.org.
diff --git a/xf86-input-ws-dfbsd/MESSAGE b/xf86-input-ws-dfbsd/MESSAGE
new file mode 100644
index 0000000000..dfa288146c
--- /dev/null
+++ b/xf86-input-ws-dfbsd/MESSAGE
@@ -0,0 +1,12 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2015/10/10 20:02:52 tnn Exp $
+
+To use this driver, your xorg.conf file should have an entry like this:
+
+	Identifier  	"Mouse0"
+	Driver      	"ws"
+	Option		"Device"	"/dev/wsmouse"
+
+This should work with many wscons pointing devices, especially the zaurus.
+Please see the ws(4) manual page for more information.
+===========================================================================
diff --git a/xf86-input-ws-dfbsd/Makefile b/xf86-input-ws-dfbsd/Makefile
new file mode 100644
index 0000000000..294176a3d2
--- /dev/null
+++ b/xf86-input-ws-dfbsd/Makefile
@@ -0,0 +1,87 @@
+# $NetBSD: Makefile,v 1.3 2018/03/07 11:57:42 wiz Exp $
+
+DISTNAME=	xf86-input-ws-1.3.0.20151010
+PKGREVISION=	2
+CATEGORIES=	x11
+MASTER_SITES=	${MASTER_SITE_LOCAL}
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	http://xenocara.org/
+COMMENT=	OpenBSDs wscons input driver for modular X.org
+
+ONLY_FOR_PLATFORM=	NetBSD-*-* OpenBSD-*-*
+
+GNU_CONFIGURE=	yes
+USE_LIBTOOL=	yes
+USE_TOOLS+=	pkg-config
+
+.include "../../mk/bsd.prefs.mk"
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.xf86-input-ws
+
+PKG_SUPPORTED_OPTIONS=
+PKG_SUGGESTED_OPTIONS=
+
+PKG_SUPPORTED_OPTIONS+= keyboard_button_xsrc_netbsd
+# .if ${OPSYS} == "NetBSD"
+# PKG_SUGGESTED_OPTIONS+= keyboard_button_xsrc_netbsd
+# .endif
+
+PKG_SUPPORTED_OPTIONS+= undef_tpanel_xsrc_netbsd
+.if ${OPSYS} == "NetBSD"
+PKG_SUGGESTED_OPTIONS+= undef_tpanel_xsrc_netbsd
+.endif
+
+PKG_SUPPORTED_OPTIONS+= calibration_kernel_xsrc_netbsd
+.if ${OPSYS} == "NetBSD"
+PKG_SUGGESTED_OPTIONS+= calibration_kernel_xsrc_netbsd
+.endif
+
+PKG_SUPPORTED_OPTIONS+= strict_xsrc_netbsd
+.if ${OPSYS} == "NetBSD"
+PKG_SUGGESTED_OPTIONS+= strict_xsrc_netbsd
+.endif
+
+PKG_SUPPORTED_OPTIONS+= read_eio_xenocara_openbsd
+.if ${OPSYS} == "OpenBSD"
+PKG_SUGGESTED_OPTIONS+= read_eio_xenocara_openbsd
+.endif
+
+PKG_SUPPORTED_OPTIONS+= strict_xenocara_openbsd
+.if ${OPSYS} == "NetBSD" || ${OPSYS} == "OpenBSD"
+PKG_SUGGESTED_OPTIONS+= strict_xenocara_openbsd
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mkeyboard_button_xsrc_netbsd)
+CPPFLAGS+=	-DKEYBOARD_BUTTON_XSRC_NETBSD
+.endif
+
+.if !empty(PKG_OPTIONS:Mundef_tpanel_xsrc_netbsd)
+CPPFLAGS+=	-DUNDEF_TPANEL_XSRC_NETBSD
+.endif
+
+.if !empty(PKG_OPTIONS:Mcalibration_kernel_xsrc_netbsd)
+CPPFLAGS+=	-DCALIBRATION_KERNEL_XSRC_NETBSD
+.endif
+
+.if !empty(PKG_OPTIONS:Mstrict_xsrc_netbsd)
+CPPFLAGS+=	-DSTRICT_XSRC_NETBSD
+.endif
+
+.if !empty(PKG_OPTIONS:Mstrict_xenocara_openbsd)
+CPPFLAGS+=	-DSTRICT_XENOCARA_OPENBSD
+.endif
+
+.if !empty(PKG_OPTIONS:Mread_eio_xenocara_openbsd)
+CPPFLAGS+=	-DREAD_EIO_XENOCARA_OPENBSD
+.endif
+
+.if !empty(PKG_OPTIONS:Mstrict_xenocara_openbsd)
+CPPFLAGS+=	-DSTRICT_XENOCARA_OPENBSD
+.endif
+
+.include "../../x11/modular-xorg-server/buildlink3.mk"
+.include "../../x11/xorgproto/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/xf86-input-ws-dfbsd/PLIST b/xf86-input-ws-dfbsd/PLIST
new file mode 100644
index 0000000000..30c74e4079
--- /dev/null
+++ b/xf86-input-ws-dfbsd/PLIST
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST,v 1.1 2015/10/10 20:02:52 tnn Exp $
+include/xorg/ws-properties.h
+lib/xorg/modules/input/ws_drv.la
+man/man4/ws.4
diff --git a/xf86-input-ws-dfbsd/distinfo b/xf86-input-ws-dfbsd/distinfo
new file mode 100644
index 0000000000..b5703e947f
--- /dev/null
+++ b/xf86-input-ws-dfbsd/distinfo
@@ -0,0 +1,10 @@
+$NetBSD: distinfo,v 1.3 2015/12/18 11:19:12 taca Exp $
+
+SHA1 (xf86-input-ws-1.3.0.20151010.tar.gz) = c8951b6e2d0dd3f741948bb6e1ae28e0966bec90
+RMD160 (xf86-input-ws-1.3.0.20151010.tar.gz) = a3e66b571f791f3d1ddac6d9e477cdc28faa5952
+SHA512 (xf86-input-ws-1.3.0.20151010.tar.gz) = de347b98cb508c363ffb422ad1249ad069eae77222da03a875b15b0367ffee580f580a7f671adfb9e621c6b49f2d4772e85887ebbd851c2317630ea3780b497b
+Size (xf86-input-ws-1.3.0.20151010.tar.gz) = 323648 bytes
+SHA1 (patch-src_emumb.c) = dc1252e857ec221a0be3233de3c37e16838446da
+SHA1 (patch-src_emuwheel.c) = ed10282dba2c13ef30674c96c32a5d1d170aca0c
+SHA1 (patch-src_ws.c) = 7cc275723f673ddbca3af9c8af8fa51232216a57
+SHA1 (patch-src_ws.h) = 381799f4159de5ec5dead114816ff2681e9a4874
diff --git a/xf86-input-ws-dfbsd/patches/patch-src_emumb.c b/xf86-input-ws-dfbsd/patches/patch-src_emumb.c
new file mode 100644
index 0000000000..8b33c14fe1
--- /dev/null
+++ b/xf86-input-ws-dfbsd/patches/patch-src_emumb.c
@@ -0,0 +1,81 @@
+$NetBSD: patch-src_emumb.c,v 1.1 2015/12/18 11:19:12 taca Exp $
+
+* Fix build problem NetBSD 7.0_STABLE.
+
+* fix various errors and warnings with xorg-server 1.20:
+
+Option to skip property if keyboard
+
+--- src/emumb.c.orig	2012-07-08 14:22:03.000000000 +0000
++++ src/emumb.c
+@@ -36,6 +36,11 @@
+ #include "config.h"
+ #endif
+ 
++#if defined(STRICT_XSRC_NETBSD)
++#include <sys/types.h>
++#endif
++#include <sys/time.h>
++
+ #include <xorg-server.h>
+ #include <X11/Xatom.h>
+ #include <xf86.h>
+@@ -273,7 +278,17 @@ wsmbEmuFilterEvent(InputInfoPtr pInfo, i
+ }
+ 
+ void
++#if defined(STRICT_XSRC_NETBSD)
++wsmbEmuWakeupHandler(pointer data,
++/* XXX compat-api.h */
++    int i
++#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(23, 0)
++    , pointer LastSelectMask
++#endif
++    )
++#else /* !STRICT_XSRC_NETBSD */
+ wsmbEmuWakeupHandler(pointer data, int i, pointer LastSelectMask)
++#endif /* STRICT_XSRC_NETBSD */
+ {
+ 	InputInfoPtr pInfo = (InputInfoPtr)data;
+ 	WSDevicePtr priv = (WSDevicePtr)pInfo->private;
+@@ -287,8 +302,16 @@ wsmbEmuWakeupHandler(pointer data, int i
+ }
+ 
+ void
++#if defined(STRICT_XSRC_NETBSD)
++wsmbEmuBlockHandler(pointer data,
++#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(23, 0)
++    struct timeval **waitTime,
++#endif
++    pointer LastSelectMask)
++#else /* !STRICT_XSRC_NETBSD */
+ wsmbEmuBlockHandler(pointer data, struct timeval **waitTime,
+     pointer LastSelectMask)
++#endif /* STRICT_XSRC_NETBSD */
+ {
+ 	InputInfoPtr pInfo = (InputInfoPtr)data;
+ 	WSDevicePtr priv = (WSDevicePtr)pInfo->private;
+@@ -298,7 +321,11 @@ wsmbEmuBlockHandler(pointer data, struct
+ 		ms = priv->emulateMB.expires - GetTimeInMillis();
+ 		if (ms <= 0)
+ 			ms = 0;
++#if defined(STRICT_XSRC_NETBSD)
++#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(23, 0)
+ 		AdjustWaitForDelay(waitTime, ms);
++#endif
++#endif
+ 	}
+ }
+ 
+@@ -391,6 +418,11 @@ wsmbEmuInitProperty(DeviceIntPtr dev)
+ 
+ 	DBG(1, ErrorF("wsmbEmuInitProperty\n"));
+ 
++#if defined(KEYBOARD_BUTTON_XSRC_NETBSD)
++	if (!dev->button) /* don't init prop for keyboards */
++		return;
++#endif
++
+ 	prop_mbemu = MakeAtom(WS_PROP_MIDBUTTON,
+ 	    strlen(WS_PROP_MIDBUTTON), TRUE);
+ 	rc = XIChangeDeviceProperty(dev, prop_mbemu, XA_INTEGER, 8,
diff --git a/xf86-input-ws-dfbsd/patches/patch-src_emuwheel.c b/xf86-input-ws-dfbsd/patches/patch-src_emuwheel.c
new file mode 100644
index 0000000000..ecd034f43a
--- /dev/null
+++ b/xf86-input-ws-dfbsd/patches/patch-src_emuwheel.c
@@ -0,0 +1,33 @@
+$NetBSD: patch-src_emuwheel.c,v 1.1 2015/12/18 11:19:12 taca Exp $
+
+* Fix build problem NetBSD 7.0_STABLE.
+
+OpenBSD xenocara:
+
+Jun 18 20:07:30 2018 UTC
+* Improve the wheel emulation logic.  Make the axis filtering symmetrical,
+and less restrictive for vertical scrolling.
+
+--- src/emuwheel.c.orig	2012-07-08 13:51:11.000000000 +0000
++++ src/emuwheel.c
+@@ -36,6 +36,8 @@
+ #include "config.h"
+ #endif
+ 
++#include <sys/time.h>
++
+ #include <xorg-server.h>
+ #include <X11/Xatom.h>
+ #include <xf86.h>
+@@ -113,7 +115,11 @@ wsWheelEmuFilterMotion(InputInfoPtr pInf
+ 				return TRUE;
+ 		}
+ 
++#if defined(STRICT_XENOCARA_OPENBSD)
++		if (abs(dx) > abs(dy)) {
++#else
+ 		if (dx) {
++#endif
+ 			pAxis = &(priv->emulateWheel.X);
+ 			pOtherAxis = &(priv->emulateWheel.Y);
+ 			value = dx;
diff --git a/xf86-input-ws-dfbsd/patches/patch-src_ws.c b/xf86-input-ws-dfbsd/patches/patch-src_ws.c
new file mode 100644
index 0000000000..e6ea3e7d64
--- /dev/null
+++ b/xf86-input-ws-dfbsd/patches/patch-src_ws.c
@@ -0,0 +1,240 @@
+$NetBSD: patch-src_ws.c,v 1.1 2015/10/10 20:02:52 tnn Exp $
+
+OpenBSD xenocara option:
+
+Dec 31 23:31:41 2017 UTC
+If read() returns EIO, then the wsmouse device has gone away and our fd
+to it is useless, so detach the xserver driver and close it.
+Modeled on similar code in xf86-input-{keyboard,mouse}
+
+NetBSD xsrc option
+
+Apr 14 19:19:43 2017 UTC
+be somewhat smarter with mux devices:
+- don't trust the device type, if we're on a mux that may not be the whole
+  story
+- always call ioctl(WSMOUSEIO_GCALIBCOORDS)
+- check .samplelen to see if we're in raw mode
+With this touchscreens on mux devices should Just Work(tm) even if they're
+not the first device on the mux.
+
+Apr 6 20:55:03 2017 UTC
+we can get calibration data from the kernel now
+
+Sep 26 14:47:53 2011 UTC
+Restore #ifndef __NetBSD__ portitions (disabling OpenBSD specific TPANEL stuff?)
+which were accidentally removed in rev 1.4:
+this fixes WSMOUSEIO_SCALIBCOORDS ioctl errors
+and coredumps after the driver is loaded on hpcarm W-ZERO3.
+
+--- src/ws.c.orig	2015-08-29 08:48:29.000000000 +0000
++++ src/ws.c
+@@ -213,6 +213,49 @@ wsPreInit(InputDriverPtr drv, InputInfoP
+ 		goto fail;
+ 	if (ioctl(pInfo->fd, WSMOUSEIO_GTYPE, &priv->type) != 0)
+ 		goto fail;
++
++#if defined(CALIBRATION_KERNEL_XSRC_NETBSD)
++
++	/* assume screen coordinate space until proven wrong */
++	priv->min_x = 0;
++	priv->max_x = screenInfo.screens[priv->screen_no]->width - 1;
++	priv->min_y = 0;
++	priv->max_y = screenInfo.screens[priv->screen_no]->height - 1;
++	priv->raw = 0;
++
++	/* don't rely on the device type - we may be listening to a mux */		
++	if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS,
++		&priv->coords) != 0) {
++		/* can't get absolute coordinate space - assume mouse */
++		pInfo->type_name = XI_MOUSE;
++	} else if (priv->coords.samplelen == WSMOUSE_CALIBCOORDS_RESET) {
++		/*
++		 * we're getting raw coordinates - update accordingly and hope
++		 * that there is no other absolute positioning device on the
++		 * same mux
++		 */
++		priv->min_x = priv->coords.minx;
++		priv->max_x = priv->coords.maxx;
++		priv->min_y = priv->coords.miny;
++		priv->max_y = priv->coords.maxy;
++		priv->raw = 1;
++		pInfo->type_name = XI_TOUCHSCREEN;
++	} else {
++		/*
++		 * touchscreen not in raw mode, should send us screen
++		 * coordinates 
++		 */
++		pInfo->type_name = XI_TOUCHSCREEN;
++	}
++
++	if (priv->raw) {
++		xf86Msg(X_CONFIG,
++		    "%s device will work in raw mode\n",
++		    pInfo->name);
++	}
++
++#else /* !CALIBRATION_KERNEL_XSRC_NETBSD */
++
+ 	if (priv->type == WSMOUSE_TYPE_TPANEL) {
+ 		pInfo->type_name = XI_TOUCHSCREEN;
+ 		priv->raw = xf86SetBoolOption(pInfo->options, "Raw", 1);
+@@ -245,6 +288,9 @@ wsPreInit(InputDriverPtr drv, InputInfoP
+ 		priv->min_y = 0;
+ 		priv->max_y = screenInfo.screens[priv->screen_no]->height - 1;
+ 	}
++
++#endif /* CALIBRATION_KERNEL_XSRC_NETBSD */
++
+ 	/* Allow options to override this */
+ 	priv->min_x = xf86SetIntOption(pInfo->options, "MinX", priv->min_x);
+ 	xf86IDrvMsg(pInfo, X_INFO, "minimum x position: %d\n", priv->min_x);
+@@ -399,7 +445,9 @@ wsDeviceOn(DeviceIntPtr pWS)
+ {
+ 	InputInfoPtr pInfo = (InputInfoPtr)pWS->public.devicePrivate;
+ 	WSDevicePtr priv = (WSDevicePtr)pInfo->private;
++#if !defined(UNDEF_TPANEL_XSRC_NETBSD)
+ 	struct wsmouse_calibcoords coords;
++#endif
+ 
+ 	DBG(1, ErrorF("WS DEVICE ON\n"));
+ 	if ((pInfo->fd < 0) && (wsOpen(pInfo) != Success)) {
+@@ -408,6 +456,7 @@ wsDeviceOn(DeviceIntPtr pWS)
+ 		return !Success;
+ 	}
+ 
++#if !defined(UNDEF_TPANEL_XSRC_NETBSD)
+ 	if (priv->type == WSMOUSE_TYPE_TPANEL) {
+ 		/* get calibration values */
+ 		if (ioctl(pInfo->fd, WSMOUSEIO_GCALIBCOORDS, &coords) != 0) {
+@@ -427,6 +476,15 @@ wsDeviceOn(DeviceIntPtr pWS)
+ 			}
+ 		}
+ 	}
++#endif
++
++#if defined(READ_EIO_XENOCARA_OPENBSD)
++	if (priv->remove_timer == NULL) {
++		/* allocate here where it's safe */
++		priv->remove_timer = TimerSet(priv->remove_timer,
++					      0, 0, NULL, NULL);
++	}
++#endif
+ 	xf86AddEnabledDevice(pInfo);
+ 	wsmbEmuOn(pInfo);
+ 	pWS->public.on = TRUE;
+@@ -438,10 +496,13 @@ wsDeviceOff(DeviceIntPtr pWS)
+ {
+ 	InputInfoPtr pInfo = (InputInfoPtr)pWS->public.devicePrivate;
+ 	WSDevicePtr priv = (WSDevicePtr)pInfo->private;
++#if !defined(UNDEF_TPANEL_XSRC_NETBSD)
+ 	struct wsmouse_calibcoords coords;
++#endif
+ 
+ 	DBG(1, ErrorF("WS DEVICE OFF\n"));
+ 	wsmbEmuFinalize(pInfo);
++#if !defined(UNDEF_TPANEL_XSRC_NETBSD)
+ 	if (priv->type == WSMOUSE_TYPE_TPANEL) {
+ 		/* Restore calibration data */
+ 		memcpy(&coords, &priv->coords, sizeof coords);
+@@ -450,6 +511,7 @@ wsDeviceOff(DeviceIntPtr pWS)
+ 			    strerror(errno));
+ 		}
+ 	}
++#endif
+ 	if (pInfo->fd >= 0) {
+ 		xf86RemoveEnabledDevice(pInfo);
+ 		wsClose(pInfo);
+@@ -457,6 +519,22 @@ wsDeviceOff(DeviceIntPtr pWS)
+ 	pWS->public.on = FALSE;
+ }
+ 
++#if defined(READ_EIO_XENOCARA_OPENBSD)
++/*
++ * Called as an OsTimer() callback to remove the device while xf86Wakeup()
++ * isn't playing with the list.
++ */
++static CARD32
++wsRemoveMouse(OsTimerPtr timer, CARD32 now, pointer arg)
++{
++	InputInfoPtr pInfo = (InputInfoPtr) arg;
++
++	xf86DisableDevice(pInfo->dev, TRUE);
++
++	return 0;	/* don't set to run again */
++}
++#endif
++
+ static size_t
+ wsReadEvents(InputInfoPtr pInfo)
+ {
+@@ -466,7 +544,18 @@ wsReadEvents(InputInfoPtr pInfo)
+ 	priv->events_count = priv->events_pos = 0;
+ 	len = read(pInfo->fd, priv->events, sizeof(priv->events));
+ 	if (len < 0) {
++#if defined(READ_EIO_XENOCARA_OPENBSD)
++		if (errno == EIO) {
++			xf86IDrvMsg(pInfo, X_ERROR,
++			    "device no longer present - removing: %s\n",
++			    strerror(errno));
++			xf86RemoveEnabledDevice(pInfo);
++			priv->remove_timer = TimerSet(priv->remove_timer, 0, 1,
++						      wsRemoveMouse, pInfo);
++		} else if (errno != EAGAIN)
++#else
+ 		if (errno != EAGAIN)
++#endif
+ 			xf86IDrvMsg(pInfo, X_ERROR, "read error %s\n",
+ 			    strerror(errno));
+ 	} else if (len % sizeof(struct wscons_event)) {
+@@ -550,9 +639,11 @@ wsReadHwState(InputInfoPtr pInfo, wsHwSt
+ 		case WSCONS_EVENT_MOUSE_ABSOLUTE_W:
+ 			/* ignore those */
+ 			continue;
++#ifdef WSCONS_EVENT_SYNC
+ 		case WSCONS_EVENT_SYNC:
+ 			DBG(4, ErrorF("Sync\n"));
+ 			return TRUE;
++#endif
+ 		default:
+ 			xf86IDrvMsg(pInfo, X_WARNING,
+ 			    "bad wsmouse event type=%d\n", event->type);
+@@ -680,6 +771,14 @@ wsOpen(InputInfoPtr pInfo)
+ static void
+ wsClose(InputInfoPtr pInfo)
+ {
++#if defined(READ_EIO_XENOCARA_OPENBSD)
++	WSDevicePtr priv = (WSDevicePtr)pInfo->private;
++
++	if (priv->remove_timer != NULL) {
++		TimerFree(priv->remove_timer);
++		priv->remove_timer = NULL;
++	}
++#endif
+ 	xf86CloseSerial(pInfo->fd);
+ 	pInfo->fd = -1;
+ }
+@@ -793,17 +892,23 @@ wsSetCalibProperty(DeviceIntPtr device, 
+ 		priv->coords.maxx = priv->max_x;
+ 		priv->coords.miny = priv->min_y;
+ 		priv->coords.maxy = priv->max_y;
++#ifdef __OpenBSD__
+ 		priv->coords.swapxy = priv->swap_axes;
++#endif
+ 
+ 		/* Update the kernel calibration table */
+ 		coords.minx = priv->min_x;
+ 		coords.maxx = priv->max_x;
+ 		coords.miny = priv->min_y;
+ 		coords.maxy = priv->max_y;
++#ifdef __OpenBSD__
+ 		coords.swapxy = priv->swap_axes;
++#endif
+ 		coords.samplelen = priv->raw;
++#ifdef __OpenBSD__
+ 		coords.resx = priv->coords.resx;
+ 		coords.resy = priv->coords.resy;
++#endif
+ 		if (ioctl(pInfo->fd, WSMOUSEIO_SCALIBCOORDS, &coords) != 0) {
+ 			xf86IDrvMsg(pInfo, X_ERROR, "SCALIBCOORDS failed %s\n",
+ 			    strerror(errno));
diff --git a/xf86-input-ws-dfbsd/patches/patch-src_ws.h b/xf86-input-ws-dfbsd/patches/patch-src_ws.h
new file mode 100644
index 0000000000..5230443ef6
--- /dev/null
+++ b/xf86-input-ws-dfbsd/patches/patch-src_ws.h
@@ -0,0 +1,42 @@
+$NetBSD$
+
+OpenBSD xenocara option:
+
+Dec 31 23:31:41 2017 UTC
+If read() returns EIO, then the wsmouse device has gone away and our fd
+to it is useless, so detach the xserver driver and close it.
+Modeled on similar code in xf86-input-{keyboard,mouse}
+
+--- src/ws.h.orig	2015-08-29 08:48:29.000000000 +0000
++++ src/ws.h
+@@ -87,6 +87,10 @@ typedef struct WSDevice {
+ 		Time timeout;
+ 	} emulateWheel;
+ 
++#if defined(READ_EIO_XENOCARA_OPENBSD)
++	OsTimerPtr      remove_timer;   /* Callback for removal on EIO */
++#endif
++
+ 	struct wscons_event	events[NWSEVENTS];
+ 	size_t			events_count;
+ 	size_t			events_pos;
+@@ -95,8 +99,19 @@ typedef struct WSDevice {
+ /* Middle mouse button emulation */
+ extern int wsmbEmuTimer(InputInfoPtr);
+ extern BOOL wsmbEmuFilterEvent(InputInfoPtr, int, BOOL);
++#if defined(STRICT_XSRC_NETBSD)
++/* XXX compat-api.h */
++#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(23, 0)
++extern void wsmbEmuWakeupHandler(pointer, int, pointer);
++extern void wsmbEmuBlockHandler(pointer, struct timeval **, pointer);
++#else
++extern void wsmbEmuWakeupHandler(pointer, int);
++extern void wsmbEmuBlockHandler(pointer, pointer);
++#endif
++#else /* !STRICT_XSRC_NETBSD */
+ extern void wsmbEmuWakeupHandler(pointer, int, pointer);
+ extern void wsmbEmuBlockHandler(pointer, struct timeval **, pointer);
++#endif /* STRICT_XSRC_NETBSD */
+ extern void wsmbEmuPreInit(InputInfoPtr);
+ extern void wsmbEmuOn(InputInfoPtr);
+ extern void wsmbEmuFinalize(InputInfoPtr);


Home | Main Index | Thread Index | Old Index