[PATCH:xf86-input-mouse 3/4] Make wsmouse (re-)init the version.

Thomas Klausner wiz at NetBSD.org
Sun Mar 30 06:03:27 PDT 2014


On Tue, Mar 25, 2014 at 05:33:25PM -0700, Alan Coopersmith wrote:
> On 08/19/13 02:14 AM, Thomas Klausner wrote:
> >This makes sure that the xserver and the mouse speak the same
> >protocol version.
> >
> > From Matthew R. Green <mrg at NetBSD.org>
> >Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
> >---
> >  src/mouse.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> >diff --git a/src/mouse.c b/src/mouse.c
> >index 0487067..4797160 100644
> >--- a/src/mouse.c
> >+++ b/src/mouse.c
> >@@ -67,6 +67,12 @@
> >  #include "xserver-properties.h"
> >  #include "xf86-mouse-properties.h"
> >
> >+#ifdef __NetBSD__
> >+#include <time.h>
> >+#include <dev/wscons/wsconsio.h>
> >+#include <sys/ioctl.h>
> >+#endif
> >+
> >  #include "compiler.h"
> >
> >  #include "xisb.h"
> >@@ -1733,6 +1739,11 @@ MouseProc(DeviceIntPtr device, int what)
> >          if (pInfo->fd == -1)
> >              xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
> >          else {
> >+#if defined(__NetBSD__) && defined(WSCONS_SUPPORT) && defined(WSMOUSEIO_SETVERSION)
> >+            int version = WSMOUSE_EVENT_VERSION;
> >+            if (ioctl(pInfo->fd, WSMOUSEIO_SETVERSION, &version) == -1)
> >+                xf86Msg(X_WARNING, "%s: cannot set version\n", pInfo->name);
> >+#endif
> >              if (pMse->xisbscale)
> >                  pMse->buffer = XisbNew(pInfo->fd, pMse->xisbscale * 4);
> >              else
> >
> 
> I have no idea what this code does, but if you already reviewed it & accepted it
> in NetBSD, that should be fine.

It sets the protocol version for the wscons_event protocol. These are
generated by the wsmouse device (a mouse multiplexer) and are intended
to be used by the X server (as mouse events). If the protocol version
is not the same on both sides, nothing happens (the mouse doesn't
work). I'm not exactly sure why there is no better backwards
compatibility.

Thanks for the review,
 Thomas


More information about the xorg-devel mailing list