NetBSD/share/man/man9/wsmouse.9

248 lines
7.2 KiB
Groff
Raw Normal View History

2005-12-20 22:53:14 +03:00
.\" $NetBSD: wsmouse.9,v 1.12 2005/12/20 19:53:15 rpaulo Exp $
2001-10-22 07:29:58 +04:00
.\"
.\" 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
2001-10-22 07:29:58 +04:00
.\" 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.
.\"
2005-12-20 22:53:14 +03:00
.Dd December 20, 2005
2001-10-22 07:29:58 +04:00
.Dt WSMOUSE 9
.Os
.Sh NAME
.Nm wsmouse ,
.Nm wsmouse_input ,
.Nm wsmousedevprint
.Nd wscons mouse support
.Sh SYNOPSIS
.In dev/wscons/wsconsio.h
.In dev/wscons/wsmousevar.h
2001-10-22 07:29:58 +04:00
.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-independent mouse support.
2002-10-14 17:43:14 +04:00
Most of the support is provided by the
2001-10-22 07:29:58 +04:00
.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
2002-10-14 17:43:14 +04:00
A structure used to specify the mouse access functions.
All pointer devices must provide this structure and pass it to the
2001-10-22 07:29:58 +04:00
.Xr wsmouse 4
2002-10-14 17:43:14 +04:00
child device.
It has the following members:
2001-10-22 07:29:58 +04:00
.Bd -literal
int (*enable)(void *);
int (*ioctl)(void *v, u_long cmd, caddr_t data,
2005-12-20 22:53:14 +03:00
int flag, struct lwp *l);
2001-10-22 07:29:58 +04:00
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
2002-10-14 17:43:14 +04:00
wscons.
The
2001-10-22 07:29:58 +04:00
.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.
2004-06-05 19:24:04 +04:00
.It Fa struct wsmousedev_attach_args
2001-10-22 07:29:58 +04:00
A structure used to attach the
.Xr wsmouse 4
2002-10-14 17:43:14 +04:00
child device.
It has the following members:
2001-10-22 07:29:58 +04:00
.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.
Arguments are as follows:
.Bl -tag -width msdev -compact
.It Fa msdev
This is the
.Fa struct device
pointer passed from
.Fn config_found
on attaching the child
.Xr wsmouse 4
to specify the mouse device.
.It Fa btns
This specifies the current button status.
Bits for pressed buttons (which will cause the
.Dv WSCONS_EVENT_MOUSE_DOWN
event on
.Xr wsmouse 4
device) should be set, and bits for released buttons (which will cause the
.Dv WSCONS_EVENT_MOUSE_UP
event) should be zero.
The left most button state should be in LSB,
i.e. for typical three button mouse,
the left button is 0x01,
the middle button is 0x02,
and the right button is 0x04.
.It Fa x
Absolute or relative X-axis value to specify the pointer coordinate.
Rightward (moving the mouse right) is positive.
.It Fa y
Absolute or relative Y-axis value to specify the pointer coordinate.
Upward (moving the mouse forward) is positive.
Note that this aspect is opposite from the one used in the X server dix layer.
.It Fa z
Absolute or relative Z-axis value to specify the pointer coordinate.
Usually this axis is used for the wheel.
Downward (turning the wheel backward) is positive.
.It Fa flags
This argument specifies whether the pointer device and the measurement
of the
2001-10-22 07:29:58 +04:00
.Fa x ,
.Fa y ,
and
2001-10-22 07:29:58 +04:00
.Fa z
2005-10-25 06:25:32 +04:00
axes is in relative or absolute mode.
2002-10-14 17:43:14 +04:00
Valid values for
2001-10-22 07:29:58 +04:00
.Fa flags
are:
.Bl -tag -width compact
.It WSMOUSE_INPUT_DELTA
Relative mode.
.It WSMOUSE_INPUT_ABSOLUTE_X
Absolute mode in
.Fa x
axis.
2001-10-22 07:29:58 +04:00
.It WSMOUSE_INPUT_ABSOLUTE_Y
Absolute mode in
.Fa y
axis.
2001-10-22 07:29:58 +04:00
.It WSMOUSE_INPUT_ABSOLUTE_Z
Absolute mode in
.Fa z
axis.
.El
2001-10-22 07:29:58 +04:00
.El
.It Fn wsmousedevprint "aux" "pnp"
The default wsmouse printing routine used by
.Fn config_found .
(see
.Xr autoconf 9 ) .
2001-10-22 07:29:58 +04:00
.El
.Sh AUTOCONFIGURATION
Mouse drivers which want to use the wsmouse module must be a
2001-10-22 07:29:58 +04:00
parent to the
.Xr wsmouse 4
2002-10-14 17:43:14 +04:00
device and provide an attachment interface.
To attach the
2001-10-22 07:29:58 +04:00
.Xr wsmouse 4
device, the mouse driver must allocate and populate a
2004-06-05 19:24:04 +04:00
.Fa wsmousedev_attach_args
2001-10-22 07:29:58 +04:00
structure with the supported operations and callbacks and call
.Fn config_found
to perform the attach (see
.Xr autoconf 9 ) .
2001-10-22 07:29:58 +04:00
.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
2002-10-14 17:43:14 +04:00
structure.
The
2001-10-22 07:29:58 +04:00
.Fn enable
and
.Fn disable
2002-10-14 17:43:14 +04:00
functions are relatively simple and self-explanatory.
The
2001-10-22 07:29:58 +04:00
.Fn ioctl
function is called by the wscons interface to perform
mouse-specific ioctl operations (see
.Xr ioctl 2 ) .
2001-10-22 07:29:58 +04:00
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 using the
2002-10-14 17:43:14 +04:00
machine-independent wscons subsystem can be found.
All pathnames are relative to
.Pa /usr/src .
2001-10-22 07:29:58 +04:00
.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 pms 4 ,
.Xr wscons 4 ,
.Xr wsmouse 4 ,
2001-10-22 07:29:58 +04:00
.Xr autoconf 9 ,
.Xr driver 9 ,
.Xr intro 9 ,
.Xr wscons 9 ,
2001-10-22 07:29:58 +04:00
.Xr wsdisplay 9 ,
.Xr wskbd 9