.\" $NetBSD: wsmouse.9,v 1.12 2005/12/20 19:53:15 rpaulo 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 December 20, 2005 .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 .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. 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 lwp *l); 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 wsmousedev_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. 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 .Fa x , .Fa y , and .Fa z axes 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 Absolute mode in .Fa x axis. .It WSMOUSE_INPUT_ABSOLUTE_Y Absolute mode in .Fa y axis. .It WSMOUSE_INPUT_ABSOLUTE_Z Absolute mode in .Fa z axis. .El .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 use 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 wsmousedev_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 using 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 pms 4 , .Xr wscons 4 , .Xr wsmouse 4 , .Xr autoconf 9 , .Xr driver 9 , .Xr intro 9 , .Xr wscons 9 , .Xr wsdisplay 9 , .Xr wskbd 9