Add moused, a daemon to take input from a serial mouse and feed it to
a wsmux. This way serial mice can be accessed via /dev/wsmouse like all other mice. This program is heavily based on the FreeBSD moused program.
This commit is contained in:
parent
7285b2c290
commit
cf866544bb
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.163 2001/10/26 16:06:57 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.164 2001/10/29 23:23:41 augustss Exp $
|
||||
# from: @(#)Makefile 5.20 (Berkeley) 6/12/93
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
@ -9,8 +9,8 @@ SUBDIR= ac accton altq amd apm apmd arp bad144 bind bootp catman \
|
|||
envstat eshconfig greconfig \
|
||||
grfconfig grfinfo gspa hilinfo inetd iopctl iostat ipf isdn iteconfig \
|
||||
kgmon kvm_mkdb lastlogin link lpr mailwrapper makefs map-mbone \
|
||||
mdconfig memswitch mlxctl mopd mountd mrinfo mrouted mtrace mtree \
|
||||
ndbootd netgroup_mkdb nfsd ntp pcictl pkg_install pppd pstat \
|
||||
mdconfig memswitch mlxctl mopd mountd moused mrinfo mrouted mtrace \
|
||||
mtree ndbootd netgroup_mkdb nfsd ntp pcictl pkg_install pppd pstat \
|
||||
pwd_mkdb quot quotacheck quotaon rarpd rbootd rdate \
|
||||
repquota rmt rpc.bootparamd rpc.lockd rpc.pcnfsd \
|
||||
rpc.statd rpc.yppasswdd rpcbind rwhod sa screenblank sesd \
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.1 2001/10/29 23:23:42 augustss Exp $
|
||||
|
||||
PROG= moused
|
||||
MAN= moused.8
|
||||
SRCS= moused.c
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -0,0 +1,381 @@
|
|||
/* $NetBSD: mouse.h,v 1.1 2001/10/29 23:23:42 augustss Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993 Erik Forsberg.
|
||||
* Copyright (c) 1996, 1997 Kazutaka YOKOTA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/sys/mouse.h,v 1.18 2001/07/05 08:52:40 dd Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MOUSE_H_
|
||||
#define _SYS_MOUSE_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioccom.h>
|
||||
|
||||
#if 0
|
||||
/* ioctls */
|
||||
#define MOUSE_GETSTATUS _IOR('M', 0, mousestatus_t)
|
||||
#define MOUSE_GETHWINFO _IOR('M', 1, mousehw_t)
|
||||
#define MOUSE_GETMODE _IOR('M', 2, mousemode_t)
|
||||
#define MOUSE_SETMODE _IOW('M', 3, mousemode_t)
|
||||
#define MOUSE_GETLEVEL _IOR('M', 4, int)
|
||||
#define MOUSE_SETLEVEL _IOW('M', 5, int)
|
||||
#define MOUSE_GETVARS _IOR('M', 6, mousevar_t)
|
||||
#define MOUSE_SETVARS _IOW('M', 7, mousevar_t)
|
||||
#define MOUSE_READSTATE _IOWR('M', 8, mousedata_t)
|
||||
#define MOUSE_READDATA _IOWR('M', 9, mousedata_t)
|
||||
|
||||
#if notyet
|
||||
#define MOUSE_SETRESOLUTION _IOW('M', 10, int)
|
||||
#define MOUSE_SETSCALING _IOW('M', 11, int)
|
||||
#define MOUSE_SETRATE _IOW('M', 12, int)
|
||||
#define MOUSE_GETHWID _IOR('M', 13, int)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* mouse status block */
|
||||
typedef struct mousestatus {
|
||||
int flags; /* state change flags */
|
||||
int button; /* button status */
|
||||
int obutton; /* previous button status */
|
||||
int dx; /* x movement */
|
||||
int dy; /* y movement */
|
||||
int dz; /* z movement */
|
||||
} mousestatus_t;
|
||||
|
||||
/* button */
|
||||
#define MOUSE_BUTTON1DOWN 0x0001 /* left */
|
||||
#define MOUSE_BUTTON2DOWN 0x0002 /* middle */
|
||||
#define MOUSE_BUTTON3DOWN 0x0004 /* right */
|
||||
#define MOUSE_BUTTON4DOWN 0x0008
|
||||
#define MOUSE_BUTTON5DOWN 0x0010
|
||||
#define MOUSE_BUTTON6DOWN 0x0020
|
||||
#define MOUSE_BUTTON7DOWN 0x0040
|
||||
#define MOUSE_BUTTON8DOWN 0x0080
|
||||
#define MOUSE_MAXBUTTON 31
|
||||
#define MOUSE_STDBUTTONS 0x0007 /* buttons 1-3 */
|
||||
#define MOUSE_EXTBUTTONS 0x7ffffff8 /* the others (28 of them!) */
|
||||
#define MOUSE_BUTTONS (MOUSE_STDBUTTONS | MOUSE_EXTBUTTONS)
|
||||
|
||||
/* flags */
|
||||
#define MOUSE_STDBUTTONSCHANGED MOUSE_STDBUTTONS
|
||||
#define MOUSE_EXTBUTTONSCHANGED MOUSE_EXTBUTTONS
|
||||
#define MOUSE_BUTTONSCHANGED MOUSE_BUTTONS
|
||||
#define MOUSE_POSCHANGED 0x80000000
|
||||
|
||||
typedef struct mousehw {
|
||||
int buttons; /* -1 if unknown */
|
||||
int iftype; /* MOUSE_IF_XXX */
|
||||
int type; /* mouse/track ball/pad... */
|
||||
int model; /* I/F dependent model ID: MOUSE_MODEL_XXX */
|
||||
int hwid; /* I/F dependent hardware ID
|
||||
* for the PS/2 mouse, it will be PSM_XXX_ID
|
||||
*/
|
||||
} mousehw_t;
|
||||
|
||||
/* iftype */
|
||||
#define MOUSE_IF_UNKNOWN (-1)
|
||||
#define MOUSE_IF_SERIAL 0
|
||||
#define MOUSE_IF_BUS 1
|
||||
#define MOUSE_IF_INPORT 2
|
||||
#define MOUSE_IF_PS2 3
|
||||
#define MOUSE_IF_SYSMOUSE 4
|
||||
#define MOUSE_IF_USB 5
|
||||
|
||||
/* type */
|
||||
#define MOUSE_UNKNOWN (-1) /* should be treated as a mouse */
|
||||
#define MOUSE_MOUSE 0
|
||||
#define MOUSE_TRACKBALL 1
|
||||
#define MOUSE_STICK 2
|
||||
#define MOUSE_PAD 3
|
||||
|
||||
/* model */
|
||||
#define MOUSE_MODEL_UNKNOWN (-1)
|
||||
#define MOUSE_MODEL_GENERIC 0
|
||||
#define MOUSE_MODEL_GLIDEPOINT 1
|
||||
#define MOUSE_MODEL_NETSCROLL 2
|
||||
#define MOUSE_MODEL_NET 3
|
||||
#define MOUSE_MODEL_INTELLI 4
|
||||
#define MOUSE_MODEL_THINK 5
|
||||
#define MOUSE_MODEL_EASYSCROLL 6
|
||||
#define MOUSE_MODEL_MOUSEMANPLUS 7
|
||||
#define MOUSE_MODEL_KIDSPAD 8
|
||||
#define MOUSE_MODEL_VERSAPAD 9
|
||||
#define MOUSE_MODEL_EXPLORER 10
|
||||
#define MOUSE_MODEL_4D 11
|
||||
#define MOUSE_MODEL_4DPLUS 12
|
||||
|
||||
typedef struct mousemode {
|
||||
int protocol; /* MOUSE_PROTO_XXX */
|
||||
int rate; /* report rate (per sec), -1 if unknown */
|
||||
int resolution; /* MOUSE_RES_XXX, -1 if unknown */
|
||||
int accelfactor; /* accelation factor (must be 1 or greater) */
|
||||
int level; /* driver operation level */
|
||||
int packetsize; /* the length of the data packet */
|
||||
unsigned char syncmask[2]; /* sync. data bits in the header byte */
|
||||
} mousemode_t;
|
||||
|
||||
/* protocol */
|
||||
/*
|
||||
* Serial protocols:
|
||||
* Microsoft, MouseSystems, Logitech, MM series, MouseMan, Hitachi Tablet,
|
||||
* GlidePoint, IntelliMouse, Thinking Mouse, MouseRemote, Kidspad,
|
||||
* VersaPad
|
||||
* Bus mouse protocols:
|
||||
* bus, InPort
|
||||
* PS/2 mouse protocol:
|
||||
* PS/2
|
||||
*/
|
||||
#define MOUSE_PROTO_UNKNOWN (-1)
|
||||
#define MOUSE_PROTO_MS 0 /* Microsoft Serial, 3 bytes */
|
||||
#define MOUSE_PROTO_MSC 1 /* Mouse Systems, 5 bytes */
|
||||
#define MOUSE_PROTO_LOGI 2 /* Logitech, 3 bytes */
|
||||
#define MOUSE_PROTO_MM 3 /* MM series, 3 bytes */
|
||||
#define MOUSE_PROTO_LOGIMOUSEMAN 4 /* Logitech MouseMan 3/4 bytes */
|
||||
#define MOUSE_PROTO_BUS 5 /* MS/Logitech bus mouse */
|
||||
#define MOUSE_PROTO_INPORT 6 /* MS/ATI InPort mouse */
|
||||
#define MOUSE_PROTO_PS2 7 /* PS/2 mouse, 3 bytes */
|
||||
#define MOUSE_PROTO_HITTAB 8 /* Hitachi Tablet 3 bytes */
|
||||
#define MOUSE_PROTO_GLIDEPOINT 9 /* ALPS GlidePoint, 3/4 bytes */
|
||||
#define MOUSE_PROTO_INTELLI 10 /* MS IntelliMouse, 4 bytes */
|
||||
#define MOUSE_PROTO_THINK 11 /* Kensignton Thinking Mouse, 3/4 bytes */
|
||||
#define MOUSE_PROTO_SYSMOUSE 12 /* /dev/sysmouse */
|
||||
#define MOUSE_PROTO_X10MOUSEREM 13 /* X10 MouseRemote, 3 bytes */
|
||||
#define MOUSE_PROTO_KIDSPAD 14 /* Genius Kidspad */
|
||||
#define MOUSE_PROTO_VERSAPAD 15 /* Interlink VersaPad, 6 bytes */
|
||||
|
||||
#define MOUSE_RES_UNKNOWN (-1)
|
||||
#define MOUSE_RES_DEFAULT 0
|
||||
#define MOUSE_RES_LOW (-2)
|
||||
#define MOUSE_RES_MEDIUMLOW (-3)
|
||||
#define MOUSE_RES_MEDIUMHIGH (-4)
|
||||
#define MOUSE_RES_HIGH (-5)
|
||||
|
||||
typedef struct mousedata {
|
||||
int len; /* # of data in the buffer */
|
||||
int buf[16]; /* data buffer */
|
||||
} mousedata_t;
|
||||
|
||||
#if (defined(MOUSE_GETVARS))
|
||||
|
||||
typedef struct mousevar {
|
||||
int var[16];
|
||||
} mousevar_t;
|
||||
|
||||
/* magic numbers in var[0] */
|
||||
#define MOUSE_VARS_PS2_SIG 0x00325350 /* 'PS2' */
|
||||
#define MOUSE_VARS_BUS_SIG 0x00535542 /* 'BUS' */
|
||||
#define MOUSE_VARS_INPORT_SIG 0x00504e49 /* 'INP' */
|
||||
|
||||
#endif /* MOUSE_GETVARS */
|
||||
|
||||
/* Microsoft Serial mouse data packet */
|
||||
#define MOUSE_MSS_PACKETSIZE 3
|
||||
#define MOUSE_MSS_SYNCMASK 0x40
|
||||
#define MOUSE_MSS_SYNC 0x40
|
||||
#define MOUSE_MSS_BUTTONS 0x30
|
||||
#define MOUSE_MSS_BUTTON1DOWN 0x20 /* left */
|
||||
#define MOUSE_MSS_BUTTON2DOWN 0x00 /* no middle button */
|
||||
#define MOUSE_MSS_BUTTON3DOWN 0x10 /* right */
|
||||
|
||||
/* Logitech MouseMan data packet (M+ protocol) */
|
||||
#define MOUSE_LMAN_BUTTON2DOWN 0x20 /* middle button, the 4th byte */
|
||||
|
||||
/* ALPS GlidePoint extension (variant of M+ protocol) */
|
||||
#define MOUSE_ALPS_BUTTON2DOWN 0x20 /* middle button, the 4th byte */
|
||||
#define MOUSE_ALPS_TAP 0x10 /* `tapping' action, the 4th byte */
|
||||
|
||||
/* Kinsington Thinking Mouse extension (variant of M+ protocol) */
|
||||
#define MOUSE_THINK_BUTTON2DOWN 0x20 /* lower-left button, the 4th byte */
|
||||
#define MOUSE_THINK_BUTTON4DOWN 0x10 /* lower-right button, the 4th byte */
|
||||
|
||||
/* MS IntelliMouse (variant of MS Serial) */
|
||||
#define MOUSE_INTELLI_PACKETSIZE 4
|
||||
#define MOUSE_INTELLI_BUTTON2DOWN 0x10 /* middle button in the 4th byte */
|
||||
|
||||
/* Mouse Systems Corp. mouse data packet */
|
||||
#define MOUSE_MSC_PACKETSIZE 5
|
||||
#define MOUSE_MSC_SYNCMASK 0xf8
|
||||
#define MOUSE_MSC_SYNC 0x80
|
||||
#define MOUSE_MSC_BUTTONS 0x07
|
||||
#define MOUSE_MSC_BUTTON1UP 0x04 /* left */
|
||||
#define MOUSE_MSC_BUTTON2UP 0x02 /* middle */
|
||||
#define MOUSE_MSC_BUTTON3UP 0x01 /* right */
|
||||
#define MOUSE_MSC_MAXBUTTON 3
|
||||
|
||||
/* MM series mouse data packet */
|
||||
#define MOUSE_MM_PACKETSIZE 3
|
||||
#define MOUSE_MM_SYNCMASK 0xe0
|
||||
#define MOUSE_MM_SYNC 0x80
|
||||
#define MOUSE_MM_BUTTONS 0x07
|
||||
#define MOUSE_MM_BUTTON1DOWN 0x04 /* left */
|
||||
#define MOUSE_MM_BUTTON2DOWN 0x02 /* middle */
|
||||
#define MOUSE_MM_BUTTON3DOWN 0x01 /* right */
|
||||
#define MOUSE_MM_XPOSITIVE 0x10
|
||||
#define MOUSE_MM_YPOSITIVE 0x08
|
||||
|
||||
/* PS/2 mouse data packet */
|
||||
#define MOUSE_PS2_PACKETSIZE 3
|
||||
#define MOUSE_PS2_SYNCMASK 0xc8
|
||||
#define MOUSE_PS2_SYNC 0x08
|
||||
#define MOUSE_PS2_BUTTONS 0x07 /* 0x03 for 2 button mouse */
|
||||
#define MOUSE_PS2_BUTTON1DOWN 0x01 /* left */
|
||||
#define MOUSE_PS2_BUTTON2DOWN 0x04 /* middle */
|
||||
#define MOUSE_PS2_BUTTON3DOWN 0x02 /* right */
|
||||
#define MOUSE_PS2_TAP MOUSE_PS2_SYNC /* GlidePoint (PS/2) `tapping'
|
||||
* Yes! this is the same bit
|
||||
* as SYNC!
|
||||
*/
|
||||
|
||||
#define MOUSE_PS2_XNEG 0x10
|
||||
#define MOUSE_PS2_YNEG 0x20
|
||||
#define MOUSE_PS2_XOVERFLOW 0x40
|
||||
#define MOUSE_PS2_YOVERFLOW 0x80
|
||||
|
||||
/* Logitech MouseMan+ (PS/2) data packet (PS/2++ protocol) */
|
||||
#define MOUSE_PS2PLUS_SYNCMASK 0x48
|
||||
#define MOUSE_PS2PLUS_SYNC 0x48
|
||||
#define MOUSE_PS2PLUS_ZNEG 0x08 /* sign bit */
|
||||
#define MOUSE_PS2PLUS_BUTTON4DOWN 0x10 /* 4th button on MouseMan+ */
|
||||
#define MOUSE_PS2PLUS_BUTTON5DOWN 0x20
|
||||
|
||||
/* IBM ScrollPoint (PS/2) also uses PS/2++ protocol */
|
||||
#define MOUSE_SPOINT_ZNEG 0x80 /* sign bits */
|
||||
#define MOUSE_SPOINT_WNEG 0x08
|
||||
|
||||
/* MS IntelliMouse (PS/2) data packet */
|
||||
#define MOUSE_PS2INTELLI_PACKETSIZE 4
|
||||
/* some compatible mice have additional buttons */
|
||||
#define MOUSE_PS2INTELLI_BUTTON4DOWN 0x40
|
||||
#define MOUSE_PS2INTELLI_BUTTON5DOWN 0x80
|
||||
|
||||
/* MS IntelliMouse Explorer (PS/2) data packet (variation of IntelliMouse) */
|
||||
#define MOUSE_EXPLORER_ZNEG 0x08 /* sign bit */
|
||||
/* IntelliMouse Explorer has additional button data in the fourth byte */
|
||||
#define MOUSE_EXPLORER_BUTTON4DOWN 0x10
|
||||
#define MOUSE_EXPLORER_BUTTON5DOWN 0x20
|
||||
|
||||
/* Interlink VersaPad (serial I/F) data packet */
|
||||
#define MOUSE_VERSA_PACKETSIZE 6
|
||||
#define MOUSE_VERSA_IN_USE 0x04
|
||||
#define MOUSE_VERSA_SYNCMASK 0xc3
|
||||
#define MOUSE_VERSA_SYNC 0xc0
|
||||
#define MOUSE_VERSA_BUTTONS 0x30
|
||||
#define MOUSE_VERSA_BUTTON1DOWN 0x20 /* left */
|
||||
#define MOUSE_VERSA_BUTTON2DOWN 0x00 /* middle */
|
||||
#define MOUSE_VERSA_BUTTON3DOWN 0x10 /* right */
|
||||
#define MOUSE_VERSA_TAP 0x08
|
||||
|
||||
/* Interlink VersaPad (PS/2 I/F) data packet */
|
||||
#define MOUSE_PS2VERSA_PACKETSIZE 6
|
||||
#define MOUSE_PS2VERSA_IN_USE 0x10
|
||||
#define MOUSE_PS2VERSA_SYNCMASK 0xe8
|
||||
#define MOUSE_PS2VERSA_SYNC 0xc8
|
||||
#define MOUSE_PS2VERSA_BUTTONS 0x05
|
||||
#define MOUSE_PS2VERSA_BUTTON1DOWN 0x04 /* left */
|
||||
#define MOUSE_PS2VERSA_BUTTON2DOWN 0x00 /* middle */
|
||||
#define MOUSE_PS2VERSA_BUTTON3DOWN 0x01 /* right */
|
||||
#define MOUSE_PS2VERSA_TAP 0x02
|
||||
|
||||
/* A4 Tech 4D Mouse (PS/2) data packet */
|
||||
#define MOUSE_4D_PACKETSIZE 3
|
||||
#define MOUSE_4D_WHEELBITS 0xf0
|
||||
|
||||
/* A4 Tech 4D+ Mouse (PS/2) data packet */
|
||||
#define MOUSE_4DPLUS_PACKETSIZE 3
|
||||
#define MOUSE_4DPLUS_ZNEG 0x04 /* sign bit */
|
||||
#define MOUSE_4DPLUS_BUTTON4DOWN 0x08
|
||||
|
||||
/* sysmouse extended data packet */
|
||||
/*
|
||||
* /dev/sysmouse sends data in two formats, depending on the protocol
|
||||
* level. At the level 0, format is exactly the same as MousSystems'
|
||||
* five byte packet. At the level 1, the first five bytes are the same
|
||||
* as at the level 0. There are additional three bytes which shows
|
||||
* `dz' and the states of additional buttons. `dz' is expressed as the
|
||||
* sum of the byte 5 and 6 which contain signed seven bit values.
|
||||
* The states of the button 4 though 10 are in the bit 0 though 6 in
|
||||
* the byte 7 respectively: 1 indicates the button is up.
|
||||
*/
|
||||
#define MOUSE_SYS_PACKETSIZE 8
|
||||
#define MOUSE_SYS_SYNCMASK 0xf8
|
||||
#define MOUSE_SYS_SYNC 0x80
|
||||
#define MOUSE_SYS_BUTTON1UP 0x04 /* left, 1st byte */
|
||||
#define MOUSE_SYS_BUTTON2UP 0x02 /* middle, 1st byte */
|
||||
#define MOUSE_SYS_BUTTON3UP 0x01 /* right, 1st byte */
|
||||
#define MOUSE_SYS_BUTTON4UP 0x0001 /* 7th byte */
|
||||
#define MOUSE_SYS_BUTTON5UP 0x0002
|
||||
#define MOUSE_SYS_BUTTON6UP 0x0004
|
||||
#define MOUSE_SYS_BUTTON7UP 0x0008
|
||||
#define MOUSE_SYS_BUTTON8UP 0x0010
|
||||
#define MOUSE_SYS_BUTTON9UP 0x0020
|
||||
#define MOUSE_SYS_BUTTON10UP 0x0040
|
||||
#define MOUSE_SYS_MAXBUTTON 10
|
||||
#define MOUSE_SYS_STDBUTTONS 0x07
|
||||
#define MOUSE_SYS_EXTBUTTONS 0x7f /* the others */
|
||||
|
||||
/* Mouse remote socket */
|
||||
#define _PATH_MOUSEREMOTE "/var/run/MouseRemote"
|
||||
|
||||
#endif /* _SYS_MOUSE_H_ */
|
||||
|
||||
|
||||
/* mouse cursor ioctl */
|
||||
struct mouse_data {
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
int buttons;
|
||||
};
|
||||
typedef struct mouse_data mouse_data_t;
|
||||
|
||||
struct mouse_mode {
|
||||
int mode;
|
||||
int signal;
|
||||
};
|
||||
typedef struct mouse_mode mouse_mode_t;
|
||||
|
||||
struct mouse_event {
|
||||
int id; /* one based */
|
||||
int value;
|
||||
};
|
||||
typedef struct mouse_event mouse_event_t;
|
||||
|
||||
struct mouse_info {
|
||||
int operation;
|
||||
#define MOUSE_SHOW 0x01
|
||||
#define MOUSE_HIDE 0x02
|
||||
#define MOUSE_MOVEABS 0x03
|
||||
#define MOUSE_MOVEREL 0x04
|
||||
#define MOUSE_GETINFO 0x05
|
||||
#define MOUSE_MODE 0x06
|
||||
#define MOUSE_ACTION 0x07
|
||||
#define MOUSE_MOTION_EVENT 0x08
|
||||
#define MOUSE_BUTTON_EVENT 0x09
|
||||
#define MOUSE_MOUSECHAR 0x0a
|
||||
union {
|
||||
mouse_data_t data;
|
||||
mouse_mode_t mode;
|
||||
mouse_event_t event;
|
||||
int mouse_char;
|
||||
} u;
|
||||
};
|
||||
typedef struct mouse_info mouse_info_t;
|
|
@ -0,0 +1,443 @@
|
|||
.\" $NetBSD: moused.8,v 1.1 2001/10/29 23:23:42 augustss Exp $
|
||||
.\" Copyright (c) 1996
|
||||
.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by Mike Pritchard.
|
||||
.\" 4. Neither the name of the author nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $FreeBSD: src/usr.sbin/moused/moused.8,v 1.39 2001/08/10 13:45:34 ru Exp $
|
||||
.\"
|
||||
.Dd October 29, 2001
|
||||
.Dt MOUSED 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm moused
|
||||
.Nd pass mouse data to mouse mux
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl DPRacdfs
|
||||
.Op Fl I Ar file
|
||||
.Op Fl F Ar rate
|
||||
.Op Fl r Ar resolution
|
||||
.Op Fl S Ar baudrate
|
||||
.Op Fl W Ar devicename
|
||||
.Op Fl a Ar X Ns Op ,Y
|
||||
.Op Fl m Ar N=M
|
||||
.Op Fl w Ar N
|
||||
.Op Fl z Ar target
|
||||
.Op Fl t Ar mousetype
|
||||
.Op Fl 3 Op Fl E Ar timeout
|
||||
.Fl p Ar port
|
||||
.Pp
|
||||
.Nm
|
||||
.Op Fl Pd
|
||||
.Fl p Ar port
|
||||
.Fl i Ar info
|
||||
.Sh DESCRIPTION
|
||||
The mouse daemon
|
||||
.Nm
|
||||
and the console driver work together to support
|
||||
access to serial mice from user programs.
|
||||
They virtualize the mouse and provide user programs with mouse data
|
||||
in the standard format
|
||||
(see
|
||||
.Xr wsmouse 4 ) .
|
||||
.Pp
|
||||
The mouse daemon listens to the specified port for mouse data,
|
||||
interprets and then passes it via ioctls to the console driver.
|
||||
The mouse daemon
|
||||
reports translation movement, button press/release
|
||||
events and movement of the roller or the wheel if available.
|
||||
The roller/wheel movement is reported as ``Z'' axis movement.
|
||||
.Pp
|
||||
If the mouse daemon receives the signal
|
||||
.Dv SIGHUP ,
|
||||
it will reopen the mouse port and reinitializes itself.
|
||||
Useful if
|
||||
the mouse is attached/detached while the system is suspended.
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width indent
|
||||
.It Fl 3
|
||||
Emulate the third (middle) button for 2-button mice.
|
||||
It is emulated
|
||||
by pressing the left and right physical buttons simultaneously.
|
||||
.It Fl D
|
||||
Lower DTR on the serial port.
|
||||
This option is valid only if
|
||||
.Ar mousesystems
|
||||
is selected as the protocol type.
|
||||
The DTR line may need to be dropped for a 3-button mouse
|
||||
to operate in the
|
||||
.Ar mousesystems
|
||||
mode.
|
||||
.It Fl E Ar timeout
|
||||
When the third button emulation is enabled
|
||||
(see above),
|
||||
the
|
||||
.Nm
|
||||
daemon waits
|
||||
.Ar timeout
|
||||
msec at most before deciding whether two buttons are being pressed
|
||||
simultaneously.
|
||||
The default timeout is 100 msec.
|
||||
.It Fl F Ar rate
|
||||
Set the report rate (reports/sec) of the device if supported.
|
||||
.It Fl I Ar file
|
||||
Write the process id of the
|
||||
.Nm
|
||||
daemon in the specified file.
|
||||
Without this option, the process id will be stored in
|
||||
.Pa /var/run/moused.pid .
|
||||
.It Fl P
|
||||
Do not start the Plug and Play COM device enumeration procedure
|
||||
when identifying the serial mouse.
|
||||
If this option is given together with the
|
||||
.Fl i
|
||||
option, the
|
||||
.Nm
|
||||
command will not be able to print useful information for the serial mouse.
|
||||
.It Fl R
|
||||
Lower RTS on the serial port.
|
||||
This option is valid only if
|
||||
.Ar mousesystems
|
||||
is selected as the protocol type by the
|
||||
.Fl t
|
||||
option below.
|
||||
It is often used with the
|
||||
.Fl D
|
||||
option above.
|
||||
Both RTS and DTR lines may need to be dropped for
|
||||
a 3-button mouse to operate in the
|
||||
.Ar mousesystems
|
||||
mode.
|
||||
.It Fl S Ar baudrate
|
||||
Select the baudrate for the serial port (1200 to 9600).
|
||||
Not all serial mice support this option.
|
||||
.It Fl W Ar devicename
|
||||
Select the
|
||||
.Xr wsmux 4
|
||||
control device. The default is
|
||||
.Pa /dev/wsmuxctl0 .
|
||||
.It Fl a Ar X Ns Op ,Y
|
||||
Accelerate or decelerate the mouse input.
|
||||
This is a linear acceleration only.
|
||||
Values less than 1.0 slow down movement, values greater than 1.0 speed it
|
||||
up.
|
||||
Specifying only one value sets the acceleration for both axes.
|
||||
.It Fl c
|
||||
Some mice report middle button down events
|
||||
as if the left and right buttons are being pressed.
|
||||
This option handles this.
|
||||
.It Fl d
|
||||
Enable debugging messages.
|
||||
.It Fl f
|
||||
Do not become a daemon and instead run as a foreground process.
|
||||
Useful for testing and debugging.
|
||||
.It Fl i Ar info
|
||||
Print specified information and quit. Available pieces of
|
||||
information are:
|
||||
.Pp
|
||||
.Bl -tag -compact -width modelxxx
|
||||
.It Ar port
|
||||
Port (device file) name, e.g.\&
|
||||
.Pa /dev/tty00 .
|
||||
.It Ar if
|
||||
Interface type: serial, bus, inport or ps/2.
|
||||
.It Ar type
|
||||
Protocol type.
|
||||
It is one of the types listed under the
|
||||
.Fl t
|
||||
option below
|
||||
.It Ar model
|
||||
Mouse model. The
|
||||
.Nm
|
||||
command may not always be able to identify the model.
|
||||
.It Ar all
|
||||
All of the above items. Print port, interface, type and model in this order
|
||||
in one line.
|
||||
.El
|
||||
.Pp
|
||||
If the
|
||||
.Nm
|
||||
command cannot determine the requested information, it prints ``unknown''
|
||||
or ``generic''.
|
||||
.It Fl m Ar N=M
|
||||
Assign the physical button
|
||||
.Ar M
|
||||
to the logical button
|
||||
.Ar N .
|
||||
You may specify as many instances of this option as you like.
|
||||
More than one physical button may be assigned to a logical button at the
|
||||
same time.
|
||||
In this case the logical button will be down,
|
||||
if either of the assigned physical buttons is held down.
|
||||
Do not put space around `='.
|
||||
.It Fl p Ar port
|
||||
Use
|
||||
.Ar port
|
||||
to communicate with the mouse.
|
||||
.It Fl r Ar resolution
|
||||
Set the resolution of the device; in Dots Per Inch, or
|
||||
.Ar low ,
|
||||
.Ar medium-low ,
|
||||
.Ar medium-high
|
||||
or
|
||||
.Ar high .
|
||||
This option may not be supported by all the device.
|
||||
.It Fl s
|
||||
Select a baudrate of 9600 for the serial line.
|
||||
Not all serial mice support this option.
|
||||
.It Fl t Ar type
|
||||
Specify the protocol type of the mouse attached to the port.
|
||||
You may explicitly specify a type listed below, or use
|
||||
.Ar auto
|
||||
to let the
|
||||
.Nm
|
||||
command to automatically select an appropriate protocol for the given
|
||||
mouse.
|
||||
If you entirely ommit this options in the command line,
|
||||
.Fl t Ar auto
|
||||
is assumed.
|
||||
Under normal circumstances,
|
||||
you need to use this option only if the
|
||||
.Nm
|
||||
command is not able to detect the protocol automatically.
|
||||
.Pp
|
||||
Note that if a protocol type is specified with this option, the
|
||||
.Fl P
|
||||
option above is implied and Plug and Play COM device enumeration
|
||||
procedure will be disabled.
|
||||
.Pp
|
||||
Valid types for this option are
|
||||
listed below.
|
||||
.Pp
|
||||
For the serial mouse:
|
||||
.Bl -tag -compact -width mousesystemsxxx
|
||||
.It Ar microsoft
|
||||
Microsoft serial mouse protocol. Most 2-button serial mice use this protocol.
|
||||
.It Ar intellimouse
|
||||
Microsoft IntelliMouse protocol. Genius NetMouse, ASCII Mie Mouse,
|
||||
Logitech MouseMan+ and FirstMouse+ use this protocol too.
|
||||
Other mice with a roller/wheel may be compatible with this protocol.
|
||||
.It Ar mousesystems
|
||||
MouseSystems 5-byte protocol. 3-button mice may use this protocol.
|
||||
.It Ar mmseries
|
||||
MM Series mouse protocol.
|
||||
.It Ar logitech
|
||||
Logitech mouse protocol. Note that this is for old Logitech models.
|
||||
.Ar mouseman
|
||||
or
|
||||
.Ar intellimouse
|
||||
should be specified for newer models.
|
||||
.It Ar mouseman
|
||||
Logitech MouseMan and TrackMan protocol. Some 3-button mice may be compatible
|
||||
with this protocol. Note that MouseMan+ and FirstMouse+ use
|
||||
.Ar intellimouse
|
||||
protocol rather than this one.
|
||||
.It Ar glidepoint
|
||||
ALPS GlidePoint protocol.
|
||||
.It Ar thinkingmouse
|
||||
Kensington ThinkingMouse protocol.
|
||||
.It Ar mmhitab
|
||||
Hitachi tablet protocol.
|
||||
.It Ar x10mouseremote
|
||||
X10 MouseRemote.
|
||||
.It Ar kidspad
|
||||
Genius Kidspad and Easypad protocol.
|
||||
.It Ar versapad
|
||||
Interlink VersaPad protocol.
|
||||
.El
|
||||
.It Fl w Ar N
|
||||
Make the physical button
|
||||
.Ar N
|
||||
act as the wheel mode button.
|
||||
While this button is pressed, X and Y axis movement is reported to be zero
|
||||
and the Y axis movement is mapped to Z axis.
|
||||
You may further map the Z axis movement to virtual buttons by the
|
||||
.Fl z
|
||||
option below.
|
||||
.It Fl z Ar target
|
||||
Map Z axis (roller/wheel) movement to another axis or to virtual buttons.
|
||||
Valid
|
||||
.Ar target
|
||||
maybe:
|
||||
.Bl -tag -compact -width x__
|
||||
.It Ar x
|
||||
.It Ar y
|
||||
X or Y axis movement will be reported when the Z axis movement is detected.
|
||||
.It Ar N
|
||||
Report down events for the virtual buttons
|
||||
.Ar N
|
||||
and
|
||||
.Ar N+1
|
||||
respectively when negative and positive Z axis movement
|
||||
is detected.
|
||||
There do not need to be physical buttons
|
||||
.Ar N
|
||||
and
|
||||
.Ar N+1 .
|
||||
Note that mapping to logical buttons is carried out after mapping
|
||||
from the Z axis movement to the virtual buttons is done.
|
||||
.It Ar N1 N2
|
||||
Report down events for the virtual buttons
|
||||
.Ar N1
|
||||
and
|
||||
.Ar N2
|
||||
respectively when negative and positive Z axis movement
|
||||
is detected.
|
||||
.It Ar N1 N2 N3 N4
|
||||
This is useful for the mouse with two wheels of which
|
||||
the second wheel is used to generate horizontal scroll action,
|
||||
and for the mouse which has a knob or a stick which can detect
|
||||
the horizontal force applied by the user.
|
||||
.Pp
|
||||
The motion of the second wheel will be mapped to the buttons
|
||||
.Ar N3 ,
|
||||
for the negative direction, and
|
||||
.Ar N4 ,
|
||||
for the positive direction.
|
||||
If the buttons
|
||||
.Ar N3
|
||||
and
|
||||
.Ar N4
|
||||
actually exist in this mouse, their actions will not be detected.
|
||||
.Pp
|
||||
Note that horizontal movement or second roller/wheel movement may not
|
||||
always be detected,
|
||||
because there appears to be no accepted standard as to how it is encoded.
|
||||
.Pp
|
||||
Note also that some mice think left is the negative horizontal direction,
|
||||
others may think otherwise.
|
||||
Moreover, there are some mice whose two wheels are both mounted vertically,
|
||||
and the direction of the second vertical wheel does not match the
|
||||
first one's.
|
||||
.El
|
||||
.El
|
||||
.Ss Multiple Mice
|
||||
As many instances of the mouse daemon as the number of mice attached to
|
||||
the system may be run simultaneously; one
|
||||
instance for each serial mouse.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /var/run/moused.pid -compact
|
||||
.It Pa /dev/wsmuxctl0
|
||||
default device to control mouse mux.
|
||||
.It Pa /var/run/moused.pid
|
||||
process id of the currently running
|
||||
.Nm
|
||||
daemon
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
.Dl moused -p /dev/tty00 -i type
|
||||
.Pp
|
||||
Let the
|
||||
.Nm
|
||||
command determine the protocol type of the mouse at the serial port
|
||||
.Pa /dev/tty00 .
|
||||
If successful, the command will print the type, otherwise it will say
|
||||
``unknown''.
|
||||
.Pp
|
||||
.Dl moused -p /dev/tty00
|
||||
.Pp
|
||||
If the
|
||||
.Nm
|
||||
command is able to identify the protocol type of the mouse at the specified
|
||||
port automatically, you can start the daemon without the
|
||||
.Fl t
|
||||
option and enable the mouse pointer in the text console as above.
|
||||
.Pp
|
||||
.Dl moused -p /dev/tty01 -t microsoft
|
||||
.Pp
|
||||
Start the mouse daemon on the serial port
|
||||
.Pa /dev/tty01 .
|
||||
The protocol type
|
||||
.Ar microsoft
|
||||
is explicitly specified by the
|
||||
.Fl t
|
||||
option.
|
||||
.Pp
|
||||
.Dl moused -p /dev/tty01 -m 1=3 -m 3=1
|
||||
.Pp
|
||||
Assign the physical button 3 (right button) to the logical button 1
|
||||
(logical left) and the physical button 1 (left) to the logical
|
||||
button 3 (logical right).
|
||||
This will effectively swap the left and right buttons.
|
||||
.Pp
|
||||
.Dl moused -p /dev/tty01 -t intellimouse -z 4
|
||||
.Pp
|
||||
Report negative Z axis (roller) movement as the button 4 pressed
|
||||
and positive Z axis movement as the button 5 pressed.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
command is normally enabled by setting
|
||||
.Pa moused=YES
|
||||
in
|
||||
.Pa /etc/rc.conf .
|
||||
.Sh CAVEATS
|
||||
Many pad devices behave as if the first (left) button were pressed if
|
||||
the user `taps' the surface of the pad.
|
||||
In contrast, some ALPS GlidePoint and Interlink VersaPad models
|
||||
treat the tapping action
|
||||
as fourth button events.
|
||||
Use the option ``-m 1=4'' for these models
|
||||
to obtain the same effect as the other pad devices.
|
||||
.Sh SEE ALSO
|
||||
.Xr wsmouse 4 ,
|
||||
.Xr wsmux 4
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Nm
|
||||
command partially supports
|
||||
.Dq Plug and Play External COM Device Specification
|
||||
in order to support PnP serial mice.
|
||||
However, due to various degrees of conformance to the specification by
|
||||
existing serial mice, it does not strictly follow the version 1.0 of the
|
||||
standard.
|
||||
Even with this less strict approach,
|
||||
it may not always determine an appropriate protocol type
|
||||
for the given serial mouse.
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
command was written by
|
||||
.An Michael Smith Aq msmith@FreeBSD.org .
|
||||
This manual page was written by
|
||||
.An Mike Pritchard Aq mpp@FreeBSD.org .
|
||||
The command and manual page have since been updated by
|
||||
.An Kazutaka Yokota Aq yokota@FreeBSD.org .
|
||||
The
|
||||
.Nx
|
||||
port was done by
|
||||
.An Lennart Augustsson Aq augustss@NetBSD.org .
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command first appeared in
|
||||
.Fx 2.2
|
||||
and
|
||||
.Nx 1.6 .
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue