1 .\" Copyright 1997 John-Mark Gurney. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
11 .\" 3. Neither the name of the author nor the names of any co-contributors
12 .\" may be used to endorse or promote products derived from this software
13 .\" without specific prior written permission.
15 .\" THIS SOFTWARE IS PROVIDED BY John-Mark Gurney AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" .Nd supplies mouse data from syscons for other applications
35 .Nd virtualized mouse driver
40 The console driver, in conjunction with the mouse daemon
42 supplies mouse data to the user process in the standardized way via the
45 This arrangement makes it possible for the console and the user process
47 .Tn X\ Window System )
50 The user process which wants to utilize mouse operation simply opens
55 mouse data from the device via
59 is running, otherwise the user process will not see any data coming from
65 driver has two levels of operation.
66 The current operation level can be referred to and changed via ioctl calls.
68 The level zero, the basic level, is the lowest level at which the driver
69 offers the basic service to user programs.
73 provides horizontal and vertical movement of the mouse
74 and state of up to three buttons in the
78 .Bl -tag -width Byte_1 -compact
80 .Bl -tag -width bit_7 -compact
86 Left button status; cleared if pressed, otherwise set.
88 Middle button status; cleared if pressed, otherwise set.
90 if the device does not have the middle button.
92 Right button status; cleared if pressed, otherwise set.
95 The first half of horizontal movement count in two's complement;
98 The first half of vertical movement count in two's complement;
101 The second half of the horizontal movement count in two's complement;
103 To obtain the full horizontal movement count, add
106 The second half of the vertical movement count in two's complement;
108 To obtain the full vertical movement count, add
112 At the level one, the extended level, mouse data is encoded
113 in the standard format
114 .Dv MOUSE_PROTO_SYSMOUSE
120 .\" driver can somewhat `accelerate' the movement of the pointing device.
121 .\" The faster you move the device, the further the pointer
122 .\" travels on the screen.
123 .\" The driver has an internal variable which governs the effect of
124 .\" the acceleration. Its value can be modified via the driver flag
125 .\" or via an ioctl call.
127 This section describes two classes of
132 driver itself, and commands for the console and the console control drivers.
134 There are a few commands for mouse drivers.
135 General description of the commands is given in
137 Following are the features specific to the
141 .Bl -tag -width MOUSE -compact
142 .It Dv MOUSE_GETLEVEL Ar int *level
143 .It Dv MOUSE_SETLEVEL Ar int *level
144 These commands manipulate the operation level of the mouse driver.
146 .It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
147 Returns the hardware information of the attached device in the following
151 field is guaranteed to be filled with the correct value in the current
156 typedef struct mousehw {
157 int buttons; /* number of buttons */
158 int iftype; /* I/F type */
159 int type; /* mouse/track ball/pad... */
160 int model; /* I/F dependent model ID */
161 int hwid; /* I/F dependent hardware ID */
167 field holds the number of buttons detected by the driver.
172 .Dv MOUSE_IF_SYSMOUSE .
176 tells the device type:
178 .Dv MOUSE_TRACKBALL ,
187 .Dv MOUSE_MODEL_GENERIC
188 at the operation level 0.
190 .Dv MOUSE_MODEL_GENERIC
193 constants at higher operation levels.
199 .It Dv MOUSE_GETMODE Ar mousemode_t *mode
200 The command gets the current operation parameters of the mouse
203 typedef struct mousemode {
204 int protocol; /* MOUSE_PROTO_XXX */
205 int rate; /* report rate (per sec) */
206 int resolution; /* MOUSE_RES_XXX, -1 if unknown */
207 int accelfactor; /* acceleration factor */
208 int level; /* driver operation level */
209 int packetsize; /* the length of the data packet */
210 unsigned char syncmask[2]; /* sync. bits */
216 field tells the format in which the device status is returned
217 when the mouse data is read by the user program.
220 at the operation level zero.
221 .Dv MOUSE_PROTO_SYSMOUSE
222 at the operation level one.
226 is always set to \-1.
230 is always set to \-1.
238 field specifies the length of the data packet.
242 .Bl -tag -width level_0__ -compact
251 holds a bit mask and pattern to detect the first byte of the
254 is the bit mask to be ANDed with a byte.
255 If the result is equal to
257 the byte is likely to be the first byte of the data packet.
258 Note that this method of detecting the first byte is not 100% reliable;
259 thus, it should be taken only as an advisory measure.
261 .It Dv MOUSE_SETMODE Ar mousemode_t *mode
262 The command changes the current operation parameters of the mouse driver
268 Setting values in the other field does not generate
269 error and has no effect.
271 .\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
272 .\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
273 .\" These commands are not supported by the
277 .It Dv MOUSE_READDATA Ar mousedata_t *data
278 .It Dv MOUSE_READSTATE Ar mousedata_t *state
279 These commands are not supported by the
283 .It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
284 The command returns the current state of buttons and
285 movement counts in the structure as defined in
288 .Ss Console and Consolectl Ioctls
289 The user process issues console
291 calls to the current virtual console in order to control
295 also provides a method for the user process to receive a
297 when a button is pressed.
303 calls to the console control device
305 to inform the console of mouse actions including mouse movement
310 commands are defined as
312 which takes the following argument.
317 struct mouse_data data;
318 struct mouse_mode mode;
319 struct mouse_event event;
324 .Bl -tag -width operation -compact
328 .Bl -tag -width MOUSE_MOVEABS -compact
330 Enables and displays mouse cursor.
332 Disables and hides mouse cursor.
334 Moves mouse cursor to position supplied in
337 Adds position supplied in
341 Returns current mouse position in the current virtual console
347 to be delivered to the current process when a button is pressed.
348 The signal to be delivered is set in
352 The above operations are for virtual consoles.
353 The operations defined
354 below are for the console control device and are used by
356 to pass mouse data to the console driver.
358 .Bl -tag -width MOUSE_MOVEABS -compact
360 .It Dv MOUSE_MOTION_EVENT
361 These operations take the information in
364 Mouse data will be sent to the
366 driver if it is open.
368 also processes button press actions and sends signal to the process if
369 requested or performs cut and paste operations
370 if the current console is a text interface.
371 .It Dv MOUSE_BUTTON_EVENT
373 specifies a button and its click count.
374 The console driver will
375 use this information for signal delivery if requested or
376 for cut and paste operations if the console is in text mode.
379 .Dv MOUSE_MOTION_EVENT
381 .Dv MOUSE_BUTTON_EVENT
382 are newer interface and are designed to be used together.
383 They are intended to replace functions performed by
390 .Bl -tag -width data -compact
404 represent movement of the mouse along respective directions.
406 tells the state of buttons.
407 It encodes up to 31 buttons in the bit 0 though
409 If a button is held down, the corresponding bit is set.
421 field specifies the signal to be delivered to the process.
423 one of the values defined in
427 field is currently unused.
439 field specifies a button number as in
441 Only one bit/button is set.
445 holds the click count: the number of times the user has clicked the button
451 .Bl -tag -width /dev/consolectl -compact
452 .It Pa /dev/consolectl
453 device to control the console
455 virtualized mouse driver
468 driver first appeared in
473 manual page was written by
474 .An John-Mark Gurney Aq gurney_j@efn.org
476 .An Kazutaka Yokota Aq yokota@FreeBSD.org .