1.\" $NetBSD: wsmouse.9,v 1.3 2002/02/13 08:18:58 ross 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. Most of the 59support 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. All pointer 68devices must provide this structure and pass it to the 69.Xr wsmouse 4 70child device. It has the following members: 71.Bd -literal 72 int (*enable)(void *); 73 int (*ioctl)(void *v, u_long cmd, caddr_t data, 74 int flag, struct proc *p); 75 void (*disable)(void *); 76.Ed 77.Pp 78The 79.Fa enable 80member defines the function to be called to enable monitoring pointer 81movements and passing these events to 82wscons. The 83.Fa disable 84member defines the function to disable movement events. 85The 86.Fa ioctl 87member defines the function to be called to perform mouse-specific 88ioctl calls. 89.Pp 90There is a 91.Fa void * 92cookie provided by the mouse driver associated with these functions, 93which is passed to them when they are invoked. 94.It Fa struct wsmouse_attach_args 95A structure used to attach the 96.Xr wsmouse 4 97child device. It has the following members: 98.Bd -literal 99 const struct wsmouse_accessops *accessops; 100 void *accesscookie; 101.Ed 102.El 103.Sh FUNCTIONS 104.Bl -tag -width compact 105.It Fn wsmouse_input "msdev" "btns" "x" "y" "z" "flags" 106Callback from the mouse driver to the wsmouse interface driver. 107The argument 108.Fa btns 109specifies the current button configuration. The pointer coordinate is 110specified by the 111.Fa x , 112.Fa y , 113.Fa z 114tuple. The 115.Fa flags 116argument specify whether the pointer device and the measurement is in 117relative or absolute mode. Valid values for 118.Fa flags 119are: 120.Bl -tag -width compact 121.It WSMOUSE_INPUT_DELTA 122Relative mode. 123.It WSMOUSE_INPUT_ABSOLUTE_X 124Obsolute mode in x-direction. 125.It WSMOUSE_INPUT_ABSOLUTE_Y 126Obsolute mode in y-direction. 127.It WSMOUSE_INPUT_ABSOLUTE_Z 128Obsolute mode in z-direction. 129.El 130.It Fn wsmousedevprint "aux" "pnp" 131The default wsmouse printing routine used by 132.Fn config_found . 133(see 134.Xr autoconf 9 ) . 135.El 136.Sh AUTOCONFIGURATION 137Mouse drivers which want to utilise the wsmouse module must be a 138parent to the 139.Xr wsmouse 4 140device and provide an attachment interface. To attach the 141.Xr wsmouse 4 142device, the mouse driver must allocate and populate a 143.Fa wsmouse_attach_args 144structure with the supported operations and callbacks and call 145.Fn config_found 146to perform the attach (see 147.Xr autoconf 9 ) . 148.Sh OPERATION 149When a mouse-movement event is received, the device driver must 150perform any necessary movement decoding to wscons events and pass the 151events to wscons via 152.Fn wsmouse_input . 153.Pp 154The wscons framework calls back into the hardware driver by invoking 155the functions that are specified in the 156.Em accessops 157structure. The 158.Fn enable 159and 160.Fn disable 161functions are relatively simple and self-explanatory. The 162.Fn ioctl 163function is called by the wscons interface to perform 164mouse-specific ioctl operations (see 165.Xr ioctl 2 ) . 166The argument 167.Fa cmd 168to the 169.Fn ioctl 170function specifies the specific command to perform using the data 171.Fa data . 172Valid commands are listed in 173.Pa sys/dev/wscons/wsconsio.h . 174.Sh CODE REFERENCES 175This section describes places within the 176.Nx 177source tree where actual code implementing or utilising the 178machine-independent wscons subsystem can be found. All pathnames are 179relative to 180.Pa /usr/src . 181.Pp 182The wscons subsystem is implemented within the directory 183.Pa sys/dev/wscons . 184The 185.Nm 186module itself is implement within the file 187.Pa sys/dev/wscons/wsmouse.c . 188.Xr ioctl 2 189operations are listed in 190.Pa sys/dev/wscons/wsconsio.h . 191.Sh SEE ALSO 192.Xr ioctl 2 , 193.Xr autoconf 9 , 194.Xr driver 9 , 195.Xr intro 9 , 196.Xr wsdisplay 9 , 197.Xr wskbd 9 198