Remove mse(4) from tree

Remove mse and all support for bus and inport devices from the tree.
Data from nycbug's dmesg database shows the last sighting of this
driver was in 4.10 on only one machine.

Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D17628
This commit is contained in:
imp 2018-10-22 02:34:10 +00:00
parent ba47cdd36c
commit e4026c4f30
19 changed files with 11 additions and 1572 deletions

View File

@ -38,6 +38,8 @@
# xargs -n1 | sort | uniq -d;
# done
# 20181021: mse(4) removal
OLD_FILES+=usr/share/man/man4/mse.4.gz
# 20181021: joy(4) removal
OLD_FILES+=usr/share/man/man4/joy.4.gz
OLD_FILES+=usr/include/sys/joystick.h

View File

@ -16,7 +16,6 @@ MAN= aic.4 \
glxiic.4 \
glxsb.4 \
longrun.4 \
mse.4 \
npx.4 \
pae.4 \
pbio.4 \

View File

@ -1,379 +0,0 @@
.\" Copyright 1992 by the University of Guelph
.\"
.\" Permission to use, copy and modify this
.\" software and its documentation for any purpose and without
.\" fee is hereby granted, provided that the above copyright
.\" notice appear in all copies and that both that copyright
.\" notice and this permission notice appear in supporting
.\" documentation.
.\" University of Guelph makes no representations about the suitability of
.\" this software for any purpose. It is provided "as is"
.\" without express or implied warranty.
.\"
.\" $FreeBSD$
.\"
.Dd December 3, 1997
.Dt MSE 4 i386
.Os
.Sh NAME
.Nm mse
.Nd bus and InPort mice driver
.Sh SYNOPSIS
.\" .Cd "options MSE_XXX=N"
.Cd "device mse"
.Pp
In
.Pa /boot/device.hints :
.Cd hint.mse.0.at="isa"
.Cd hint.mse.0.port="0x23c"
.Cd hint.mse.0.irq="5"
.Sh DESCRIPTION
The
.Nm
driver provides support for the bus mouse and the InPort mouse, which
are often collectively called ``bus'' mice, as these mice are sold with
an interface card which needs to be installed in an expansion bus slot.
The interface circuit may come on an integrated I/O card or as an option
on video cards.
.Pp
The bus and InPort mice have two or three buttons,
and a D-sub 9-pin male connector or a round DIN 9-pin
male connector.
.Pp
The primary port address of the bus and InPort mouse interface cards
is usually 0x23c.
Some cards may also be set to use the secondary port
address at 0x238.
The interface cards require a single IRQ, which may be
2, 3, 4 or 5.
Some cards may offer additional IRQs.
The port number and the IRQ number are configured by jumpers on the cards
or by software provided with the card.
.Pp
Frequency, or report rate, at which the device sends movement
and button state reports to the host system, may also be configurable on
some interface cards.
It may be 15, 30, 60 or 120Hz.
.Pp
The difference between the two types of the mice is not in mouse devices
(in fact they are exactly the same).
But in the circuit on the interface
cards.
This means that the device from a bus mouse package can be
connected to the interface card from an InPort mouse package, or vice
versa, provided that their connectors match.
.Ss Operation Levels
The
.Nm
driver has two levels of operation.
The current operation level can be set via an ioctl call.
.Pp
At the level zero the basic support is provided; the device driver will report
horizontal and vertical movement of the attached device
and state of up to three buttons in the format described below.
It is a subset of the MouseSystems protocol.
.Pp
.Bl -tag -width Byte_1 -compact
.It Byte 1
.Bl -tag -width bit_7 -compact
.It bit 7
Always one.
.It bit 6..3
Always zero.
.It bit 2
Left button status; cleared if pressed, otherwise set.
.It bit 1
Middle button status; cleared if pressed, otherwise set.
Always one,
if the device does not have the middle button.
.It bit 0
Right button status; cleared if pressed, otherwise set.
.El
.It Byte 2
Horizontal movement count in two's compliment; -128 through 127.
.It Byte 3
Vertical movement count in two's compliment; -128 through 127.
.It Byte 4
Always zero.
.It Byte 5
Always zero.
.El
.Pp
This is the default level of operation and the driver is initially
at this level when opened by the user program.
.Pp
At the operation level one (extended level), a data packet is encoded
in the standard format
.Dv MOUSE_PROTO_SYSMOUSE
as defined in
.Xr mouse 4 .
.Ss Acceleration
The
.Nm
driver can somewhat `accelerate' the movement of the pointing device.
The faster you move the device, the further the pointer
travels on the screen.
The driver has an internal variable which governs the effect of
the acceleration.
Its value can be modified via the driver flag
or via an ioctl call.
.Ss Device Number
The minor device number of the
.Nm
is made up of:
.Bd -literal -offset indent
minor = (`unit' << 1) | `non-blocking'
.Ed
.Pp
where `unit' is the device number (usually 0) and the `non-blocking' bit
is set to indicate ``do not block waiting for mouse input,
return immediately''.
The `non-blocking' bit should be set for \fIXFree86\fP,
therefore the minor device number usually used for \fIXFree86\fP is 1.
See
.Sx FILES
for device node names.
.Sh DRIVER CONFIGURATION
.\" .Ss Kernel Configuration Options
.Ss Driver Flags
The
.Nm
driver accepts the following driver flag.
Set it in the
kernel configuration file
(see
.Xr config 8 )
or in the User Configuration Menu at
the boot time
(see
.Xr boot 8 ) .
.Bl -tag -width MOUSE
.It bit 4..7 ACCELERATION
This flag controls the amount of acceleration effect.
The smaller the value of this flag is, more sensitive the movement becomes.
The minimum value allowed, thus the value for the most sensitive setting,
is one.
Setting this flag to zero will completely disables the
acceleration effect.
.El
.Sh IOCTLS
There are a few
.Xr ioctl 2
commands for mouse drivers.
These commands and related structures and constants are defined in
.In sys/mouse.h .
General description of the commands is given in
.Xr mouse 4 .
This section explains the features specific to the
.Nm
driver.
.Pp
.Bl -tag -width MOUSE -compact
.It Dv MOUSE_GETLEVEL Ar int *level
.It Dv MOUSE_SETLEVEL Ar int *level
These commands manipulate the operation level of the
.Nm
driver.
.Pp
.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
Returns the hardware information of the attached device in the following
structure.
Only the
.Dv iftype
field is guaranteed to be filled with the correct value by the current
version of the
.Nm
driver.
.Bd -literal
typedef struct mousehw {
int buttons; /* number of buttons */
int iftype; /* I/F type */
int type; /* mouse/track ball/pad... */
int model; /* I/F dependent model ID */
int hwid; /* I/F dependent hardware ID */
} mousehw_t;
.Ed
.Pp
The
.Dv buttons
field holds the number of buttons on the device.
.Pp
The
.Dv iftype
is either
.Dv MOUSE_IF_BUS
or
.Dv MOUSE_IF_INPORT .
.Pp
The
.Dv type
may be
.Dv MOUSE_MOUSE ,
.Dv MOUSE_TRACKBALL ,
.Dv MOUSE_STICK ,
.Dv MOUSE_PAD ,
or
.Dv MOUSE_UNKNOWN .
.Pp
The
.Dv model
is always
.Dv MOUSE_MODEL_GENERIC
at the operation level 0.
It may be
.Dv MOUSE_MODEL_GENERIC
or one of
.Dv MOUSE_MODEL_XXX
constants at higher operation levels.
.Pp
The
.Dv hwid
is always 0.
.Pp
.It Dv MOUSE_GETMODE Ar mousemode_t *mode
The command gets the current operation parameters of the mouse
driver.
.Bd -literal
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; /* acceleration factor */
int level; /* driver operation level */
int packetsize; /* the length of the data packet */
unsigned char syncmask[2]; /* sync. bits */
} mousemode_t;
.Ed
.Pp
The
.Dv protocol
is either
.Dv MOUSE_PROTO_BUS
or
.Dv MOUSE_PROTO_INPORT
at the operation level zero.
.Dv MOUSE_PROTO_SYSMOUSE
at the operation level one.
.Pp
The
.Dv rate
is the status report rate (reports/sec) at which the device will send
movement report to the host computer.
As there is no standard to detect the current setting,
this field is always set to -1.
.Pp
The
.Dv resolution
is always set to -1.
.Pp
The
.Dv accelfactor
field holds a value to control acceleration feature
(see
.Sx Acceleration ) .
It is zero or greater.
If it is zero, acceleration is disabled.
.Pp
The
.Dv packetsize
field specifies the length of the data packet.
It depends on the
operation level.
.Pp
.Bl -tag -width level_0__ -compact
.It Em level 0
5 bytes
.It Em level 1
8 bytes
.El
.Pp
The array
.Dv syncmask
holds a bit mask and pattern to detect the first byte of the
data packet.
.Dv syncmask[0]
is the bit mask to be ANDed with a byte.
If the result is equal to
.Dv syncmask[1] ,
the byte is likely to be the first byte of the data packet.
Note that this detection method is not 100% reliable,
thus, should be taken only as an advisory measure.
.Pp
Only
.Dv level
and
.Dv accelfactor
are modifiable by the
.Dv MOUSE_SETMODE
command.
Changing the other field does not cause error, but has no effect.
.Pp
.It Dv MOUSE_SETMODE Ar mousemode_t *mode
The command changes the current operation parameters of the mouse driver
as specified in
.Ar mode .
Only
.Dv level
and
.Dv accelfactor
may be modifiable.
Setting values in the other field does not generate
error and has no effect.
.Pp
.It Dv MOUSE_READDATA Ar mousedata_t *data
.It Dv MOUSE_READSTATE Ar mousedata_t *state
These commands are not supported by the
.Nm
driver.
.Pp
.It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
The command returns the current state of buttons and
movement counts as described in
.Xr mouse 4 .
.El
.Sh FILES
.Bl -tag -width /dev/nmse0 -compact
.It Pa /dev/mse0
`non-blocking' device node in the system without
.Em devfs ,
`blocking' under
.Em devfs .
.It Pa /dev/nmse0
`non-blocking' device node under
.Em devfs .
.El
.Sh EXAMPLES
.Dl "device mse"
.Pp
In
.Pa /boot/device.hints :
.Dl hint.mse.0.at="isa"
.Dl hint.mse.0.port="0x23c"
.Dl hint.mse.0.irq="5"
.Pp
Add the
.Nm
driver at the primary port address with the IRQ 5.
.Pp
.Dl "device mse"
.Pp
.Dl hint.mse.1.at="isa"
.Dl hint.mse.1.port="0x238"
.Dl hint.mse.1.irq="4"
.Dl hint.mse.1.flags="0x30"
.Pp
Define the
.Nm
driver at the secondary port address with the IRQ 4 and the acceleration
factor of 3.
.Sh SEE ALSO
.Xr ioctl 2 ,
.Xr mouse 4 ,
.Xr psm 4 ,
.Xr sysmouse 4 ,
.Xr moused 8
.\".Sh HISTORY
.Sh CAVEATS
Some bus mouse interface cards generate interrupts at the fixed report rate
when enabled, whether or not the mouse state is changing.
The others generate interrupts only when the state is changing.

View File

@ -36,7 +36,6 @@
.In sys/mouse.h
.Sh DESCRIPTION
The mouse drivers
.Xr mse 4 ,
.Xr psm 4 ,
.Xr ums 4
and
@ -360,8 +359,6 @@ command.
.Bl -tag -width /dev/sysmouseXX -compact
.It Pa /dev/cuau%d
serial ports
.It Pa /dev/mse%d
bus and InPort mouse device
.It Pa /dev/psm%d
PS/2 mouse device
.It Pa /dev/sysmouse
@ -371,7 +368,6 @@ USB mouse device
.El
.Sh SEE ALSO
.Xr ioctl 2 ,
.Xr mse 4 ,
.Xr psm 4 ,
.Xr sysmouse 4 ,
.Xr ums 4 ,

View File

@ -806,7 +806,6 @@ At debug level 2, much more detailed information is logged.
.Xr syslog 3 ,
.Xr atkbdc 4 ,
.Xr mouse 4 ,
.Xr mse 4 ,
.Xr sysmouse 4 ,
.Xr moused 8 ,
.Xr syslogd 8

View File

@ -3256,11 +3256,9 @@ is set to
this is the actual port the mouse is on.
It might be
.Pa /dev/cuau0
for a COM1 serial mouse,
for a COM1 serial mouse, or
.Pa /dev/psm0
for a PS/2 mouse or
.Pa /dev/mse0
for a bus mouse, for example.
for a PS/2 mouse, for example.
.It Va moused_flags
.Pq Vt str
If

View File

@ -278,8 +278,6 @@ dev/ipmi/ipmi_ssif.c optional ipmi smbus
dev/ipmi/ipmi_pci.c optional ipmi pci
dev/ipmi/ipmi_linux.c optional ipmi compat_linux
dev/le/if_le_isa.c optional le isa
dev/mse/mse.c optional mse
dev/mse/mse_isa.c optional mse isa
dev/nctgpio/nctgpio.c optional nctgpio
dev/nfe/if_nfe.c optional nfe pci
dev/ntb/if_ntb/if_ntb.c optional if_ntb

View File

@ -1,566 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2004 M. Warner Losh
* 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.
*
* 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$
*/
/*
* Copyright 1992 by the University of Guelph
*
* Permission to use, copy and modify this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation.
* University of Guelph makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
* the X386 port, courtesy of
* Rick Macklem, rick@snowhite.cis.uoguelph.ca
* Caveats: The driver currently uses spltty(), but doesn't use any
* generic tty code. It could use splmse() (that only masks off the
* bus mouse interrupt, but that would require hacking in i386/isa/icu.s.
* (This may be worth the effort, since the Logitech generates 30/60
* interrupts/sec continuously while it is open.)
* NB: The ATI has NOT been tested yet!
*/
/*
* Modification history:
* Sep 6, 1994 -- Lars Fredriksen(fredriks@mcs.com)
* improved probe based on input from Logitech.
*
* Oct 19, 1992 -- E. Stark (stark@cs.sunysb.edu)
* fixes to make it work with Microsoft InPort busmouse
*
* Jan, 1993 -- E. Stark (stark@cs.sunysb.edu)
* added patches for new "select" interface
*
* May 4, 1993 -- E. Stark (stark@cs.sunysb.edu)
* changed position of some spl()'s in mseread
*
* October 8, 1993 -- E. Stark (stark@cs.sunysb.edu)
* limit maximum negative x/y value to -127 to work around XFree problem
* that causes spurious button pushes.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/poll.h>
#include <sys/selinfo.h>
#include <sys/uio.h>
#include <sys/mouse.h>
#include <machine/bus.h>
#include <machine/resource.h>
#include <sys/rman.h>
#include <isa/isavar.h>
#include <dev/mse/msevar.h>
devclass_t mse_devclass;
static d_open_t mseopen;
static d_close_t mseclose;
static d_read_t mseread;
static d_ioctl_t mseioctl;
static d_poll_t msepoll;
static struct cdevsw mse_cdevsw = {
.d_version = D_VERSION,
.d_open = mseopen,
.d_close = mseclose,
.d_read = mseread,
.d_ioctl = mseioctl,
.d_poll = msepoll,
.d_name = "mse",
};
static void mseintr(void *);
static void mseintr_locked(mse_softc_t *sc);
static void msetimeout(void *);
#define MSE_NBLOCKIO(dev) (dev2unit(dev) != 0)
#define MSEPRI (PZERO + 3)
int
mse_common_attach(device_t dev)
{
mse_softc_t *sc;
int unit, flags, rid;
sc = device_get_softc(dev);
unit = device_get_unit(dev);
mtx_init(&sc->sc_lock, "mse", NULL, MTX_DEF);
callout_init_mtx(&sc->sc_callout, &sc->sc_lock, 0);
rid = 0;
sc->sc_intr = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_ACTIVE);
if (sc->sc_intr == NULL) {
bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
mtx_destroy(&sc->sc_lock);
return ENXIO;
}
if (bus_setup_intr(dev, sc->sc_intr, INTR_TYPE_TTY | INTR_MPSAFE,
NULL, mseintr, sc, &sc->sc_ih)) {
bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr);
mtx_destroy(&sc->sc_lock);
return ENXIO;
}
flags = device_get_flags(dev);
sc->mode.accelfactor = (flags & MSE_CONFIG_ACCEL) >> 4;
sc->sc_dev = make_dev(&mse_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
"mse%d", unit);
sc->sc_dev->si_drv1 = sc;
sc->sc_ndev = make_dev(&mse_cdevsw, 1, UID_ROOT, GID_WHEEL, 0600,
"nmse%d", unit);
sc->sc_ndev->si_drv1 = sc;
gone_in_dev(dev, 12, "mse(4) driver");
return 0;
}
int
mse_detach(device_t dev)
{
mse_softc_t *sc;
int rid;
sc = device_get_softc(dev);
MSE_LOCK(sc);
if (sc->sc_flags & MSESC_OPEN) {
MSE_UNLOCK(sc);
return EBUSY;
}
/* Sabotage subsequent opens. */
sc->sc_mousetype = MSE_NONE;
MSE_UNLOCK(sc);
destroy_dev(sc->sc_dev);
destroy_dev(sc->sc_ndev);
rid = 0;
bus_teardown_intr(dev, sc->sc_intr, sc->sc_ih);
bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr);
bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
callout_drain(&sc->sc_callout);
mtx_destroy(&sc->sc_lock);
return 0;
}
/*
* Exclusive open the mouse, initialize it and enable interrupts.
*/
static int
mseopen(struct cdev *dev, int flags, int fmt, struct thread *td)
{
mse_softc_t *sc = dev->si_drv1;
MSE_LOCK(sc);
if (sc->sc_mousetype == MSE_NONE) {
MSE_UNLOCK(sc);
return (ENXIO);
}
if (sc->sc_flags & MSESC_OPEN) {
MSE_UNLOCK(sc);
return (EBUSY);
}
sc->sc_flags |= MSESC_OPEN;
sc->sc_obuttons = sc->sc_buttons = MOUSE_MSC_BUTTONS;
sc->sc_deltax = sc->sc_deltay = 0;
sc->sc_bytesread = sc->mode.packetsize = MOUSE_MSC_PACKETSIZE;
sc->sc_watchdog = FALSE;
callout_reset(&sc->sc_callout, hz * 2, msetimeout, dev);
sc->mode.level = 0;
sc->status.flags = 0;
sc->status.button = sc->status.obutton = 0;
sc->status.dx = sc->status.dy = sc->status.dz = 0;
/*
* Initialize mouse interface and enable interrupts.
*/
(*sc->sc_enablemouse)(sc->sc_port);
MSE_UNLOCK(sc);
return (0);
}
/*
* mseclose: just turn off mouse innterrupts.
*/
static int
mseclose(struct cdev *dev, int flags, int fmt, struct thread *td)
{
mse_softc_t *sc = dev->si_drv1;
MSE_LOCK(sc);
callout_stop(&sc->sc_callout);
(*sc->sc_disablemouse)(sc->sc_port);
sc->sc_flags &= ~MSESC_OPEN;
MSE_UNLOCK(sc);
return(0);
}
/*
* mseread: return mouse info using the MSC serial protocol, but without
* using bytes 4 and 5.
* (Yes this is cheesy, but it makes the X386 server happy, so...)
*/
static int
mseread(struct cdev *dev, struct uio *uio, int ioflag)
{
mse_softc_t *sc = dev->si_drv1;
int xfer, error;
/*
* If there are no protocol bytes to be read, set up a new protocol
* packet.
*/
MSE_LOCK(sc);
while (sc->sc_flags & MSESC_READING) {
if (MSE_NBLOCKIO(dev)) {
MSE_UNLOCK(sc);
return (0);
}
sc->sc_flags |= MSESC_WANT;
error = mtx_sleep(sc, &sc->sc_lock, MSEPRI | PCATCH, "mseread",
0);
if (error) {
MSE_UNLOCK(sc);
return (error);
}
}
sc->sc_flags |= MSESC_READING;
xfer = 0;
if (sc->sc_bytesread >= sc->mode.packetsize) {
while (sc->sc_deltax == 0 && sc->sc_deltay == 0 &&
(sc->sc_obuttons ^ sc->sc_buttons) == 0) {
if (MSE_NBLOCKIO(dev))
goto out;
sc->sc_flags |= MSESC_WANT;
error = mtx_sleep(sc, &sc->sc_lock, MSEPRI | PCATCH,
"mseread", 0);
if (error)
goto out;
}
/*
* Generate protocol bytes.
* For some reason X386 expects 5 bytes but never uses
* the fourth or fifth?
*/
sc->sc_bytes[0] = sc->mode.syncmask[1]
| (sc->sc_buttons & ~sc->mode.syncmask[0]);
if (sc->sc_deltax > 127)
sc->sc_deltax = 127;
if (sc->sc_deltax < -127)
sc->sc_deltax = -127;
sc->sc_deltay = -sc->sc_deltay; /* Otherwise mousey goes wrong way */
if (sc->sc_deltay > 127)
sc->sc_deltay = 127;
if (sc->sc_deltay < -127)
sc->sc_deltay = -127;
sc->sc_bytes[1] = sc->sc_deltax;
sc->sc_bytes[2] = sc->sc_deltay;
sc->sc_bytes[3] = sc->sc_bytes[4] = 0;
sc->sc_bytes[5] = sc->sc_bytes[6] = 0;
sc->sc_bytes[7] = MOUSE_SYS_EXTBUTTONS;
sc->sc_obuttons = sc->sc_buttons;
sc->sc_deltax = sc->sc_deltay = 0;
sc->sc_bytesread = 0;
}
xfer = min(uio->uio_resid, sc->mode.packetsize - sc->sc_bytesread);
MSE_UNLOCK(sc);
error = uiomove(&sc->sc_bytes[sc->sc_bytesread], xfer, uio);
MSE_LOCK(sc);
out:
sc->sc_flags &= ~MSESC_READING;
if (error == 0)
sc->sc_bytesread += xfer;
if (sc->sc_flags & MSESC_WANT) {
sc->sc_flags &= ~MSESC_WANT;
MSE_UNLOCK(sc);
wakeup(sc);
} else
MSE_UNLOCK(sc);
return (error);
}
/*
* mseioctl: process ioctl commands.
*/
static int
mseioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
{
mse_softc_t *sc = dev->si_drv1;
mousestatus_t status;
int err = 0;
switch (cmd) {
case MOUSE_GETHWINFO:
MSE_LOCK(sc);
*(mousehw_t *)addr = sc->hw;
if (sc->mode.level == 0)
((mousehw_t *)addr)->model = MOUSE_MODEL_GENERIC;
MSE_UNLOCK(sc);
break;
case MOUSE_GETMODE:
MSE_LOCK(sc);
*(mousemode_t *)addr = sc->mode;
switch (sc->mode.level) {
case 0:
break;
case 1:
((mousemode_t *)addr)->protocol = MOUSE_PROTO_SYSMOUSE;
((mousemode_t *)addr)->syncmask[0] = MOUSE_SYS_SYNCMASK;
((mousemode_t *)addr)->syncmask[1] = MOUSE_SYS_SYNC;
break;
}
MSE_UNLOCK(sc);
break;
case MOUSE_SETMODE:
switch (((mousemode_t *)addr)->level) {
case 0:
case 1:
break;
default:
return (EINVAL);
}
MSE_LOCK(sc);
if (((mousemode_t *)addr)->accelfactor < -1) {
MSE_UNLOCK(sc);
return (EINVAL);
} else if (((mousemode_t *)addr)->accelfactor >= 0)
sc->mode.accelfactor =
((mousemode_t *)addr)->accelfactor;
sc->mode.level = ((mousemode_t *)addr)->level;
switch (sc->mode.level) {
case 0:
sc->sc_bytesread = sc->mode.packetsize
= MOUSE_MSC_PACKETSIZE;
break;
case 1:
sc->sc_bytesread = sc->mode.packetsize
= MOUSE_SYS_PACKETSIZE;
break;
}
MSE_UNLOCK(sc);
break;
case MOUSE_GETLEVEL:
MSE_LOCK(sc);
*(int *)addr = sc->mode.level;
MSE_UNLOCK(sc);
break;
case MOUSE_SETLEVEL:
switch (*(int *)addr) {
case 0:
MSE_LOCK(sc);
sc->mode.level = *(int *)addr;
sc->sc_bytesread = sc->mode.packetsize
= MOUSE_MSC_PACKETSIZE;
MSE_UNLOCK(sc);
break;
case 1:
MSE_LOCK(sc);
sc->mode.level = *(int *)addr;
sc->sc_bytesread = sc->mode.packetsize
= MOUSE_SYS_PACKETSIZE;
MSE_UNLOCK(sc);
break;
default:
return (EINVAL);
}
break;
case MOUSE_GETSTATUS:
MSE_LOCK(sc);
status = sc->status;
sc->status.flags = 0;
sc->status.obutton = sc->status.button;
sc->status.button = 0;
sc->status.dx = 0;
sc->status.dy = 0;
sc->status.dz = 0;
MSE_UNLOCK(sc);
*(mousestatus_t *)addr = status;
break;
case MOUSE_READSTATE:
case MOUSE_READDATA:
return (ENODEV);
default:
return (ENOTTY);
}
return (err);
}
/*
* msepoll: check for mouse input to be processed.
*/
static int
msepoll(struct cdev *dev, int events, struct thread *td)
{
mse_softc_t *sc = dev->si_drv1;
int revents = 0;
MSE_LOCK(sc);
if (events & (POLLIN | POLLRDNORM)) {
if (sc->sc_bytesread != sc->mode.packetsize ||
sc->sc_deltax != 0 || sc->sc_deltay != 0 ||
(sc->sc_obuttons ^ sc->sc_buttons) != 0)
revents |= events & (POLLIN | POLLRDNORM);
else
selrecord(td, &sc->sc_selp);
}
MSE_UNLOCK(sc);
return (revents);
}
/*
* msetimeout: watchdog timer routine.
*/
static void
msetimeout(void *arg)
{
struct cdev *dev;
mse_softc_t *sc;
dev = (struct cdev *)arg;
sc = dev->si_drv1;
MSE_ASSERT_LOCKED(sc);
if (sc->sc_watchdog) {
if (bootverbose)
printf("%s: lost interrupt?\n", devtoname(dev));
mseintr_locked(sc);
}
sc->sc_watchdog = TRUE;
callout_schedule(&sc->sc_callout, hz);
}
/*
* mseintr: update mouse status. sc_deltax and sc_deltay are accumulative.
*/
static void
mseintr(void *arg)
{
mse_softc_t *sc = arg;
MSE_LOCK(sc);
mseintr_locked(sc);
MSE_UNLOCK(sc);
}
static void
mseintr_locked(mse_softc_t *sc)
{
/*
* the table to turn MouseSystem button bits (MOUSE_MSC_BUTTON?UP)
* into `mousestatus' button bits (MOUSE_BUTTON?DOWN).
*/
static int butmap[8] = {
0,
MOUSE_BUTTON3DOWN,
MOUSE_BUTTON2DOWN,
MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN,
MOUSE_BUTTON1DOWN,
MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN,
MOUSE_BUTTON1DOWN | MOUSE_BUTTON2DOWN,
MOUSE_BUTTON1DOWN | MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN
};
int dx, dy, but;
int sign;
#ifdef DEBUG
static int mse_intrcnt = 0;
if((mse_intrcnt++ % 10000) == 0)
printf("mseintr\n");
#endif /* DEBUG */
if ((sc->sc_flags & MSESC_OPEN) == 0)
return;
(*sc->sc_getmouse)(sc->sc_port, &dx, &dy, &but);
if (sc->mode.accelfactor > 0) {
sign = (dx < 0);
dx = dx * dx / sc->mode.accelfactor;
if (dx == 0)
dx = 1;
if (sign)
dx = -dx;
sign = (dy < 0);
dy = dy * dy / sc->mode.accelfactor;
if (dy == 0)
dy = 1;
if (sign)
dy = -dy;
}
sc->sc_deltax += dx;
sc->sc_deltay += dy;
sc->sc_buttons = but;
but = butmap[~but & MOUSE_MSC_BUTTONS];
sc->status.dx += dx;
sc->status.dy += dy;
sc->status.flags |= ((dx || dy) ? MOUSE_POSCHANGED : 0)
| (sc->status.button ^ but);
sc->status.button = but;
sc->sc_watchdog = FALSE;
/*
* If mouse state has changed, wake up anyone wanting to know.
*/
if (sc->sc_deltax != 0 || sc->sc_deltay != 0 ||
(sc->sc_obuttons ^ sc->sc_buttons) != 0) {
if (sc->sc_flags & MSESC_WANT) {
sc->sc_flags &= ~MSESC_WANT;
wakeup(sc);
}
selwakeuppri(&sc->sc_selp, MSEPRI);
}
}

View File

@ -1,393 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2004 M. Warner Losh
* 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.
*
* 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$
*/
/*-
* Copyright 1992 by the University of Guelph
*
* Permission to use, copy and modify this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation.
* University of Guelph makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
* the X386 port, courtesy of
* Rick Macklem, rick@snowhite.cis.uoguelph.ca
* Caveats: The driver currently uses spltty(), but doesn't use any
* generic tty code. It could use splmse() (that only masks off the
* bus mouse interrupt, but that would require hacking in i386/isa/icu.s.
* (This may be worth the effort, since the Logitech generates 30/60
* interrupts/sec continuously while it is open.)
* NB: The ATI has NOT been tested yet!
*/
/*
* Modification history:
* Sep 6, 1994 -- Lars Fredriksen(fredriks@mcs.com)
* improved probe based on input from Logitech.
*
* Oct 19, 1992 -- E. Stark (stark@cs.sunysb.edu)
* fixes to make it work with Microsoft InPort busmouse
*
* Jan, 1993 -- E. Stark (stark@cs.sunysb.edu)
* added patches for new "select" interface
*
* May 4, 1993 -- E. Stark (stark@cs.sunysb.edu)
* changed position of some spl()'s in mseread
*
* October 8, 1993 -- E. Stark (stark@cs.sunysb.edu)
* limit maximum negative x/y value to -127 to work around XFree problem
* that causes spurious button pushes.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/poll.h>
#include <sys/selinfo.h>
#include <sys/uio.h>
#include <sys/mouse.h>
#include <machine/bus.h>
#include <machine/resource.h>
#include <sys/rman.h>
#include <isa/isavar.h>
#include <dev/mse/msevar.h>
static int mse_isa_probe(device_t dev);
static int mse_isa_attach(device_t dev);
static device_method_t mse_methods[] = {
DEVMETHOD(device_probe, mse_isa_probe),
DEVMETHOD(device_attach, mse_isa_attach),
DEVMETHOD(device_detach, mse_detach),
{ 0, 0 }
};
static driver_t mse_driver = {
"mse",
mse_methods,
sizeof(mse_softc_t),
};
static struct isa_pnp_id mse_ids[] = {
{ 0x000fd041, "Bus mouse" }, /* PNP0F00 */
{ 0x020fd041, "InPort mouse" }, /* PNP0F02 */
{ 0x0d0fd041, "InPort mouse compatible" }, /* PNP0F0D */
{ 0x110fd041, "Bus mouse compatible" }, /* PNP0F11 */
{ 0x150fd041, "Logitech bus mouse" }, /* PNP0F15 */
{ 0x180fd041, "Logitech bus mouse compatible" },/* PNP0F18 */
{ 0 }
};
/*
* Logitech bus mouse definitions
*/
#define MSE_SETUP 0x91 /* What does this mean? */
/* The definition for the control port */
/* is as follows: */
/* D7 = Mode set flag (1 = active) */
/* D6,D5 = Mode selection (port A) */
/* 00 = Mode 0 = Basic I/O */
/* 01 = Mode 1 = Strobed I/O */
/* 10 = Mode 2 = Bi-dir bus */
/* D4 = Port A direction (1 = input)*/
/* D3 = Port C (upper 4 bits) */
/* direction. (1 = input) */
/* D2 = Mode selection (port B & C) */
/* 0 = Mode 0 = Basic I/O */
/* 1 = Mode 1 = Strobed I/O */
/* D1 = Port B direction (1 = input)*/
/* D0 = Port C (lower 4 bits) */
/* direction. (1 = input) */
/* So 91 means Basic I/O on all 3 ports,*/
/* Port A is an input port, B is an */
/* output port, C is split with upper */
/* 4 bits being an output port and lower*/
/* 4 bits an input port, and enable the */
/* sucker. */
/* Courtesy Intel 8255 databook. Lars */
#define MSE_HOLD 0x80
#define MSE_RXLOW 0x00
#define MSE_RXHIGH 0x20
#define MSE_RYLOW 0x40
#define MSE_RYHIGH 0x60
#define MSE_DISINTR 0x10
#define MSE_INTREN 0x00
static int mse_probelogi(device_t dev, mse_softc_t *sc);
static void mse_disablelogi(struct resource *port);
static void mse_getlogi(struct resource *port, int *dx, int *dy,
int *but);
static void mse_enablelogi(struct resource *port);
/*
* ATI Inport mouse definitions
*/
#define MSE_INPORT_RESET 0x80
#define MSE_INPORT_STATUS 0x00
#define MSE_INPORT_DX 0x01
#define MSE_INPORT_DY 0x02
#define MSE_INPORT_MODE 0x07
#define MSE_INPORT_HOLD 0x20
#define MSE_INPORT_INTREN 0x09
static int mse_probeati(device_t dev, mse_softc_t *sc);
static void mse_enableati(struct resource *port);
static void mse_disableati(struct resource *port);
static void mse_getati(struct resource *port, int *dx, int *dy,
int *but);
static struct mse_types mse_types[] = {
{ MSE_ATIINPORT,
mse_probeati, mse_enableati, mse_disableati, mse_getati,
{ 2, MOUSE_IF_INPORT, MOUSE_MOUSE, MOUSE_MODEL_GENERIC, 0, },
{ MOUSE_PROTO_INPORT, -1, -1, 0, 0, MOUSE_MSC_PACKETSIZE,
{ MOUSE_MSC_SYNCMASK, MOUSE_MSC_SYNC, }, }, },
{ MSE_LOGITECH,
mse_probelogi, mse_enablelogi, mse_disablelogi, mse_getlogi,
{ 2, MOUSE_IF_BUS, MOUSE_MOUSE, MOUSE_MODEL_GENERIC, 0, },
{ MOUSE_PROTO_BUS, -1, -1, 0, 0, MOUSE_MSC_PACKETSIZE,
{ MOUSE_MSC_SYNCMASK, MOUSE_MSC_SYNC, }, }, },
{ 0, },
};
static int
mse_isa_probe(device_t dev)
{
mse_softc_t *sc;
int error;
int rid;
int i;
/* check PnP IDs */
error = ISA_PNP_PROBE(device_get_parent(dev), dev, mse_ids);
if (error == ENXIO)
return error;
sc = device_get_softc(dev);
rid = 0;
sc->sc_port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
MSE_IOSIZE, RF_ACTIVE);
if (sc->sc_port == NULL)
return ENXIO;
/*
* Check for each mouse type in the table.
*/
i = 0;
while (mse_types[i].m_type) {
if ((*mse_types[i].m_probe)(dev, sc)) {
sc->sc_mousetype = mse_types[i].m_type;
sc->sc_enablemouse = mse_types[i].m_enable;
sc->sc_disablemouse = mse_types[i].m_disable;
sc->sc_getmouse = mse_types[i].m_get;
sc->hw = mse_types[i].m_hw;
sc->mode = mse_types[i].m_mode;
bus_release_resource(dev, SYS_RES_IOPORT, rid,
sc->sc_port);
device_set_desc(dev, "Bus/InPort Mouse");
return 0;
}
i++;
}
bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
return ENXIO;
}
static int
mse_isa_attach(device_t dev)
{
mse_softc_t *sc;
int rid;
sc = device_get_softc(dev);
rid = 0;
sc->sc_port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
MSE_IOSIZE, RF_ACTIVE);
if (sc->sc_port == NULL)
return ENXIO;
return (mse_common_attach(dev));
}
/*
* Routines for the Logitech mouse.
*/
/*
* Test for a Logitech bus mouse and return 1 if it is.
* (until I know how to use the signature port properly, just disable
* interrupts and return 1)
*/
static int
mse_probelogi(device_t dev, mse_softc_t *sc)
{
int sig;
bus_write_1(sc->sc_port, MSE_PORTD, MSE_SETUP);
/* set the signature port */
bus_write_1(sc->sc_port, MSE_PORTB, MSE_LOGI_SIG);
DELAY(30000); /* 30 ms delay */
sig = bus_read_1(sc->sc_port, MSE_PORTB) & 0xFF;
if (sig == MSE_LOGI_SIG) {
bus_write_1(sc->sc_port, MSE_PORTC, MSE_DISINTR);
return(1);
} else {
if (bootverbose)
device_printf(dev, "wrong signature %x\n", sig);
return(0);
}
}
/*
* Initialize Logitech mouse and enable interrupts.
*/
static void
mse_enablelogi(struct resource *port)
{
int dx, dy, but;
bus_write_1(port, MSE_PORTD, MSE_SETUP);
mse_getlogi(port, &dx, &dy, &but);
}
/*
* Disable interrupts for Logitech mouse.
*/
static void
mse_disablelogi(struct resource *port)
{
bus_write_1(port, MSE_PORTC, MSE_DISINTR);
}
/*
* Get the current dx, dy and button up/down state.
*/
static void
mse_getlogi(struct resource *port, int *dx, int *dy, int *but)
{
char x, y;
bus_write_1(port, MSE_PORTC, MSE_HOLD | MSE_RXLOW);
x = bus_read_1(port, MSE_PORTA);
*but = (x >> 5) & MOUSE_MSC_BUTTONS;
x &= 0xf;
bus_write_1(port, MSE_PORTC, MSE_HOLD | MSE_RXHIGH);
x |= (bus_read_1(port, MSE_PORTA) << 4);
bus_write_1(port, MSE_PORTC, MSE_HOLD | MSE_RYLOW);
y = (bus_read_1(port, MSE_PORTA) & 0xf);
bus_write_1(port, MSE_PORTC, MSE_HOLD | MSE_RYHIGH);
y |= (bus_read_1(port, MSE_PORTA) << 4);
*dx = x;
*dy = y;
bus_write_1(port, MSE_PORTC, MSE_INTREN);
}
/*
* Routines for the ATI Inport bus mouse.
*/
/*
* Test for an ATI Inport bus mouse and return 1 if it is.
* (do not enable interrupts)
*/
static int
mse_probeati(device_t dev, mse_softc_t *sc)
{
int i;
for (i = 0; i < 2; i++)
if (bus_read_1(sc->sc_port, MSE_PORTC) == 0xde)
return (1);
return (0);
}
/*
* Initialize ATI Inport mouse and enable interrupts.
*/
static void
mse_enableati(struct resource *port)
{
bus_write_1(port, MSE_PORTA, MSE_INPORT_RESET);
bus_write_1(port, MSE_PORTA, MSE_INPORT_MODE);
bus_write_1(port, MSE_PORTB, MSE_INPORT_INTREN);
}
/*
* Disable interrupts for ATI Inport mouse.
*/
static void
mse_disableati(struct resource *port)
{
bus_write_1(port, MSE_PORTA, MSE_INPORT_MODE);
bus_write_1(port, MSE_PORTB, 0);
}
/*
* Get current dx, dy and up/down button state.
*/
static void
mse_getati(struct resource *port, int *dx, int *dy, int *but)
{
char byte;
bus_write_1(port, MSE_PORTA, MSE_INPORT_MODE);
bus_write_1(port, MSE_PORTB, MSE_INPORT_HOLD);
bus_write_1(port, MSE_PORTA, MSE_INPORT_STATUS);
*but = ~bus_read_1(port, MSE_PORTB) & MOUSE_MSC_BUTTONS;
bus_write_1(port, MSE_PORTA, MSE_INPORT_DX);
byte = bus_read_1(port, MSE_PORTB);
*dx = byte;
bus_write_1(port, MSE_PORTA, MSE_INPORT_DY);
byte = bus_read_1(port, MSE_PORTB);
*dy = byte;
bus_write_1(port, MSE_PORTA, MSE_INPORT_MODE);
bus_write_1(port, MSE_PORTB, MSE_INPORT_INTREN);
}
DRIVER_MODULE(mse, isa, mse_driver, mse_devclass, 0, 0);
ISA_PNP_INFO(mse_ids);

View File

@ -1,126 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2004 M. Warner Losh
* 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.
*
* 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$
*/
/*-
* Copyright 1992 by the University of Guelph
*
* Permission to use, copy and modify this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation.
* University of Guelph makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* driver configuration flags (config) */
#define MSE_CONFIG_ACCEL 0x00f0 /* acceleration factor */
#define MSE_CONFIG_FLAGS (MSE_CONFIG_ACCEL)
/*
* Software control structure for mouse. The sc_enablemouse(),
* sc_disablemouse() and sc_getmouse() routines must be called locked.
*/
typedef struct mse_softc {
int sc_flags;
int sc_mousetype;
struct selinfo sc_selp;
struct resource *sc_port;
struct resource *sc_intr;
void *sc_ih;
void (*sc_enablemouse)(struct resource *port);
void (*sc_disablemouse)(struct resource *port);
void (*sc_getmouse)(struct resource *port, int *dx, int *dy,
int *but);
int sc_deltax;
int sc_deltay;
int sc_obuttons;
int sc_buttons;
int sc_bytesread;
u_char sc_bytes[MOUSE_SYS_PACKETSIZE];
struct callout sc_callout;
struct mtx sc_lock;
int sc_watchdog;
struct cdev *sc_dev;
struct cdev *sc_ndev;
mousehw_t hw;
mousemode_t mode;
mousestatus_t status;
} mse_softc_t;
#define MSE_LOCK(sc) mtx_lock(&(sc)->sc_lock)
#define MSE_UNLOCK(sc) mtx_unlock(&(sc)->sc_lock)
#define MSE_ASSERT_LOCKED(sc) mtx_assert(&(sc)->sc_lock, MA_OWNED)
/* Flags */
#define MSESC_OPEN 0x1
#define MSESC_WANT 0x2
#define MSESC_READING 0x4
/* and Mouse Types */
#define MSE_NONE 0 /* don't move this! */
/* isa bus mouse types */
#define MSE_LOGITECH 0x1
#define MSE_ATIINPORT 0x2
#define MSE_LOGI_SIG 0xA5
/* XXX msereg.h? */
#define MSE_PORTA 0
#define MSE_PORTB 1
#define MSE_PORTC 2
#define MSE_PORTD 3
#define MSE_IOSIZE 4
/*
* Table of mouse types.
* Keep the Logitech last, since I haven't figured out how to probe it
* properly yet. (Someday I'll have the documentation.)
*/
struct mse_types {
int m_type; /* Type of bus mouse */
int (*m_probe)(device_t dev, mse_softc_t *sc);
/* Probe routine to test for it */
void (*m_enable)(struct resource *port);
/* Start routine */
void (*m_disable)(struct resource *port);
/* Disable interrupts routine */
void (*m_get)(struct resource *port, int *dx, int *dy, int *but);
/* and get mouse status */
mousehw_t m_hw; /* buttons iftype type model hwid */
mousemode_t m_mode; /* proto rate res accel level size mask */
};
extern devclass_t mse_devclass;
int mse_common_attach(device_t);
int mse_detach(device_t);

View File

@ -500,14 +500,6 @@ device tdfxdrm # 3dfx Voodoo 3/4/5 and Banshee
device viadrm # VIA
options DRM_DEBUG # Include debug printfs (slow)
#
# mse: Logitech and ATI InPort bus mouse ports
device mse
hint.mse.0.at="isa"
hint.mse.0.port="0x23c"
hint.mse.0.irq="5"
#
# Network interfaces:
#

View File

@ -260,7 +260,6 @@ SUBDIR= \
mrsas \
msdosfs \
msdosfs_iconv \
${_mse} \
msk \
${_mthca} \
mvs \
@ -761,7 +760,6 @@ _cp= cp
_glxiic= glxiic
_glxsb= glxsb
#_ibcs2= ibcs2
_mse= mse
_ncr= ncr
_ncv= ncv
_nsp= nsp

View File

@ -1,8 +0,0 @@
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/mse
KMOD= mse
SRCS= mse.c mse_isa.c device_if.h bus_if.h isa_if.h
.include <bsd.kmod.mk>

View File

@ -141,8 +141,8 @@ typedef struct synapticshw {
/* iftype */
#define MOUSE_IF_UNKNOWN (-1)
#define MOUSE_IF_SERIAL 0
#define MOUSE_IF_BUS 1
#define MOUSE_IF_INPORT 2
/* 1 was bus */
/* 2 was inport */
#define MOUSE_IF_PS2 3
#define MOUSE_IF_SYSMOUSE 4
#define MOUSE_IF_USB 5
@ -200,8 +200,8 @@ typedef struct mousemode {
#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 */
/* 5 was bus mouse */
/* 6 was inport mosue */
#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 */

View File

@ -1,21 +0,0 @@
# Doxyfile 1.5.2
# $FreeBSD$
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "FreeBSD kernel MSE device code"
OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_mse/
EXTRACT_ALL = YES # for undocumented src, no warnings enabled
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = $(DOXYGEN_SRC_PATH)/dev/mse/ \
$(NOTREVIEWED)
GENERATE_TAGFILE = dev_mse/dev_mse.tag
@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH)
@INCLUDE = common-Doxyfile

View File

@ -27,8 +27,6 @@
hline_press_enter_or_space="Press enter or space"
msg_auto="Auto"
msg_auto_desc="Bus mouse, PS/2 style mouse or PnP serial mouse"
msg_busmouse="BusMouse"
msg_busmouse_desc="Logitech, ATI or MS bus mouse (/dev/mse0)"
msg_cancel="Cancel"
msg_com1="COM1"
msg_com1_desc="Serial mouse on COM1 (/dev/cuau0)"

View File

@ -56,7 +56,6 @@ dialog_menu_main()
'3 $msg_com2' '$msg_com2_desc'
'4 $msg_com3' '$msg_com3_desc'
'5 $msg_com4' '$msg_com4_desc'
'6 $msg_busmouse' '$msg_busmouse_desc'
" # END-QUOTE
local defaultitem= # Calculated below
local hline=
@ -75,7 +74,6 @@ dialog_menu_main()
/dev/cuau1) defaultitem="3 $msg_com2" ;;
/dev/cuau2) defaultitem="4 $msg_com3" ;;
/dev/cuau3) defaultitem="5 $msg_com4" ;;
/dev/mse0) defaultitem="6 $msg_busmouse" ;;
esac
local menu_choice
@ -136,8 +134,6 @@ case "$mtag" in
moused_port_to_set="/dev/cuau2" ;;
"5 $msg_com4") # Serial mouse on COM4 (/dev/cuau3)
moused_port_to_set="/dev/cuau3" ;;
"6 $msg_busmouse") # Logitech, ATI or MS bus mouse (/dev/mse0)
moused_port_to_set="/dev/mse0" ;;
esac
if [ "$moused_port_to_set" ]; then

View File

@ -297,7 +297,6 @@ information are:
.It Ar port
Port (device file) name, i.e.\&
.Pa /dev/cuau0 ,
.Pa /dev/mse0
and
.Pa /dev/psm0 .
.It Ar if
@ -555,10 +554,7 @@ what matters.
The USB mouse has a flat rectangular connector.
.Pp
The next thing to decide is a port to use for the given interface.
For the bus, InPort and PS/2 mice, there is little choice:
the bus and InPort mice always use
.Pa /dev/mse0 ,
and the PS/2 mouse is always at
The PS/2 mouse is always at
.Pa /dev/psm0 .
There may be more than one serial port to which the serial
mouse can be attached.
@ -713,8 +709,6 @@ the mice is combined all together.
.Bl -tag -width /dev/consolectl -compact
.It Pa /dev/consolectl
device to control the console
.It Pa /dev/mse%d
bus and InPort mouse driver
.It Pa /dev/psm%d
PS/2 mouse driver
.It Pa /dev/sysmouse
@ -792,7 +786,6 @@ you keep brushing over the mouse pad while typing.
.Xr vidcontrol 1 ,
.Xr xset 1 ,
.Xr keyboard 4 ,
.Xr mse 4 ,
.Xr psm 4 ,
.Xr screen 4 ,
.Xr sysmouse 4 ,

View File

@ -198,8 +198,6 @@ static int hscroll_movement;
/* interface (the table must be ordered by MOUSE_IF_XXX in mouse.h) */
static symtab_t rifs[] = {
{ "serial", MOUSE_IF_SERIAL, 0 },
{ "bus", MOUSE_IF_BUS, 0 },
{ "inport", MOUSE_IF_INPORT, 0 },
{ "ps/2", MOUSE_IF_PS2, 0 },
{ "sysmouse", MOUSE_IF_SYSMOUSE, 0 },
{ "usb", MOUSE_IF_USB, 0 },
@ -213,8 +211,8 @@ static const char *rnames[] = {
"logitech",
"mmseries",
"mouseman",
"busmouse",
"inportmouse",
"wasbusmouse",
"wasinportmouse",
"ps/2",
"mmhitab",
"glidepoint",
@ -290,12 +288,8 @@ static symtab_t pnpprod[] = {
/* Mitsumi Wireless Scroll Mouse */
{ "MTM6401", MOUSE_PROTO_INTELLI, MOUSE_MODEL_INTELLI },
/* MS bus */
{ "PNP0F00", MOUSE_PROTO_BUS, MOUSE_MODEL_GENERIC },
/* MS serial */
{ "PNP0F01", MOUSE_PROTO_MS, MOUSE_MODEL_GENERIC },
/* MS InPort */
{ "PNP0F02", MOUSE_PROTO_INPORT, MOUSE_MODEL_GENERIC },
/* MS PS/2 */
{ "PNP0F03", MOUSE_PROTO_PS2, MOUSE_MODEL_GENERIC },
/*
@ -322,8 +316,6 @@ static symtab_t pnpprod[] = {
{ "PNP0F0B", MOUSE_PROTO_MS, MOUSE_MODEL_GENERIC },
/* MS serial comatible */
{ "PNP0F0C", MOUSE_PROTO_MS, MOUSE_MODEL_GENERIC },
/* MS InPort comatible */
{ "PNP0F0D", MOUSE_PROTO_INPORT, MOUSE_MODEL_GENERIC },
/* MS PS/2 comatible */
{ "PNP0F0E", MOUSE_PROTO_PS2, MOUSE_MODEL_GENERIC },
/* MS BallPoint comatible */
@ -332,8 +324,6 @@ static symtab_t pnpprod[] = {
/* TI QuickPort */
{ "PNP0F10", MOUSE_PROTO_XXX, MOUSE_MODEL_GENERIC },
#endif
/* MS bus comatible */
{ "PNP0F11", MOUSE_PROTO_BUS, MOUSE_MODEL_GENERIC },
/* Logitech PS/2 */
{ "PNP0F12", MOUSE_PROTO_PS2, MOUSE_MODEL_GENERIC },
/* PS/2 */
@ -342,16 +332,12 @@ static symtab_t pnpprod[] = {
/* MS Kids Mouse */
{ "PNP0F14", MOUSE_PROTO_XXX, MOUSE_MODEL_GENERIC },
#endif
/* Logitech bus */
{ "PNP0F15", MOUSE_PROTO_BUS, MOUSE_MODEL_GENERIC },
#if notyet
/* Logitech SWIFT */
{ "PNP0F16", MOUSE_PROTO_XXX, MOUSE_MODEL_GENERIC },
#endif
/* Logitech serial compat */
{ "PNP0F17", MOUSE_PROTO_LOGIMOUSEMAN, MOUSE_MODEL_GENERIC },
/* Logitech bus compatible */
{ "PNP0F18", MOUSE_PROTO_BUS, MOUSE_MODEL_GENERIC },
/* Logitech PS/2 compatible */
{ "PNP0F19", MOUSE_PROTO_PS2, MOUSE_MODEL_GENERIC },
#if notyet
@ -860,15 +846,6 @@ main(int argc, char *argv[])
/* the default port name */
switch(rodent.rtype) {
case MOUSE_PROTO_INPORT:
/* INPORT and BUS are the same... */
rodent.rtype = MOUSE_PROTO_BUS;
/* FALLTHROUGH */
case MOUSE_PROTO_BUS:
if (!rodent.portname)
rodent.portname = "/dev/mse0";
break;
case MOUSE_PROTO_PS2:
if (!rodent.portname)
rodent.portname = "/dev/psm0";
@ -1519,9 +1496,6 @@ r_identify(void)
logwarnx("unknown mouse protocol (%d)", rodent.mode.protocol);
return (MOUSE_PROTO_UNKNOWN);
} else {
/* INPORT and BUS are the same... */
if (rodent.mode.protocol == MOUSE_PROTO_INPORT)
rodent.mode.protocol = MOUSE_PROTO_BUS;
if (rodent.mode.protocol != rodent.rtype) {
/* Hmm, the driver doesn't agree with the user... */
if (rodent.rtype != MOUSE_PROTO_UNKNOWN)
@ -1559,8 +1533,6 @@ r_identify(void)
} else {
rodent.mode.protocol = MOUSE_PROTO_UNKNOWN;
}
if (rodent.mode.protocol == MOUSE_PROTO_INPORT)
rodent.mode.protocol = MOUSE_PROTO_BUS;
/* make final adjustment */
if (rodent.mode.protocol != MOUSE_PROTO_UNKNOWN) {
@ -1771,8 +1743,6 @@ r_init(void)
setmousespeed(1200, rodent.baudrate, rodentcflags[rodent.rtype]);
/* FALLTHROUGH */
case MOUSE_PROTO_BUS:
case MOUSE_PROTO_INPORT:
case MOUSE_PROTO_PS2:
if (rodent.rate >= 0)
rodent.mode.rate = rodent.rate;
@ -2162,13 +2132,6 @@ r_protocol(u_char rBuf, mousestatus_t *act)
prev_y = y;
break;
case MOUSE_PROTO_BUS: /* Bus */
case MOUSE_PROTO_INPORT: /* InPort */
act->button = butmapmsc[(~pBuf[0]) & MOUSE_MSC_BUTTONS];
act->dx = (signed char)pBuf[1];
act->dy = - (signed char)pBuf[2];
break;
case MOUSE_PROTO_PS2: /* PS/2 */
act->button = butmapps2[pBuf[0] & MOUSE_PS2_BUTTONS];
act->dx = (pBuf[0] & MOUSE_PS2_XNEG) ? pBuf[1] - 256 : pBuf[1];