summaryrefslogtreecommitdiffstats
path: root/usr.sbin/wsmoused
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2009-06-05 03:37:10 +0000
committermiod <miod@openbsd.org>2009-06-05 03:37:10 +0000
commitbe45c8af7b5ea619dc995c7164764e06e5fb707e (patch)
treefe0fff8fc0edfbcbb362f198fd89e0b4df439bab /usr.sbin/wsmoused
parentEPERM from VOP_ACCESS() is always an error, so don't hide it. (diff)
downloadwireguard-openbsd-be45c8af7b5ea619dc995c7164764e06e5fb707e.tar.xz
wireguard-openbsd-be45c8af7b5ea619dc995c7164764e06e5fb707e.zip
Add the ability to attach wsmoused to a different wsdisplay than wsdisplay0
(i.e. ttyCcfg) with the new -D option. While there, a lot of cleanup, including not creating a pidfile by default (since there might be more than one wsmoused running on multiple wsdisplay systems).
Diffstat (limited to 'usr.sbin/wsmoused')
-rw-r--r--usr.sbin/wsmoused/mouse_protocols.c58
-rw-r--r--usr.sbin/wsmoused/mouse_protocols.h25
-rw-r--r--usr.sbin/wsmoused/wsmoused.841
-rw-r--r--usr.sbin/wsmoused/wsmoused.c165
-rw-r--r--usr.sbin/wsmoused/wsmoused.h41
5 files changed, 191 insertions, 139 deletions
diff --git a/usr.sbin/wsmoused/mouse_protocols.c b/usr.sbin/wsmoused/mouse_protocols.c
index b0da3878070..dfe38bbaf04 100644
--- a/usr.sbin/wsmoused/mouse_protocols.c
+++ b/usr.sbin/wsmoused/mouse_protocols.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mouse_protocols.c,v 1.12 2007/04/10 22:37:17 miod Exp $ */
+/* $OpenBSD: mouse_protocols.c,v 1.13 2009/06/05 03:37:10 miod Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
@@ -88,7 +88,7 @@ extern int background;
extern mouse_t mouse;
/* Cflags of each mouse protocol, ordered by P_XXX */
-static unsigned short mousecflags[] = {
+static const unsigned short mousecflags[] = {
(CS7 | CREAD | CLOCAL | HUPCL), /* Microsoft */
(CS8 | CSTOPB | CREAD | CLOCAL | HUPCL), /* MouseSystems */
(CS8 | CSTOPB | CREAD | CLOCAL | HUPCL), /* Logitech */
@@ -101,7 +101,7 @@ static unsigned short mousecflags[] = {
};
/* array ordered by P_XXX giving protocol properties */
-static unsigned char proto[][7] = {
+static const unsigned char proto[][7] = {
/* mask hd_id dp_mask dp_id bytes b4_mask b4_id */
{0x40, 0x40, 0x40, 0x00, 3, ~0x23, 0x00}, /* Microsoft */
{0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff}, /* MouseSystems */
@@ -118,7 +118,7 @@ static unsigned char proto[][7] = {
* array ordered by P_XXX (mouse protocols) giving the protocol
* corresponding to the name of a mouse
*/
-char *mouse_names[] = {
+const char *mouse_names[] = {
"microsoft",
"mousesystems",
"logitech",
@@ -135,7 +135,7 @@ char *mouse_names[] = {
static unsigned char cur_proto[7];
/* PnP EISA/product IDs */
-static symtab_t pnpprod[] = {
+static const symtab_t pnpprod[] = {
{"KML0001", P_THINKING},/* Kensignton ThinkingMouse */
{"MSH0001", P_IMSERIAL},/* MS IntelliMouse */
{"MSH0004", P_IMSERIAL},/* MS IntelliMouse TrackBall */
@@ -163,8 +163,8 @@ static symtab_t pnpprod[] = {
{NULL, -1},
};
-static symtab_t *
-gettoken(symtab_t * tab, char *s, int len)
+static const symtab_t *
+gettoken(const symtab_t * tab, char *s, int len)
{
int i;
@@ -175,11 +175,11 @@ gettoken(symtab_t * tab, char *s, int len)
return &tab[i];
}
-char *
+const char *
mouse_name(int type)
{
- return (type == P_UNKNOWN ||
- (type > sizeof(mouse_names) / sizeof(mouse_names[0]) - 1)) ?
+ return (type < 0 ||
+ (uint)type >= sizeof(mouse_names) / sizeof(mouse_names[0])) ?
"unknown" : mouse_names[type];
}
@@ -189,9 +189,6 @@ SetMouseSpeed(int old, int new, unsigned int cflag)
struct termios tty;
char *c;
- if (!IS_SERIAL_DEV(mouse.portname))
- return;
-
if (tcgetattr(mouse.mfd, &tty) < 0) {
debug("Warning: %s unable to get status of mouse fd (%s)\n",
mouse.portname, strerror(errno));
@@ -472,7 +469,7 @@ pnpparse(pnpid_t * id, char *buf, int len)
id->revision = ((buf[1] & 0x3f) << 6) | (buf[2] & 0x3f);
debug("Mouse: PnP rev %d.%02d\n", id->revision / 100, id->revision % 100);
- /* EISA vender and product ID */
+ /* EISA vendor and product ID */
id->eisaid = &buf[3];
id->neisaid = 7;
@@ -558,11 +555,11 @@ pnpparse(pnpid_t * id, char *buf, int len)
}
/* pnpproto : return the prototype used, based on the PnP ID string */
-static symtab_t *
+static const symtab_t *
pnpproto(pnpid_t * id)
{
- symtab_t *t;
- int i, j;
+ const symtab_t *t;
+ int i, j;
if (id->nclass > 0)
if (strncmp(id->class, "MOUSE", id->nclass) != 0)
@@ -603,10 +600,6 @@ mouse_init(void)
char c;
int i;
- if (IS_WSMOUSE_DEV(mouse.portname)) {
- wsmouse_init();
- return;
- }
pfd[0].fd = mouse.mfd;
pfd[0].events = POLLIN;
@@ -789,11 +782,11 @@ mouse_init(void)
int
mouse_identify(void)
{
- char pnpbuf[256]; /* PnP identifier string may be up to
- * 256 bytes long */
- pnpid_t pnpid;
- symtab_t *t;
- int len;
+ char pnpbuf[256]; /* PnP identifier string may be up to
+ * 256 bytes long */
+ pnpid_t pnpid;
+ const symtab_t *t;
+ int len;
/* protocol has been specified with '-t' */
if (mouse.proto != P_UNKNOWN)
@@ -881,17 +874,6 @@ mouse_protocol(u_char rBuf, mousestatus_t * act)
MOUSE_BUTTON6DOWN,
MOUSE_BUTTON7DOWN,
};
- /* for PS/2 VersaPad */
- static int butmapversaps2[8] = { /* VersaPad */
- 0,
- MOUSE_BUTTON3DOWN,
- 0,
- MOUSE_BUTTON3DOWN,
- MOUSE_BUTTON1DOWN,
- MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN,
- MOUSE_BUTTON1DOWN,
- MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN,
- };
static int pBufP = 0;
static unsigned char pBuf[8];
@@ -903,7 +885,7 @@ mouse_protocol(u_char rBuf, mousestatus_t * act)
* b) invalid (0x80 == -128 and that might be wrong for MouseSystems)
* c) bad header-package
*
- * NOTE: b) is a voilation of the MouseSystems-Protocol, since values of
+ * NOTE: b) is a violation of the MouseSystems-Protocol, since values of
* -128 are allowed, but since they are very seldom we can easily
* use them as package-header with no button pressed.
* NOTE/2: On a PS/2 mouse any byte is valid as a data byte. Furthermore,
diff --git a/usr.sbin/wsmoused/mouse_protocols.h b/usr.sbin/wsmoused/mouse_protocols.h
index 14a2ab64451..11a586fad9e 100644
--- a/usr.sbin/wsmoused/mouse_protocols.h
+++ b/usr.sbin/wsmoused/mouse_protocols.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mouse_protocols.h,v 1.5 2007/04/10 22:37:17 miod Exp $ */
+/* $OpenBSD: mouse_protocols.h,v 1.6 2009/06/05 03:37:10 miod Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
@@ -53,16 +53,17 @@
/* Mouse protocols */
-#define P_UNKNOWN (-1)
-#define P_MS 0 /* Microsoft Serial, 3 bytes */
-#define P_MSC 1 /* Mouse Systems, 5 bytes */
-#define P_LOGI 2 /* Logitech, 3 bytes */
-#define P_MM 3 /* MM series, 3 bytes */
-#define P_LOGIMAN 4 /* Logitech MouseMan 3/4 bytes */
-#define P_MMHIT 5 /* Hitachi Tablet 3 bytes */
-#define P_GLIDEPOINT 6 /* ALPS GlidePoint, 3/4 bytes */
-#define P_IMSERIAL 7 /* MS IntelliMouse, 4 bytes */
-#define P_THINKING 8 /* Kensignton Thinking Mouse, 3/4 bytes */
+#define P_UNKNOWN -2
+#define P_WSCONS -1 /* wsmouse */
+#define P_MS 0 /* Microsoft Serial, 3 bytes */
+#define P_MSC 1 /* Mouse Systems, 5 bytes */
+#define P_LOGI 2 /* Logitech, 3 bytes */
+#define P_MM 3 /* MM series, 3 bytes */
+#define P_LOGIMAN 4 /* Logitech MouseMan 3/4 bytes */
+#define P_MMHIT 5 /* Hitachi Tablet 3 bytes */
+#define P_GLIDEPOINT 6 /* ALPS GlidePoint, 3/4 bytes */
+#define P_IMSERIAL 7 /* MS IntelliMouse, 4 bytes */
+#define P_THINKING 8 /* Kensignton Thinking Mouse, 3/4 bytes */
/* flags */
@@ -201,6 +202,6 @@ typedef struct mousestatus {
void mouse_init(void);
int mouse_identify(void);
int mouse_protocol(unsigned char, mousestatus_t *);
-char *mouse_name(int type);
+const char *mouse_name(int type);
void wsmouse_init(void);
diff --git a/usr.sbin/wsmoused/wsmoused.8 b/usr.sbin/wsmoused/wsmoused.8
index 458409ce842..e386af369da 100644
--- a/usr.sbin/wsmoused/wsmoused.8
+++ b/usr.sbin/wsmoused/wsmoused.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: wsmoused.8,v 1.16 2007/05/31 19:20:30 jmc Exp $
+.\" $OpenBSD: wsmoused.8,v 1.17 2009/06/05 03:37:10 miod Exp $
.\"
.\" Copyright (c) 2001 Jean-Baptiste Marchand
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: June 5 2009 $
.Dt WSMOUSED 8 i386
.Os
.Sh NAME
@@ -34,6 +34,7 @@
.Nm wsmoused
.Op Fl 2dfi
.Op Fl C Ar thresh
+.Op Fl D Ar device
.Op Fl I Ar file
.Oo
.Fl M
@@ -47,10 +48,8 @@ listens for mouse events on the specified
.Ar device
and communicates them to the
.Xr wscons 4
-driver through the
-.Pa /dev/ttyCcfg
-interface.
-Its purpose is to provide copy/paste functionality on the PC console.
+driver.
+Its purpose is to provide copy/paste functionality on the console.
.Pp
By default, the left mouse button is used to select text
(in the familiar click-and-drag fashion);
@@ -72,6 +71,17 @@ Set double click speed as the maximum interval in msec between button clicks.
If omitted, the default value of 500 msec will be assumed.
This option will have effect only on the cut and paste operations
in the text mode console.
+.It Fl D Ar device
+Use
+.Ar device
+as the display control device.
+If omitted,
+.Nm
+will use the default value of
+.Pa /dev/ttyCcfg ,
+which controls the
+.Nm wsdisplay0
+display terminals.
.It Fl d
Enable debugging messages.
.It Fl f
@@ -82,8 +92,6 @@ Write the process ID of
.Nm
to the specified
.Ar file .
-If omitted, the process ID will be stored in
-.Pa /var/run/wsmoused.pid .
.It Fl i
Print the type and the protocol of the mouse and exit.
.It Fl M Ar N Ns = Ns Ar M
@@ -98,6 +106,7 @@ In this case the logical button will be down, if either of the assigned
physical buttons is held down.
Do not put space around
.Ql = .
+Button numbers start from one, assigned to the leftmost button.
.It Fl p Ar device
Use
.Ar device
@@ -172,6 +181,22 @@ Serial mice do not have a
compatible driver, so
.Nm
has to be killed before starting the X Window System.
+.Sh EXAMPLES
+To start wsmoused on the
+.Nm wsdisplay1
+display terminals, using a two-button serial mouse connected to
+.Pa /dev/cua0 :
+.Pp
+.Dl # wsmoused -2 -D /dev/ttyDcfg -p /dev/cua0
+.Pp
+To start wsmoused on the
+.Nm wsdisplay0
+display terminals, using
+.Pa /dev/wsmouse
+with the left and right buttons swapped
+.Pq assuming a three button mouse :
+.Pp
+.Dl # wsmoused -M 1=3 -M 3=1
.Sh SEE ALSO
.Xr wscons 4 ,
.Xr wsmouse 4
diff --git a/usr.sbin/wsmoused/wsmoused.c b/usr.sbin/wsmoused/wsmoused.c
index 43c9fd88886..6c0d29a221b 100644
--- a/usr.sbin/wsmoused/wsmoused.c
+++ b/usr.sbin/wsmoused/wsmoused.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmoused.c,v 1.23 2007/11/24 16:28:09 miod Exp $ */
+/* $OpenBSD: wsmoused.c,v 1.24 2009/06/05 03:37:10 miod Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
@@ -72,18 +72,22 @@
#include "mouse_protocols.h"
#include "wsmoused.h"
+#define DEFAULT_TTY "/dev/ttyCcfg"
+#define DEFAULT_PIDFILE "/var/run/wsmoused.pid"
+
extern char *__progname;
extern char *mouse_names[];
int debug = 0;
-int nodaemon = FALSE;
int background = FALSE;
+int nodaemon = FALSE;
int identify = FALSE;
-char *pidfile = "/var/run/wsmoused.pid";
+char *pidfile = NULL;
mouse_t mouse = {
.flags = 0,
.portname = NULL,
+ .ttyname = NULL,
.proto = P_UNKNOWN,
.baudrate = 1200,
.old_baudrate = 1200,
@@ -104,6 +108,7 @@ wsmouse_identify(void)
if (mouse.mfd != -1) {
if (ioctl(mouse.mfd, WSMOUSEIO_GTYPE, &type) == -1)
err(1, "can't detect mouse type");
+
printf("wsmouse supported mouse: ");
switch (type) {
case WSMOUSE_TYPE_VSXXX:
@@ -130,6 +135,21 @@ wsmouse_identify(void)
case WSMOUSE_TYPE_ARCHIMEDES:
printf("Archimedes\n");
break;
+ case WSMOUSE_TYPE_ADB:
+ printf("ADB\n");
+ break;
+ case WSMOUSE_TYPE_HIL:
+ printf("HP-HIL\n");
+ break;
+ case WSMOUSE_TYPE_LUNA:
+ printf("Omron Luna\n");
+ break;
+ case WSMOUSE_TYPE_DOMAIN:
+ printf("Apollo Domain\n");
+ break;
+ case WSMOUSE_TYPE_SUN:
+ printf("Sun\n");
+ break;
default:
printf("Unknown\n");
break;
@@ -225,7 +245,8 @@ terminate(int sig)
close(mouse.mfd);
mouse.mfd = -1;
}
- unlink(pidfile);
+ if (pidfile != NULL)
+ unlink(pidfile);
_exit(0);
}
@@ -391,42 +412,24 @@ wsmoused(void)
struct pollfd pfd[1];
int res;
u_char b;
- FILE *fp;
struct stat mdev_stat;
- if (!nodaemon && !background) {
- if (daemon(0, 0)) {
- logerr(1, "failed to become a daemon");
- } else {
- background = TRUE;
- fp = fopen(pidfile, "w");
- if (fp != NULL) {
- fprintf(fp, "%ld\n", (long)getpid());
- fclose(fp);
- }
- }
- }
-
- if ((mouse.cfd = open("/dev/ttyCcfg", O_RDWR, 0)) == -1)
- logerr(1, "cannot open /dev/ttyCcfg");
-
/* initialization */
event.type = WSCONS_EVENT_WSMOUSED_ON;
- if (IS_WSMOUSE_DEV(mouse.portname)) {
-
+ if (mouse.proto == P_WSCONS) {
/* get major and minor of mouse device */
res = stat(mouse.portname, &mdev_stat);
if (res != -1)
event.value = mdev_stat.st_rdev;
else
event.value = 0;
- }
- else
- /* X11 won't start using wsmoused(8) with a serial mouse */
+ } else {
+ /* X11 won't start when using wsmoused(8) with a serial mouse */
event.value = 0;
+ }
- /* notify kernel to start wsmoused */
+ /* notify kernel the start of wsmoused */
res = ioctl(mouse.cfd, WSDISPLAYIO_WSMOUSED, &event);
if (res != 0) {
/* the display driver has no getchar() method */
@@ -444,13 +447,16 @@ wsmoused(void)
for (;;) {
if (poll(pfd, 1, INFTIM) <= 0)
logwarn("failed to read from mouse");
- if (IS_WSMOUSE_DEV(mouse.portname)) {
+
+ if (mouse.proto == P_WSCONS) {
/* wsmouse supported mouse */
read(mouse.mfd, &event, sizeof(event));
res = treat_event(&event);
if (!res) {
- /* close mouse device and sleep until
- the X server release it */
+ /*
+ * close mouse device and sleep until
+ * the X server releases it
+ */
struct wscons_event sleeping;
unsigned int tries;
@@ -486,14 +492,14 @@ wsmoused(void)
tries++;
sleep(1);
} else {
- logerr(1, "unable to open %s, "
+ logwarn("unable to open %s, "
"will retry in 10 seconds",
mouse.portname);
sleep(10);
}
}
- mouse_init();
+ wsmouse_init();
}
} else {
/* serial mouse (not supported by wsmouse) */
@@ -511,18 +517,20 @@ wsmoused(void)
static void
usage(void)
{
- fprintf(stderr, "usage: %s [-2dfi] [-C thresh] [-I file] [-M N=M] \
-[-p device] [-t type]\n", __progname);
+ fprintf(stderr, "usage: %s [-2dfi] [-C thresh] [-D device] [-I file]"
+ " [-M N=M]\n\t[-p device] [-t type]\n", __progname);
exit(1);
}
int
main(int argc, char **argv)
{
+ FILE *fp;
+ unsigned int type;
int opt;
int i;
-#define GETOPT_STRING "2dfhip:t:C:I:M:"
+#define GETOPT_STRING "2dfhip:t:C:D:I:M:"
while ((opt = (getopt(argc, argv, GETOPT_STRING))) != -1) {
switch (opt) {
case '2':
@@ -540,6 +548,7 @@ main(int argc, char **argv)
break;
case 'i':
identify = TRUE;
+ nodaemon = TRUE;
break;
case 'p':
if ((mouse.portname = strdup(optarg)) == NULL)
@@ -572,6 +581,10 @@ main(int argc, char **argv)
usage();
}
break;
+ case 'D':
+ if ((mouse.ttyname = strdup(optarg)) == NULL)
+ logerr(1, "out of memory");
+ break;
case 'I':
pidfile = optarg;
break;
@@ -585,38 +598,72 @@ main(int argc, char **argv)
usage();
}
}
+
+ /*
+ * Use defaults if unspecified
+ */
if (mouse.portname == NULL)
- /* default is /dev/wsmouse */
mouse.portname = WSMOUSE_DEV;
+ if (mouse.ttyname == NULL)
+ mouse.ttyname = DEFAULT_TTY;
- if (!nodaemon)
+ if (!nodaemon) {
openlog(__progname, LOG_PID, LOG_DAEMON);
-
- for (;;) {
- signal(SIGINT , terminate);
- signal(SIGQUIT, terminate);
- signal(SIGTERM, terminate);
- if ((mouse.mfd = open(mouse.portname,
- O_RDONLY | O_NONBLOCK, 0)) == -1)
- logerr(1, "unable to open %s", mouse.portname);
- if (IS_SERIAL_DEV(mouse.portname)) {
- if (mouse_identify() == P_UNKNOWN) {
- close(mouse.mfd);
- logerr(1, "cannot determine mouse type on %s",
- mouse.portname);
+ if (daemon(0, 0)) {
+ logerr(1, "failed to become a daemon");
+ } else {
+ background = TRUE;
+ if (pidfile != NULL) {
+ fp = fopen(pidfile, "w");
+ if (fp != NULL) {
+ fprintf(fp, "%ld\n", (long)getpid());
+ fclose(fp);
+ }
}
}
+ }
+
+ if (identify == FALSE) {
+ if ((mouse.cfd = open(mouse.ttyname, O_RDWR, 0)) == -1)
+ logerr(1, "cannot open %s", mouse.ttyname);
+ }
+
+ if ((mouse.mfd = open(mouse.portname,
+ O_RDONLY | O_NONBLOCK, 0)) == -1)
+ logerr(1, "unable to open %s", mouse.portname);
- if (identify == TRUE) {
- if (IS_WSMOUSE_DEV(mouse.portname))
- wsmouse_identify();
- else
- printf("serial mouse: %s type\n",
- (char *)mouse_name(mouse.proto));
- exit(0);
+ /*
+ * Find out whether the mouse device is a wsmouse device
+ * or a serial device.
+ */
+ if (ioctl(mouse.mfd, WSMOUSEIO_GTYPE, &type) != -1)
+ mouse.proto = P_WSCONS;
+ else {
+ if (mouse_identify() == P_UNKNOWN) {
+ close(mouse.mfd);
+ logerr(1, "cannot determine mouse type on %s",
+ mouse.portname);
}
+ }
- mouse_init();
- wsmoused();
+ if (identify == TRUE) {
+ if (mouse.proto == P_WSCONS)
+ wsmouse_identify();
+ else
+ printf("serial mouse: %s type\n",
+ mouse_name(mouse.proto));
+ exit(0);
}
+
+ signal(SIGINT, terminate);
+ signal(SIGQUIT, terminate);
+ signal(SIGTERM, terminate);
+
+ if (mouse.proto == P_WSCONS)
+ wsmouse_init();
+ else
+ mouse_init();
+
+ wsmoused();
+ exit(0);
}
diff --git a/usr.sbin/wsmoused/wsmoused.h b/usr.sbin/wsmoused/wsmoused.h
index 7a80870d234..0401b76d8e0 100644
--- a/usr.sbin/wsmoused/wsmoused.h
+++ b/usr.sbin/wsmoused/wsmoused.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmoused.h,v 1.6 2008/06/20 14:17:20 ragge Exp $ */
+/* $OpenBSD: wsmoused.h,v 1.7 2009/06/05 03:37:10 miod Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
@@ -62,7 +62,8 @@ extern char *pidfile;
#define logerr(e, ...) \
do { \
- unlink(pidfile); \
+ if (pidfile != NULL) \
+ unlink(pidfile); \
if (background) { \
syslog(LOG_ERR, __VA_ARGS__); \
exit(e); \
@@ -73,9 +74,9 @@ extern char *pidfile;
#define logwarn(...) \
do { \
if (background) \
- syslog(LOG_WARNING, __VA_ARGS__); \
+ syslog(LOG_WARNING, __VA_ARGS__); \
else \
- warnx(__VA_ARGS__); \
+ warnx(__VA_ARGS__); \
} while (0)
/* Daemon flags */
@@ -90,26 +91,23 @@ extern char *pidfile;
/* Devices corresponding to physical interfaces */
#define WSMOUSE_DEV "/dev/wsmouse" /* can be /dev/wsmouse, /dev/wsmouse0, ...*/
-#define SERIAL_DEV "/dev/cua0" /* can be /dev/cua00, /dev/cua01, ... */
-
-#define IS_WSMOUSE_DEV(dev) (!(strncmp((dev), WSMOUSE_DEV,12)))
-#define IS_SERIAL_DEV(dev) (!(strncmp((dev), SERIAL_DEV, 9)))
/* mouse structure : main structure */
typedef struct mouse_s {
- int flags;
- char *portname; /* /dev/XXX */
- int proto; /* MOUSE_PROTO_XXX */
- int baudrate;
- int old_baudrate;
- unsigned char rate; /* report rate */
- unsigned int resolution; /* MOUSE_RES_XXX or a positive number */
- int zmap; /* MOUSE_{X|Y}AXIS or a button number */
- int wmode; /* wheel mode button number */
- int mfd; /* mouse file descriptor */
- int cfd; /* console file descriptor */
- long clickthreshold; /* double click speed in msec */
-} mouse_t ;
+ int flags;
+ char *portname; /* mouse device */
+ char *ttyname; /* wsdisplay control tty device */
+ int proto; /* MOUSE_PROTO_XXX */
+ int baudrate;
+ int old_baudrate;
+ unsigned char rate; /* report rate */
+ unsigned int resolution; /* MOUSE_RES_XXX or a positive number */
+ int zmap; /* MOUSE_{X|Y}AXIS or a button number */
+ int wmode; /* wheel mode button number */
+ int mfd; /* mouse file descriptor */
+ int cfd; /* console file descriptor */
+ long clickthreshold; /* double click speed in msec */
+} mouse_t;
/* Mouse buttons */
@@ -122,4 +120,3 @@ typedef struct mouse_s {
#define MOUSE_BUTTON7 6
#define MOUSE_BUTTON8 7
#define MOUSE_MAXBUTTON 8
-