1.\" $NetBSD: wsmouse.9,v 1.4 2002/10/14 13:43:38 wiz Exp $ 2.\" 3.\" Copyright (c) 2001 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Gregory McGarry. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgement: 19.\" This product includes software developed by the NetBSD 20.\" Foundation, Inc. and its contributors. 21.\" 4. Neither the name of The NetBSD Foundation nor the names of its 22.\" contributors may be used to endorse or promote products derived 23.\" from this software without specific prior written permission. 24.\" 25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35.\" POSSIBILITY OF SUCH DAMAGE. 36.\" 37.Dd October 7, 2001 38.Dt WSMOUSE 9 39.Os 40.Sh NAME 41.Nm wsmouse , 42.Nm wsmouse_input , 43.Nm wsmousedevprint 44.Nd wscons mouse support 45.Sh SYNOPSIS 46.Fd #include \*[Lt]dev/wscons/wsconsio.h\*[Gt] 47.Fd #include \*[Lt]dev/wscons/wsmousevar.h\*[Gt] 48.Ft void 49.Fn wsmouse_input "struct device *msdev" "u_int btns" \ 50"int x" "int y" "int z" "u_int flags" 51.Ft int 52.Fn wsmousedevprint "void *aux" "const char *pnp" 53.Sh DESCRIPTION 54The 55.Nm 56module is a component of the 57.Xr wscons 9 58framework to provide machine-indpendent mouse support. 59Most of the support is provided by the 60.Xr wsmouse 4 61device driver, which must be a child of the hardware device driver. 62.Sh DATA TYPES 63Mouse drivers providing support for wscons pointer devices will make use 64of the following data types: 65.Bl -tag -width compact 66.It Fa struct wsmouse_accessops 67A structure used to specify the mouse access functions. 68All pointer devices must provide this structure and pass it to the 69.Xr wsmouse 4 70child device. 71It has the following members: 72.Bd -literal 73 int (*enable)(void *); 74 int (*ioctl)(void *v, u_long cmd, caddr_t data, 75 int flag, struct proc *p); 76 void (*disable)(void *); 77.Ed 78.Pp 79The 80.Fa enable 81member defines the function to be called to enable monitoring pointer 82movements and passing these events to 83wscons. 84The 85.Fa disable 86member defines the function to disable movement events. 87The 88.Fa ioctl 89member defines the function to be called to perform mouse-specific 90ioctl calls. 91.Pp 92There is a 93.Fa void * 94cookie provided by the mouse driver associated with these functions, 95which is passed to them when they are invoked. 96.It Fa struct wsmouse_attach_args 97A structure used to attach the 98.Xr wsmouse 4 99child device. 100It has the following members: 101.Bd -literal 102 const struct wsmouse_accessops *accessops; 103 void *accesscookie; 104.Ed 105.El 106.Sh FUNCTIONS 107.Bl -tag -width compact 108.It Fn wsmouse_input "msdev" "btns" "x" "y" "z" "flags" 109Callback from the mouse driver to the wsmouse interface driver. 110The argument 111.Fa btns 112specifies the current button configuration. 113The pointer coordinate is specified by the 114.Fa x , 115.Fa y , 116.Fa z 117tuple. 118The 119.Fa flags 120argument specify whether the pointer device and the measurement is in 121relative or absolute mode. 122Valid values for 123.Fa flags 124are: 125.Bl -tag -width compact 126.It WSMOUSE_INPUT_DELTA 127Relative mode. 128.It WSMOUSE_INPUT_ABSOLUTE_X 129Obsolute mode in x-direction. 130.It WSMOUSE_INPUT_ABSOLUTE_Y 131Obsolute mode in y-direction. 132.It WSMOUSE_INPUT_ABSOLUTE_Z 133Obsolute mode in z-direction. 134.El 135.It Fn wsmousedevprint "aux" "pnp" 136The default wsmouse printing routine used by 137.Fn config_found . 138(see 139.Xr autoconf 9 ) . 140.El 141.Sh AUTOCONFIGURATION 142Mouse drivers which want to utilise the wsmouse module must be a 143parent to the 144.Xr wsmouse 4 145device and provide an attachment interface. 146To attach the 147.Xr wsmouse 4 148device, the mouse driver must allocate and populate a 149.Fa wsmouse_attach_args 150structure with the supported operations and callbacks and call 151.Fn config_found 152to perform the attach (see 153.Xr autoconf 9 ) . 154.Sh OPERATION 155When a mouse-movement event is received, the device driver must 156perform any necessary movement decoding to wscons events and pass the 157events to wscons via 158.Fn wsmouse_input . 159.Pp 160The wscons framework calls back into the hardware driver by invoking 161the functions that are specified in the 162.Em accessops 163structure. 164The 165.Fn enable 166and 167.Fn disable 168functions are relatively simple and self-explanatory. 169The 170.Fn ioctl 171function is called by the wscons interface to perform 172mouse-specific ioctl operations (see 173.Xr ioctl 2 ) . 174The argument 175.Fa cmd 176to the 177.Fn ioctl 178function specifies the specific command to perform using the data 179.Fa data . 180Valid commands are listed in 181.Pa sys/dev/wscons/wsconsio.h . 182.Sh CODE REFERENCES 183This section describes places within the 184.Nx 185source tree where actual code implementing or utilising the 186machine-independent wscons subsystem can be found. 187All pathnames are relative to 188.Pa /usr/src . 189.Pp 190The wscons subsystem is implemented within the directory 191.Pa sys/dev/wscons . 192The 193.Nm 194module itself is implement within the file 195.Pa sys/dev/wscons/wsmouse.c . 196.Xr ioctl 2 197operations are listed in 198.Pa sys/dev/wscons/wsconsio.h . 199.Sh SEE ALSO 200.Xr ioctl 2 , 201.Xr autoconf 9 , 202.Xr driver 9 , 203.Xr intro 9 , 204.Xr wsdisplay 9 , 205.Xr wskbd 9 206