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.
12 .\" THIS SOFTWARE IS PROVIDED BY John-Mark Gurney AND CONTRIBUTORS ``AS IS'' AND
13 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" .Nd supplies mouse data from syscons for other applications
32 .Nd virtualized mouse driver
37 The console driver, in conjunction with the mouse daemon
39 supplies mouse data to the user process in the standardized way via the
42 This arrangement makes it possible for the console and the user process
44 .Tn X\ Window System )
47 The user process which wants to utilize mouse operation simply opens
52 mouse data from the device via
56 is running, otherwise the user process will not see any data coming from
62 driver has two levels of operation.
63 The current operation level can be referred to and changed via ioctl calls.
65 The level zero, the basic level, is the lowest level at which the driver
66 offers the basic service to user programs.
70 provides horizontal and vertical movement of the mouse
71 and state of up to three buttons in the
75 .Bl -tag -width Byte_1 -compact
77 .Bl -tag -width bit_7 -compact
83 Left button status; cleared if pressed, otherwise set.
85 Middle button status; cleared if pressed, otherwise set.
87 if the device does not have the middle button.
89 Right button status; cleared if pressed, otherwise set.
92 The first half of horizontal movement count in two's complement;
95 The first half of vertical movement count in two's complement;
98 The second half of the horizontal movement count in two's complement;
100 To obtain the full horizontal movement count, add
103 The second half of the vertical movement count in two's complement;
105 To obtain the full vertical movement count, add
109 At the level one, the extended level, mouse data is encoded
110 in the standard format
111 .Dv MOUSE_PROTO_SYSMOUSE
117 .\" driver can somewhat `accelerate' the movement of the pointing device.
118 .\" The faster you move the device, the further the pointer
119 .\" travels on the screen.
120 .\" The driver has an internal variable which governs the effect of
121 .\" the acceleration. Its value can be modified via the driver flag
122 .\" or via an ioctl call.
124 This section describes two classes of
129 driver itself, and commands for the console and the console control drivers.
131 There are a few commands for mouse drivers.
132 General description of the commands is given in
134 Following are the features specific to the
138 .Bl -tag -width MOUSE -compact
139 .It Dv MOUSE_GETLEVEL Ar int *level
140 .It Dv MOUSE_SETLEVEL Ar int *level
141 These commands manipulate the operation level of the mouse driver.
143 .It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
144 Returns the hardware information of the attached device in the following
148 field is guaranteed to be filled with the correct value in the current
153 typedef struct mousehw {
154 int buttons; /* number of buttons */
155 int iftype; /* I/F type */
156 int type; /* mouse/track ball/pad... */
157 int model; /* I/F dependent model ID */
158 int hwid; /* I/F dependent hardware ID */
164 field holds the number of buttons detected by the driver.
169 .Dv MOUSE_IF_SYSMOUSE .
173 tells the device type:
175 .Dv MOUSE_TRACKBALL ,
184 .Dv MOUSE_MODEL_GENERIC
185 at the operation level 0.
187 .Dv MOUSE_MODEL_GENERIC
190 constants at higher operation levels.
196 .It Dv MOUSE_GETMODE Ar mousemode_t *mode
197 The command gets the current operation parameters of the mouse
200 typedef struct mousemode {
201 int protocol; /* MOUSE_PROTO_XXX */
202 int rate; /* report rate (per sec) */
203 int resolution; /* MOUSE_RES_XXX, -1 if unknown */
204 int accelfactor; /* acceleration factor */
205 int level; /* driver operation level */
206 int packetsize; /* the length of the data packet */
207 unsigned char syncmask[2]; /* sync. bits */
213 field tells the format in which the device status is returned
214 when the mouse data is read by the user program.
217 at the operation level zero.
218 .Dv MOUSE_PROTO_SYSMOUSE
219 at the operation level one.
223 is always set to \-1.
227 is always set to \-1.
235 field specifies the length of the data packet.
239 .Bl -tag -width level_0__ -compact
248 holds a bit mask and pattern to detect the first byte of the
251 is the bit mask to be ANDed with a byte.
252 If the result is equal to
254 the byte is likely to be the first byte of the data packet.
255 Note that this method of detecting the first byte is not 100% reliable;
256 thus, it should be taken only as an advisory measure.
258 .It Dv MOUSE_SETMODE Ar mousemode_t *mode
259 The command changes the current operation parameters of the mouse driver
265 Setting values in the other field does not generate
266 error and has no effect.
268 .\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
269 .\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
270 .\" These commands are not supported by the
274 .It Dv MOUSE_READDATA Ar mousedata_t *data
275 .It Dv MOUSE_READSTATE Ar mousedata_t *state
276 These commands are not supported by the
280 .It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
281 The command returns the current state of buttons and
282 movement counts in the structure as defined in
285 .Ss Console and Consolectl Ioctls
286 The user process issues console
288 calls to the current virtual console in order to control
292 also provides a method for the user process to receive a
294 when a button is pressed.
300 calls to the console control device
302 to inform the console of mouse actions including mouse movement
307 commands are defined as
309 which takes the following argument.
314 struct mouse_data data;
315 struct mouse_mode mode;
316 struct mouse_event event;
321 .Bl -tag -width operation -compact
325 .Bl -tag -width MOUSE_MOVEABS -compact
327 Enables and displays mouse cursor.
329 Disables and hides mouse cursor.
331 Moves mouse cursor to position supplied in
334 Adds position supplied in
338 Returns current mouse position in the current virtual console
344 to be delivered to the current process when a button is pressed.
345 The signal to be delivered is set in
349 The above operations are for virtual consoles.
350 The operations defined
351 below are for the console control device and are used by
353 to pass mouse data to the console driver.
355 .Bl -tag -width MOUSE_MOVEABS -compact
357 .It Dv MOUSE_MOTION_EVENT
358 These operations take the information in
361 Mouse data will be sent to the
363 driver if it is open.
365 also processes button press actions and sends signal to the process if
366 requested or performs cut and paste operations
367 if the current console is a text interface.
368 .It Dv MOUSE_BUTTON_EVENT
370 specifies a button and its click count.
371 The console driver will
372 use this information for signal delivery if requested or
373 for cut and paste operations if the console is in text mode.
376 .Dv MOUSE_MOTION_EVENT
378 .Dv MOUSE_BUTTON_EVENT
379 are newer interface and are designed to be used together.
380 They are intended to replace functions performed by
387 .Bl -tag -width data -compact
401 represent movement of the mouse along respective directions.
403 tells the state of buttons.
404 It encodes up to 31 buttons in the bit 0 though
406 If a button is held down, the corresponding bit is set.
418 field specifies the signal to be delivered to the process.
420 one of the values defined in
424 field is currently unused.
436 field specifies a button number as in
438 Only one bit/button is set.
442 holds the click count: the number of times the user has clicked the button
447 .Bl -tag -width /dev/consolectl -compact
448 .It Pa /dev/consolectl
449 device to control the console
451 virtualized mouse driver
464 driver first appeared in
469 manual page was written by
470 .An John-Mark Gurney Aq Mt jmg@FreeBSD.org
472 .An Kazutaka Yokota Aq Mt yokota@FreeBSD.org .