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.4 2006/05/26 19:39:39 swildner 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
66 driver has two levels of operation.
67 The current operation level can be referred to and changed via ioctl calls.
69 The level zero, the basic level, is the lowest level at which the driver
70 offers the basic service to user programs.
74 provides horizontal and vertical movement of the mouse
75 and state of up to three buttons in the
79 .Bl -tag -width Byte_1 -compact
81 .Bl -tag -width bit_7 -compact
87 Left button status; cleared if pressed, otherwise set.
89 Middle button status; cleared if pressed, otherwise set.
91 if the device does not have the middle button.
93 Right button status; cleared if pressed, otherwise set.
96 The first half of horizontal movement count in two's complement;
99 The first half of vertical movement count in two's complement;
102 The second half of the horizontal movement count in two's complement;
103 -128 through 127. To obtain the full horizontal movement count, add
106 The second half of the vertical movement count in two's complement;
107 -128 through 127. To obtain the full vertical movement count, add
111 At the level one, the extended level, mouse data is encoded
112 in the standard format
113 .Dv MOUSE_PROTO_SYSMOUSE
119 .\" driver can somewhat `accelerate' the movement of the pointing device.
120 .\" The faster you move the device, the further the pointer
121 .\" travels on the screen.
122 .\" The driver has an internal variable which governs the effect of
123 .\" the acceleration. Its value can be modified via the driver flag
124 .\" or via an ioctl call.
126 This section describes two classes of
131 driver itself, and commands for the console and the console control drivers.
133 There are a few commands for mouse drivers.
134 General description of the commands is given in
136 Following are the features specific to the
140 .Bl -tag -width MOUSE -compact
141 .It Dv MOUSE_GETLEVEL Ar int *level
142 .It Dv MOUSE_SETLEVEL Ar int *level
143 These commands manipulate the operation level of the mouse driver.
145 .It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
146 Returns the hardware information of the attached device in the following
149 field is guaranteed to be filled with the correct value in the current
154 typedef struct mousehw {
155 int buttons; /* number of buttons */
156 int iftype; /* I/F type */
157 int type; /* mouse/track ball/pad... */
158 int model; /* I/F dependent model ID */
159 int hwid; /* I/F dependent hardware ID */
165 field holds the number of buttons detected by the driver.
170 .Dv MOUSE_IF_SYSMOUSE .
174 tells the device type:
176 .Dv MOUSE_TRACKBALL ,
185 .Dv MOUSE_MODEL_GENERIC
186 at the operation level 0.
188 .Dv MOUSE_MODEL_GENERIC
191 constants at higher operation levels.
197 .It Dv MOUSE_GETMODE Ar mousemode_t *mode
198 The command gets the current operation parameters of the mouse
201 typedef struct mousemode {
202 int protocol; /* MOUSE_PROTO_XXX */
203 int rate; /* report rate (per sec) */
204 int resolution; /* MOUSE_RES_XXX, -1 if unknown */
205 int accelfactor; /* acceleration factor */
206 int level; /* driver operation level */
207 int packetsize; /* the length of the data packet */
208 unsigned char syncmask[2]; /* sync. bits */
214 field tells the format in which the device status is returned
215 when the mouse data is read by the user program.
218 at the operation level zero.
219 .Dv MOUSE_PROTO_SYSMOUSE
220 at the operation level one.
236 field specifies the length of the data packet.
240 .Bl -tag -width level_0__ -compact
249 holds a bit mask and pattern to detect the first byte of the
252 is the bit mask to be ANDed with a byte.
253 If the result is equal to
255 the byte is likely to be the first byte of the data packet.
256 Note that this method of detecting the first byte is not 100% reliable;
257 thus, it should be taken only as an advisory measure.
259 .It Dv MOUSE_SETMODE Ar mousemode_t *mode
260 The command changes the current operation parameters of the mouse driver
266 Setting values in the other field does not generate
267 error and has no effect.
269 .\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
270 .\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
271 .\" These commands are not supported by the
275 .It Dv MOUSE_READDATA Ar mousedata_t *data
276 .It Dv MOUSE_READSTATE Ar mousedata_t *state
277 These commands are not supported by the
281 .It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
282 The command returns the current state of buttons and
283 movement counts in the structure as defined in
286 .Ss Console and Consolectl Ioctls
287 The user process issues console
289 calls to the current virtual console in order to control
293 also provides a method for the user process to receive a
295 when a button is pressed.
301 calls to the console control device
303 to inform the console of mouse actions including mouse movement
308 commands are defined as
310 which takes the following argument.
315 struct mouse_data data;
316 struct mouse_mode mode;
317 struct mouse_event event;
322 .Bl -tag -width operation -compact
326 .Bl -tag -width MOUSE_MOVEABS -compact
328 Enables and displays mouse cursor.
330 Disables and hides mouse cursor.
332 Moves mouse cursor to position supplied in
335 Adds position supplied in
339 Returns current mouse position in the current virtual console
345 to be delivered to the current process when a button is pressed.
346 The signal to be delivered is set in
350 The above operations are for virtual consoles.
351 The operations defined
352 below are for the console control device and are used by
354 to pass mouse data to the console driver.
356 .Bl -tag -width MOUSE_MOVEABS -compact
358 .It Dv MOUSE_MOTIONEVENT
359 These operations take the information in
361 and act upon it. 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_BUTTONEVENT
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_MOTIONEVENT
378 .Dv MOUSE_BUTTONEVENT
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
402 represent movement of the mouse along respective directions.
404 tells the state of buttons.
405 It encodes up to 31 buttons in the bit 0 though
406 the bit 30. 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 manual page example first appeared in
469 manual page was written by
470 .An John-Mark Gurney Aq gurney_j@efn.org
472 .An Kazutaka Yokota Aq yokota@FreeBSD.org .