NetBSD/share/man/man9/wsmouse.9

198 lines
6.2 KiB
Groff

.\" $NetBSD: wsmouse.9,v 1.3 2002/02/13 08:18:58 ross Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Gregory McGarry.
.\"
.\" 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 the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
.\"
.Dd October 7, 2001
.Dt WSMOUSE 9
.Os
.Sh NAME
.Nm wsmouse ,
.Nm wsmouse_input ,
.Nm wsmousedevprint
.Nd wscons mouse support
.Sh SYNOPSIS
.Fd #include \*[Lt]dev/wscons/wsconsio.h\*[Gt]
.Fd #include \*[Lt]dev/wscons/wsmousevar.h\*[Gt]
.Ft void
.Fn wsmouse_input "struct device *msdev" "u_int btns" \
"int x" "int y" "int z" "u_int flags"
.Ft int
.Fn wsmousedevprint "void *aux" "const char *pnp"
.Sh DESCRIPTION
The
.Nm
module is a component of the
.Xr wscons 9
framework to provide machine-indpendent mouse support. Most of the
support is provided by the
.Xr wsmouse 4
device driver, which must be a child of the hardware device driver.
.Sh DATA TYPES
Mouse drivers providing support for wscons pointer devices will make use
of the following data types:
.Bl -tag -width compact
.It Fa struct wsmouse_accessops
A structure used to specify the mouse access functions. All pointer
devices must provide this structure and pass it to the
.Xr wsmouse 4
child device. It has the following members:
.Bd -literal
int (*enable)(void *);
int (*ioctl)(void *v, u_long cmd, caddr_t data,
int flag, struct proc *p);
void (*disable)(void *);
.Ed
.Pp
The
.Fa enable
member defines the function to be called to enable monitoring pointer
movements and passing these events to
wscons. The
.Fa disable
member defines the function to disable movement events.
The
.Fa ioctl
member defines the function to be called to perform mouse-specific
ioctl calls.
.Pp
There is a
.Fa void *
cookie provided by the mouse driver associated with these functions,
which is passed to them when they are invoked.
.It Fa struct wsmouse_attach_args
A structure used to attach the
.Xr wsmouse 4
child device. It has the following members:
.Bd -literal
const struct wsmouse_accessops *accessops;
void *accesscookie;
.Ed
.El
.Sh FUNCTIONS
.Bl -tag -width compact
.It Fn wsmouse_input "msdev" "btns" "x" "y" "z" "flags"
Callback from the mouse driver to the wsmouse interface driver.
The argument
.Fa btns
specifies the current button configuration. The pointer coordinate is
specified by the
.Fa x ,
.Fa y ,
.Fa z
tuple. The
.Fa flags
argument specify whether the pointer device and the measurement is in
relative or absolute mode. Valid values for
.Fa flags
are:
.Bl -tag -width compact
.It WSMOUSE_INPUT_DELTA
Relative mode.
.It WSMOUSE_INPUT_ABSOLUTE_X
Obsolute mode in x-direction.
.It WSMOUSE_INPUT_ABSOLUTE_Y
Obsolute mode in y-direction.
.It WSMOUSE_INPUT_ABSOLUTE_Z
Obsolute mode in z-direction.
.El
.It Fn wsmousedevprint "aux" "pnp"
The default wsmouse printing routine used by
.Fn config_found .
(see
.Xr autoconf 9 ) .
.El
.Sh AUTOCONFIGURATION
Mouse drivers which want to utilise the wsmouse module must be a
parent to the
.Xr wsmouse 4
device and provide an attachment interface. To attach the
.Xr wsmouse 4
device, the mouse driver must allocate and populate a
.Fa wsmouse_attach_args
structure with the supported operations and callbacks and call
.Fn config_found
to perform the attach (see
.Xr autoconf 9 ) .
.Sh OPERATION
When a mouse-movement event is received, the device driver must
perform any necessary movement decoding to wscons events and pass the
events to wscons via
.Fn wsmouse_input .
.Pp
The wscons framework calls back into the hardware driver by invoking
the functions that are specified in the
.Em accessops
structure. The
.Fn enable
and
.Fn disable
functions are relatively simple and self-explanatory. The
.Fn ioctl
function is called by the wscons interface to perform
mouse-specific ioctl operations (see
.Xr ioctl 2 ) .
The argument
.Fa cmd
to the
.Fn ioctl
function specifies the specific command to perform using the data
.Fa data .
Valid commands are listed in
.Pa sys/dev/wscons/wsconsio.h .
.Sh CODE REFERENCES
This section describes places within the
.Nx
source tree where actual code implementing or utilising the
machine-independent wscons subsystem can be found. All pathnames are
relative to
.Pa /usr/src .
.Pp
The wscons subsystem is implemented within the directory
.Pa sys/dev/wscons .
The
.Nm
module itself is implement within the file
.Pa sys/dev/wscons/wsmouse.c .
.Xr ioctl 2
operations are listed in
.Pa sys/dev/wscons/wsconsio.h .
.Sh SEE ALSO
.Xr ioctl 2 ,
.Xr autoconf 9 ,
.Xr driver 9 ,
.Xr intro 9 ,
.Xr wsdisplay 9 ,
.Xr wskbd 9