From 783c2be2d3f394a7e544a1212b114e2657da6b8a Mon Sep 17 00:00:00 2001 From: Ben Woolley Date: Fri, 10 Jun 2016 12:56:46 -0700 Subject: [PATCH] Allow moused to work with sysmouse when the port is a pipe, not a real mouse device with working ioctls. Allows simple userland injection of mouse events. --- usr.sbin/moused/moused.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.sbin/moused/moused.c b/usr.sbin/moused/moused.c index f78ced2..63a3c73 100644 --- a/usr.sbin/moused/moused.c +++ b/usr.sbin/moused/moused.c @@ -1273,7 +1273,7 @@ r_identify(void) if (rodent.level < 0) rodent.level = 1; ioctl(rodent.mfd, MOUSE_SETLEVEL, &rodent.level); - rodent.level = (ioctl(rodent.mfd, MOUSE_GETLEVEL, &level) == 0) ? level : 0; + rodent.level = (ioctl(rodent.mfd, MOUSE_GETLEVEL, &level) == 0) ? level : rodent.level; /* * Interrogate the driver and get some intelligence on the device... @@ -1314,6 +1314,11 @@ r_identify(void) cur_proto[4] = rodent.mode.packetsize; cur_proto[0] = rodent.mode.syncmask[0]; /* header byte bit mask */ cur_proto[1] = rodent.mode.syncmask[1]; /* header bit pattern */ + } else if (rodent.rtype == MOUSE_PROTO_SYSMOUSE) { + bcopy(proto[rodent.rtype], cur_proto, sizeof(cur_proto)); + if (rodent.level == 1) { + cur_proto[4] = 8; + } } /* maybe this is a PnP mouse... */ -- 2.8.1