2 .\" John-Mark Gurney. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the author nor the names of any co-contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY John-Mark Gurney AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" $FreeBSD: src/share/man/man4/sysmouse.4,v 1.12.2.5 2001/12/17 11:30:12 ru Exp $
29 .\" $DragonFly: src/share/man/man4/sysmouse.4,v 1.2 2003/06/17 04:36:59 dillon Exp $
36 .\" .Nd supplies mouse data from syscons for other applications
37 .Nd virtualized mouse driver
42 The console driver, in conjunction with the mouse daemon
44 supplies mouse data to the user process in the standardized way via the
47 This arrangement makes it possible for the console and the user process
49 .Tn X\ Window System )
52 The user process which wants to utilize mouse operation simply opens
57 mouse data from the device via
61 is running, otherwise the user process won't see any data coming from
67 driver has two levels of operation.
68 The current operation level can be referred to and changed via ioctl calls.
70 The level zero, the basic level, is the lowest level at which the driver
71 offers the basic service to user programs.
75 provides horizontal and vertical movement of the mouse
76 and state of up to three buttons in the
80 .Bl -tag -width Byte_1 -compact
82 .Bl -tag -width bit_7 -compact
88 Left button status; cleared if pressed, otherwise set.
90 Middle button status; cleared if pressed, otherwise set.
92 if the device does not have the middle button.
94 Right button status; cleared if pressed, otherwise set.
97 The first half of horizontal movement count in two's complement;
100 The first half of vertical movement count in two's complement;
103 The second half of the horizontal movement count in two's complement;
104 -128 through 127. To obtain the full horizontal movement count, add
107 The second half of the vertical movement count in two's complement;
108 -128 through 127. 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
150 field is guaranteed to be filled with the correct value in the current
155 typedef struct mousehw {
156 int buttons; /* number of buttons */
157 int iftype; /* I/F type */
158 int type; /* mouse/track ball/pad... */
159 int model; /* I/F dependent model ID */
160 int hwid; /* I/F dependent hardware ID */
166 field holds the number of buttons detected by the driver.
171 .Dv MOUSE_IF_SYSMOUSE .
175 tells the device type:
177 .Dv MOUSE_TRACKBALL ,
186 .Dv MOUSE_MODEL_GENERIC
187 at the operation level 0.
189 .Dv MOUSE_MODEL_GENERIC
192 constants at higher operation levels.
198 .It Dv MOUSE_GETMODE Ar mousemode_t *mode
199 The command gets the current operation parameters of the mouse
202 typedef struct mousemode {
203 int protocol; /* MOUSE_PROTO_XXX */
204 int rate; /* report rate (per sec) */
205 int resolution; /* MOUSE_RES_XXX, -1 if unknown */
206 int accelfactor; /* acceleration factor */
207 int level; /* driver operation level */
208 int packetsize; /* the length of the data packet */
209 unsigned char syncmask[2]; /* sync. bits */
215 field tells the format in which the device status is returned
216 when the mouse data is read by the user program.
219 at the operation level zero.
220 .Dv MOUSE_PROTO_SYSMOUSE
221 at the operation level one.
237 field specifies the length of the data packet.
241 .Bl -tag -width level_0__ -compact
250 holds a bit mask and pattern to detect the first byte of the
253 is the bit mask to be ANDed with a byte.
254 If the result is equal to
256 the byte is likely to be the first byte of the data packet.
257 Note that this method of detecting the first byte is not 100% reliable;
258 thus, it should be taken only as an advisory measure.
260 .It Dv MOUSE_SETMODE Ar mousemode_t *mode
261 The command changes the current operation parameters of the mouse driver
267 Setting values in the other field does not generate
268 error and has no effect.
270 .\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
271 .\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
272 .\" These commands are not supported by the
276 .It Dv MOUSE_READDATA Ar mousedata_t *data
277 .It Dv MOUSE_READSTATE Ar mousedata_t *state
278 These commands are not supported by the
282 .It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
283 The command returns the current state of buttons and
284 movement counts in the structure as defined in
287 .Ss Console and Consolectl Ioctls
288 The user process issues console
290 calls to the current virtual console in order to control
294 also provides a method for the user process to receive a
296 when a button is pressed.
302 calls to the console control device
304 to inform the console of mouse actions including mouse movement
309 commands are defined as
311 which takes the following argument.
316 struct mouse_data data;
317 struct mouse_mode mode;
318 struct mouse_event event;
323 .Bl -tag -width operation -compact
327 .Bl -tag -width MOUSE_MOVEABS -compact
329 Enables and displays mouse cursor.
331 Disables and hides mouse cursor.
333 Moves mouse cursor to position supplied in
336 Adds position supplied in
340 Returns current mouse position in the current virtual console
346 to be delivered to the current process when a button is pressed.
347 The signal to be delivered is set in
351 The above operations are for virtual consoles.
352 The operations defined
353 below are for the console control device and are used by
355 to pass mouse data to the console driver.
357 .Bl -tag -width MOUSE_MOVEABS -compact
359 .It Dv MOUSE_MOTIONEVENT
360 These operations take the information in
362 and act upon it. Mouse data will be sent to the
364 driver if it is open.
366 also processes button press actions and sends signal to the process if
367 requested or performs cut and paste operations
368 if the current console is a text interface.
369 .It Dv MOUSE_BUTTONEVENT
371 specifies a button and its click count.
372 The console driver will
373 use this information for signal delivery if requested or
374 for cut and paste operations if the console is in text mode.
377 .Dv MOUSE_MOTIONEVENT
379 .Dv MOUSE_BUTTONEVENT
380 are newer interface and are designed to be used together.
381 They are intended to replace functions performed by
388 .Bl -tag -width data -compact
403 represent movement of the mouse along respective directions.
405 tells the state of buttons.
406 It encodes up to 31 buttons in the bit 0 though
407 the bit 30. If a button is held down, the corresponding bit is set.
419 field specifies the signal to be delivered to the process.
421 one of the values defined in
425 field is currently unused.
437 field specifies a button number as in
439 Only one bit/button is set.
443 holds the click count: the number of times the user has clicked the button
449 .Bl -tag -width /dev/consolectl -compact
450 .It Pa /dev/consolectl
451 device to control the console
453 virtualized mouse driver
466 manual page example first appeared in
471 manual page was written by
472 .An John-Mark Gurney Aq gurney_j@efn.org
474 .An Kazutaka Yokota Aq yokota@FreeBSD.org .