1 .\" $NetBSD: wsmouse.9,v 1.15 2007/03/07 00:41:19 dogcow Exp $
3 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Gregory McGarry.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
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.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
37 .Nd wscons mouse support
39 .In dev/wscons/wsconsio.h
40 .In dev/wscons/wsmousevar.h
42 .Fn wsmouse_input "struct device *msdev" "u_int btns" \
43 "int x" "int y" "int z" "int w" "u_int flags"
45 .Fn wsmousedevprint "void *aux" "const char *pnp"
49 module is a component of the
51 framework to provide machine-independent mouse support.
52 Most of the support is provided by the
54 device driver, which must be a child of the hardware device driver.
56 Mouse drivers providing support for wscons pointer devices will make use
57 of the following data types:
58 .Bl -tag -width compact
59 .It Fa struct wsmouse_accessops
60 A structure used to specify the mouse access functions.
61 All pointer devices must provide this structure and pass it to the
64 It has the following members:
66 int (*enable)(void *);
67 int (*ioctl)(void *v, u_long cmd, void *data,
68 int flag, struct lwp *l);
69 void (*disable)(void *);
74 member defines the function to be called to enable monitoring pointer
75 movements and passing these events to
79 member defines the function to disable movement events.
82 member defines the function to be called to perform mouse-specific
87 cookie provided by the mouse driver associated with these functions,
88 which is passed to them when they are invoked.
89 .It Fa struct wsmousedev_attach_args
90 A structure used to attach the
93 It has the following members:
95 const struct wsmouse_accessops *accessops;
100 .Bl -tag -width compact
101 .It Fn wsmouse_input "msdev" "btns" "x" "y" "z" "w" "flags"
102 Callback from the mouse driver to the wsmouse interface driver.
103 Arguments are as follows:
104 .Bl -tag -width msdev -compact
110 on attaching the child
112 to specify the mouse device.
114 This specifies the current button status.
115 Bits for pressed buttons (which will cause the
116 .Dv WSCONS_EVENT_MOUSE_DOWN
119 device) should be set, and bits for released buttons (which will cause the
120 .Dv WSCONS_EVENT_MOUSE_UP
121 event) should be zero.
122 The left most button state should be in LSB,
123 i.e. for typical three button mouse,
124 the left button is 0x01,
125 the middle button is 0x02,
126 and the right button is 0x04.
128 Absolute or relative X-axis value to specify the pointer coordinate.
129 Rightward (moving the mouse right) is positive.
131 Absolute or relative Y-axis value to specify the pointer coordinate.
132 Upward (moving the mouse forward) is positive.
133 Note that this aspect is opposite from the one used in the X server dix layer.
135 Absolute or relative Z-axis value to specify the pointer coordinate.
136 Usually this axis is used for the wheel.
137 Downward (turning the wheel backward) is positive.
139 Absolute or relative W-axis value to specify the pointer coordinate.
140 Usually this axis would be used for the horizontal component of the wheel.
142 This argument specifies whether the pointer device and the measurement
149 axes is in relative or absolute mode.
153 .Bl -tag -width compact
154 .It WSMOUSE_INPUT_DELTA
156 .It WSMOUSE_INPUT_ABSOLUTE_X
160 .It WSMOUSE_INPUT_ABSOLUTE_Y
164 .It WSMOUSE_INPUT_ABSOLUTE_Z
168 .It WSMOUSE_INPUT_ABSOLUTE_W
174 .It Fn wsmousedevprint "aux" "pnp"
175 The default wsmouse printing routine used by
180 .Sh AUTOCONFIGURATION
181 Mouse drivers which want to use the wsmouse module must be a
184 device and provide an attachment interface.
187 device, the mouse driver must allocate and populate a
188 .Fa wsmousedev_attach_args
189 structure with the supported operations and callbacks and call
191 to perform the attach (see
194 When a mouse-movement event is received, the device driver must
195 perform any necessary movement decoding to wscons events and pass the
199 The wscons framework calls back into the hardware driver by invoking
200 the functions that are specified in the
207 functions are relatively simple and self-explanatory.
210 function is called by the wscons interface to perform
211 mouse-specific ioctl operations (see
217 function specifies the specific command to perform using the data
219 Valid commands are listed in
220 .Pa sys/dev/wscons/wsconsio.h .
222 This section describes places within the
224 source tree where actual code implementing or using the
225 machine-independent wscons subsystem can be found.
226 All pathnames are relative to
229 The wscons subsystem is implemented within the directory
233 module itself is implement within the file
234 .Pa sys/dev/wscons/wsmouse.c .
236 operations are listed in
237 .Pa sys/dev/wscons/wsconsio.h .