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
61 driver has two levels of operation.
62 The current operation level can be referred to and changed via ioctl calls.
64 The level zero, the basic level, is the lowest level at which the driver
65 offers the basic service to user programs.
69 provides horizontal and vertical movement of the mouse
70 and state of up to three buttons in the
74 .Bl -tag -width Byte_1 -compact
76 .Bl -tag -width bit_7 -compact
82 Left button status; cleared if pressed, otherwise set.
84 Middle button status; cleared if pressed, otherwise set.
86 if the device does not have the middle button.
88 Right button status; cleared if pressed, otherwise set.
91 The first half of horizontal movement count in two's complement;
94 The first half of vertical movement count in two's complement;
97 The second half of the horizontal movement count in two's complement;
99 To obtain the full horizontal movement count, add
102 The second half of the vertical movement count in two's complement;
104 To obtain the full vertical movement count, add
108 At the level one, the extended level, mouse data is encoded
109 in the standard format
110 .Dv MOUSE_PROTO_SYSMOUSE
116 .\" driver can somewhat `accelerate' the movement of the pointing device.
117 .\" The faster you move the device, the further the pointer
118 .\" travels on the screen.
119 .\" The driver has an internal variable which governs the effect of
120 .\" the acceleration. Its value can be modified via the driver flag
121 .\" or via an ioctl call.
123 This section describes two classes of
128 driver itself, and commands for the console and the console control drivers.
130 There are a few commands for mouse drivers.
131 General description of the commands is given in
133 Following are the features specific to the
137 .Bl -tag -width MOUSE -compact
138 .It Dv MOUSE_GETLEVEL Ar int *level
139 .It Dv MOUSE_SETLEVEL Ar int *level
140 These commands manipulate the operation level of the mouse driver.
142 .It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
143 Returns the hardware information of the attached device in the following
147 field is guaranteed to be filled with the correct value in the current
152 typedef struct mousehw {
153 int buttons; /* number of buttons */
154 int iftype; /* I/F type */
155 int type; /* mouse/track ball/pad... */
156 int model; /* I/F dependent model ID */
157 int hwid; /* I/F dependent hardware ID */
163 field holds the number of buttons detected by the driver.
168 .Dv MOUSE_IF_SYSMOUSE .
172 tells the device type:
174 .Dv MOUSE_TRACKBALL ,
183 .Dv MOUSE_MODEL_GENERIC
184 at the operation level 0.
186 .Dv MOUSE_MODEL_GENERIC
189 constants at higher operation levels.
195 .It Dv MOUSE_GETMODE Ar mousemode_t *mode
196 The command gets the current operation parameters of the mouse
199 typedef struct mousemode {
200 int protocol; /* MOUSE_PROTO_XXX */
201 int rate; /* report rate (per sec) */
202 int resolution; /* MOUSE_RES_XXX, -1 if unknown */
203 int accelfactor; /* acceleration factor */
204 int level; /* driver operation level */
205 int packetsize; /* the length of the data packet */
206 unsigned char syncmask[2]; /* sync. bits */
212 field tells the format in which the device status is returned
213 when the mouse data is read by the user program.
216 at the operation level zero.
217 .Dv MOUSE_PROTO_SYSMOUSE
218 at the operation level one.
222 is always set to \-1.
226 is always set to \-1.
234 field specifies the length of the data packet.
238 .Bl -tag -width level_0__ -compact
247 holds a bit mask and pattern to detect the first byte of the
250 is the bit mask to be ANDed with a byte.
251 If the result is equal to
253 the byte is likely to be the first byte of the data packet.
254 Note that this method of detecting the first byte is not 100% reliable;
255 thus, it should be taken only as an advisory measure.
257 .It Dv MOUSE_SETMODE Ar mousemode_t *mode
258 The command changes the current operation parameters of the mouse driver
264 Setting values in the other field does not generate
265 error and has no effect.
267 .It Dv MOUSE_READDATA Ar mousedata_t *data
268 .It Dv MOUSE_READSTATE Ar mousedata_t *state
269 These commands are not supported by the
273 .It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
274 The command returns the current state of buttons and
275 movement counts in the structure as defined in
278 .Ss Console and Consolectl Ioctls
279 The user process issues console
281 calls to the current virtual console in order to control
285 also provides a method for the user process to receive a
287 when a button is pressed.
293 calls to the console control device
295 to inform the console of mouse actions including mouse movement
300 commands are defined as
302 which takes the following argument.
307 struct mouse_data data;
308 struct mouse_mode mode;
309 struct mouse_event event;
314 .Bl -tag -width operation -compact
318 .Bl -tag -width MOUSE_MOVEABS -compact
320 Enables and displays mouse cursor.
322 Disables and hides mouse cursor.
324 Moves mouse cursor to position supplied in
327 Adds position supplied in
331 Returns current mouse position in the current virtual console
337 to be delivered to the current process when a button is pressed.
338 The signal to be delivered is set in
342 The above operations are for virtual consoles.
343 The operations defined
344 below are for the console control device and are used by
346 to pass mouse data to the console driver.
348 .Bl -tag -width MOUSE_MOVEABS -compact
350 .It Dv MOUSE_MOTION_EVENT
351 These operations take the information in
354 Mouse data will be sent to the
356 driver if it is open.
358 also processes button press actions and sends signal to the process if
359 requested or performs cut and paste operations
360 if the current console is a text interface.
361 .It Dv MOUSE_BUTTON_EVENT
363 specifies a button and its click count.
364 The console driver will
365 use this information for signal delivery if requested or
366 for cut and paste operations if the console is in text mode.
369 .Dv MOUSE_MOTION_EVENT
371 .Dv MOUSE_BUTTON_EVENT
372 are newer interface and are designed to be used together.
373 They are intended to replace functions performed by
380 .Bl -tag -width data -compact
394 represent movement of the mouse along respective directions.
396 tells the state of buttons.
397 It encodes up to 31 buttons in the bit 0 though
399 If a button is held down, the corresponding bit is set.
411 field specifies the signal to be delivered to the process.
413 one of the values defined in
417 field is currently unused.
429 field specifies a button number as in
431 Only one bit/button is set.
435 holds the click count: the number of times the user has clicked the button
440 .Bl -tag -width /dev/consolectl -compact
441 .It Pa /dev/consolectl
442 device to control the console
444 virtualized mouse driver
457 driver first appeared in
462 manual page was written by
463 .An John-Mark Gurney Aq Mt jmg@FreeBSD.org
465 .An Kazutaka Yokota Aq Mt yokota@FreeBSD.org .