xref: /freebsd/share/man/man4/sysmouse.4 (revision aaf1f16e39da164cd6dfa049b53d61b9c9ed3216)
1e4343c4eSMike Pritchard.\" Copyright (c) 1997
2e4343c4eSMike Pritchard.\"	John-Mark Gurney.  All rights reserved.
3e4343c4eSMike Pritchard.\"
4e4343c4eSMike Pritchard.\" Redistribution and use in source and binary forms, with or without
5e4343c4eSMike Pritchard.\" modification, are permitted provided that the following conditions
6e4343c4eSMike Pritchard.\" are met:
7e4343c4eSMike Pritchard.\" 1. Redistributions of source code must retain the above copyright
8e4343c4eSMike Pritchard.\"    notice, this list of conditions and the following disclaimer.
9e4343c4eSMike Pritchard.\" 2. Redistributions in binary form must reproduce the above copyright
10e4343c4eSMike Pritchard.\"    notice, this list of conditions and the following disclaimer in the
11e4343c4eSMike Pritchard.\"    documentation and/or other materials provided with the distribution.
12e4343c4eSMike Pritchard.\" 3. Neither the name of the author nor the names of any co-contributors
13e4343c4eSMike Pritchard.\"    may be used to endorse or promote products derived from this software
14e4343c4eSMike Pritchard.\"    without specific prior written permission.
15e4343c4eSMike Pritchard.\"
16e4343c4eSMike Pritchard.\" THIS SOFTWARE IS PROVIDED BY John-Mark Gurney AND CONTRIBUTORS ``AS IS'' AND
17e4343c4eSMike Pritchard.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18e4343c4eSMike Pritchard.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19e4343c4eSMike Pritchard.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20e4343c4eSMike Pritchard.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21e4343c4eSMike Pritchard.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22e4343c4eSMike Pritchard.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23e4343c4eSMike Pritchard.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24e4343c4eSMike Pritchard.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25e4343c4eSMike Pritchard.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26e4343c4eSMike Pritchard.\" SUCH DAMAGE.
27e4343c4eSMike Pritchard.\"
28aaf1f16eSPhilippe Charnier.\"	$Id: sysmouse.4,v 1.6 1997/12/07 08:46:56 yokota Exp $
29e4343c4eSMike Pritchard.\"
30369a889cSKazutaka YOKOTA.Dd December 3, 1997
311dcb0e4fSMike Pritchard.Dt SYSMOUSE 4 i386
32369a889cSKazutaka YOKOTA.Os FreeBSD
33e4343c4eSMike Pritchard.Sh NAME
34e4343c4eSMike Pritchard.Nm sysmouse
35369a889cSKazutaka YOKOTA.\" .Nd supplies mouse data from syscons for other applications
36369a889cSKazutaka YOKOTA.Nd virtualized mouse driver
37e4343c4eSMike Pritchard.Sh SYNOPSIS
38369a889cSKazutaka YOKOTA.Fd #include <machine/mouse.h>
39e4343c4eSMike Pritchard.Fd #include <machine/console.h>
40e4343c4eSMike Pritchard.Sh DESCRIPTION
41369a889cSKazutaka YOKOTAThe console driver, in conjunction with the mouse daemon
42369a889cSKazutaka YOKOTA.Xr moused 8 ,
43369a889cSKazutaka YOKOTAsupplies mouse data to the user process in the standardized way via the
44369a889cSKazutaka YOKOTA.Nm
45369a889cSKazutaka YOKOTAdriver.
46369a889cSKazutaka YOKOTAThis arrangement makes it possible for the console and the user process
47369a889cSKazutaka YOKOTA.Pq such as the Tn X\ Window System
48369a889cSKazutaka YOKOTAto share the mouse.
49369a889cSKazutaka YOKOTA.Pp
50369a889cSKazutaka YOKOTAThe user process which wants to utilize mouse operation simply opens
51369a889cSKazutaka YOKOTA.Pa /dev/sysmouse
52369a889cSKazutaka YOKOTAwith a
53369a889cSKazutaka YOKOTA.Xr open 2
54369a889cSKazutaka YOKOTAcall and reads
55369a889cSKazutaka YOKOTAmouse data from the device via
56369a889cSKazutaka YOKOTA.Xr read 2 .
57369a889cSKazutaka YOKOTAMake sure that
58369a889cSKazutaka YOKOTA.Xr moused 8
59369a889cSKazutaka YOKOTAis running, otherwise the user process won't see any data coming from
60369a889cSKazutaka YOKOTAthe mouse.
61369a889cSKazutaka YOKOTA.Pp
62369a889cSKazutaka YOKOTA.Ss Operation Levels
63e4343c4eSMike PritchardThe
64369a889cSKazutaka YOKOTA.Nm
65369a889cSKazutaka YOKOTAdriver has two levels of operation.
66369a889cSKazutaka YOKOTAThe current operation level can be referred to and changed via ioctl calls.
67369a889cSKazutaka YOKOTA.Pp
68369a889cSKazutaka YOKOTAThe level zero, the basic level, is the lowest level at which the driver
69369a889cSKazutaka YOKOTAoffers the basic service to user programs.
70369a889cSKazutaka YOKOTAThe
71369a889cSKazutaka YOKOTA.Nm
72369a889cSKazutaka YOKOTAdriver
73369a889cSKazutaka YOKOTAprovides horizontal and vertical movement of the mouse
74369a889cSKazutaka YOKOTAand state of up to three buttons in the
75369a889cSKazutaka YOKOTA.Tn MouseSystems
76369a889cSKazutaka YOKOTAformat as follows.
77369a889cSKazutaka YOKOTA.Pp
78369a889cSKazutaka YOKOTA.Bl -tag -width Byte_1 -compact
79369a889cSKazutaka YOKOTA.It Byte 1
80369a889cSKazutaka YOKOTA.Bl -tag -width bit_7 -compact
81369a889cSKazutaka YOKOTA.It bit 7
82369a889cSKazutaka YOKOTAAlways one.
83369a889cSKazutaka YOKOTA.It bit 6..3
84369a889cSKazutaka YOKOTAAlways zero.
85369a889cSKazutaka YOKOTA.It bit 2
86369a889cSKazutaka YOKOTALeft button status; cleared if pressed, otherwise set.
87369a889cSKazutaka YOKOTA.It bit 1
88369a889cSKazutaka YOKOTAMiddle button status; cleared if pressed, otherwise set. Always one,
89369a889cSKazutaka YOKOTAif the device does not have the middle button.
90369a889cSKazutaka YOKOTA.It bit 0
91369a889cSKazutaka YOKOTARight button status; cleared if pressed, otherwise set.
92369a889cSKazutaka YOKOTA.El
93369a889cSKazutaka YOKOTA.It Byte 2
94369a889cSKazutaka YOKOTAThe first half of horizontal movement count in two's compliment;
95369a889cSKazutaka YOKOTA-128 through 127.
96369a889cSKazutaka YOKOTA.It Byte 3
97369a889cSKazutaka YOKOTAThe first half of vertical movement count in two's compliment;
98369a889cSKazutaka YOKOTA-128 through 127.
99369a889cSKazutaka YOKOTA.It Byte 4
100369a889cSKazutaka YOKOTAThe second half of the horizontal movement count in two's compliment;
101369a889cSKazutaka YOKOTA-128 through 127. To obtain the full horizontal movement count, add
102369a889cSKazutaka YOKOTAthe byte 2 and 4.
103369a889cSKazutaka YOKOTA.It Byte 5
104369a889cSKazutaka YOKOTAThe second half of the vertical movement count in two's compliment;
105369a889cSKazutaka YOKOTA-128 through 127. To obtain the full vertical movement count, add
106369a889cSKazutaka YOKOTAthe byte 3 and 5.
107369a889cSKazutaka YOKOTA.El
108369a889cSKazutaka YOKOTA.Pp
109369a889cSKazutaka YOKOTAAt the level one, the extended level, mouse data is encoded
110369a889cSKazutaka YOKOTAin the standard format
111369a889cSKazutaka YOKOTA.Dv MOUSE_PROTO_SYSMOUSE
112369a889cSKazutaka YOKOTAas defined in
113369a889cSKazutaka YOKOTA.Xr mouse 4 .
114369a889cSKazutaka YOKOTA.\" .Ss Acceleration
115369a889cSKazutaka YOKOTA.\" The
116369a889cSKazutaka YOKOTA.\" .Nm
117369a889cSKazutaka YOKOTA.\" driver can somewhat `accelerate' the movement of the pointing device.
118369a889cSKazutaka YOKOTA.\" The faster you move the device, the further the pointer
119369a889cSKazutaka YOKOTA.\" travels on the screen.
120369a889cSKazutaka YOKOTA.\" The driver has an internal variable which governs the effect of
121369a889cSKazutaka YOKOTA.\" the acceleration. Its value can be modified via the driver flag
122369a889cSKazutaka YOKOTA.\" or via an ioctl call.
123369a889cSKazutaka YOKOTA.Sh IOCTLS
124369a889cSKazutaka YOKOTAThis section describes two classes of
125369a889cSKazutaka YOKOTA.Xr ioctl 2
126369a889cSKazutaka YOKOTAcommands:
127369a889cSKazutaka YOKOTAcommands for the
128369a889cSKazutaka YOKOTA.Nm
129369a889cSKazutaka YOKOTAdriver itself, and commands for the console and the console control drivers.
130369a889cSKazutaka YOKOTA.Ss Sysmouse Ioctls
131369a889cSKazutaka YOKOTAThere are a few commands for mouse drivers.
132369a889cSKazutaka YOKOTAGeneral description of the commands is given in
133369a889cSKazutaka YOKOTA.Xr mouse 4 .
134369a889cSKazutaka YOKOTAFollowings are the features specific to the
135369a889cSKazutaka YOKOTA.Nm
136369a889cSKazutaka YOKOTAdriver.
137369a889cSKazutaka YOKOTA.Pp
138369a889cSKazutaka YOKOTA.Bl -tag -width MOUSE -compact
139369a889cSKazutaka YOKOTA.It Dv MOUSE_GETLEVEL Ar int *level
140369a889cSKazutaka YOKOTA.It Dv MOUSE_SETLEVEL Ar int *level
141369a889cSKazutaka YOKOTAThese commands manipulate the operation level of the mouse driver.
142369a889cSKazutaka YOKOTA.Pp
143369a889cSKazutaka YOKOTA.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
144369a889cSKazutaka YOKOTAReturns the hardware information of the attached device in the following
145369a889cSKazutaka YOKOTAstructure.  Only the
146369a889cSKazutaka YOKOTA.Dv iftype
147369a889cSKazutaka YOKOTAfield is guaranteed to be filled with the correct value in the current
148369a889cSKazutaka YOKOTAversion of the
149369a889cSKazutaka YOKOTA.Nm
150369a889cSKazutaka YOKOTAdriver.
151369a889cSKazutaka YOKOTA.Bd -literal
152369a889cSKazutaka YOKOTAtypedef struct mousehw {
153369a889cSKazutaka YOKOTA    int buttons;    /* number of buttons */
154369a889cSKazutaka YOKOTA    int iftype;     /* I/F type */
155369a889cSKazutaka YOKOTA    int type;       /* mouse/track ball/pad... */
156369a889cSKazutaka YOKOTA    int model;      /* I/F dependent model ID */
157369a889cSKazutaka YOKOTA    int hwid;       /* I/F dependent hardware ID */
158369a889cSKazutaka YOKOTA} mousehw_t;
159369a889cSKazutaka YOKOTA.Ed
160369a889cSKazutaka YOKOTA.Pp
161369a889cSKazutaka YOKOTAThe
162369a889cSKazutaka YOKOTA.Dv buttons
163369a889cSKazutaka YOKOTAfield holds the number of buttons detected by the driver.
164369a889cSKazutaka YOKOTA.Pp
165369a889cSKazutaka YOKOTAThe
166369a889cSKazutaka YOKOTA.Dv iftype
167369a889cSKazutaka YOKOTAis always
168369a889cSKazutaka YOKOTA.Dv MOUSE_IF_SYSMOUSE.
169369a889cSKazutaka YOKOTA.Pp
170369a889cSKazutaka YOKOTAThe
171369a889cSKazutaka YOKOTA.Dv type
172369a889cSKazutaka YOKOTAtells the device type:
173369a889cSKazutaka YOKOTA.Dv MOUSE_MOUSE ,
174369a889cSKazutaka YOKOTA.Dv MOUSE_TRACKBALL ,
175369a889cSKazutaka YOKOTA.Dv MOUSE_STICK ,
176369a889cSKazutaka YOKOTA.Dv MOUSE_PAD ,
177369a889cSKazutaka YOKOTAor
178369a889cSKazutaka YOKOTA.Dv MOUSE_UNKNOWN .
179369a889cSKazutaka YOKOTA.Pp
180369a889cSKazutaka YOKOTAThe
181369a889cSKazutaka YOKOTA.Dv model
182369a889cSKazutaka YOKOTAis always
183369a889cSKazutaka YOKOTA.Dv MOUSE_MODEL_GENERIC
184369a889cSKazutaka YOKOTAat the operation level 0.
185369a889cSKazutaka YOKOTAIt may be
186369a889cSKazutaka YOKOTA.Dv MOUSE_MODEL_GENERIC
187369a889cSKazutaka YOKOTAor one of
188369a889cSKazutaka YOKOTA.Dv MOUSE_MODEL_XXX
189369a889cSKazutaka YOKOTAconstants at higher operation levels.
190369a889cSKazutaka YOKOTA.Pp
191369a889cSKazutaka YOKOTAThe
192369a889cSKazutaka YOKOTA.Dv hwid
193369a889cSKazutaka YOKOTAis always zero.
194369a889cSKazutaka YOKOTA.Pp
195369a889cSKazutaka YOKOTA.It Dv MOUSE_GETMODE Ar mousemode_t *mode
196369a889cSKazutaka YOKOTAThe command gets the current operation parameters of the mouse
197369a889cSKazutaka YOKOTAdriver.
198369a889cSKazutaka YOKOTA.Bd -literal
199369a889cSKazutaka YOKOTAtypedef struct mousemode {
200369a889cSKazutaka YOKOTA    int protocol;    /* MOUSE_PROTO_XXX */
201369a889cSKazutaka YOKOTA    int rate;        /* report rate (per sec) */
202369a889cSKazutaka YOKOTA    int resolution;  /* MOUSE_RES_XXX, -1 if unknown */
203369a889cSKazutaka YOKOTA    int accelfactor; /* acceleration factor */
204369a889cSKazutaka YOKOTA    int level;       /* driver operation level */
205369a889cSKazutaka YOKOTA    int packetsize;  /* the length of the data packet */
206369a889cSKazutaka YOKOTA    unsigned char syncmask[2]; /* sync. bits */
207369a889cSKazutaka YOKOTA} mousemode_t;
208369a889cSKazutaka YOKOTA.Ed
209369a889cSKazutaka YOKOTA.Pp
210369a889cSKazutaka YOKOTAThe
211369a889cSKazutaka YOKOTA.Dv protocol
212369a889cSKazutaka YOKOTAfield tells the format in which the device status is returned
213369a889cSKazutaka YOKOTAwhen the mouse data is read by the user program.
214369a889cSKazutaka YOKOTAIt is
215369a889cSKazutaka YOKOTA.Dv MOUSE_PROTO_MSC
216369a889cSKazutaka YOKOTAat the operation level zero.
217369a889cSKazutaka YOKOTA.Dv MOUSE_PROTO_SYSMOUSE
218369a889cSKazutaka YOKOTAat the operation level one.
219369a889cSKazutaka YOKOTA.Pp
220369a889cSKazutaka YOKOTAThe
221369a889cSKazutaka YOKOTA.Dv rate
222369a889cSKazutaka YOKOTAis always set to -1.
223369a889cSKazutaka YOKOTA.Pp
224369a889cSKazutaka YOKOTAThe
225369a889cSKazutaka YOKOTA.Dv resolution
226369a889cSKazutaka YOKOTAis always set to -1.
227369a889cSKazutaka YOKOTA.Pp
228369a889cSKazutaka YOKOTAThe
229369a889cSKazutaka YOKOTA.Dv accelfactor
230369a889cSKazutaka YOKOTAis always 0.
231369a889cSKazutaka YOKOTA.Pp
232369a889cSKazutaka YOKOTAThe
233369a889cSKazutaka YOKOTA.Dv packetsize
234369a889cSKazutaka YOKOTAfield specifies the length of the data packet. It depends on the
235369a889cSKazutaka YOKOTAoperation level.
236369a889cSKazutaka YOKOTA.Pp
237369a889cSKazutaka YOKOTA.Bl -tag -width level_0__ -compact
238369a889cSKazutaka YOKOTA.It Em level 0
239369a889cSKazutaka YOKOTA5 bytes
240369a889cSKazutaka YOKOTA.It Em level 1
241369a889cSKazutaka YOKOTA8 bytes
242369a889cSKazutaka YOKOTA.El
243369a889cSKazutaka YOKOTA.Pp
244369a889cSKazutaka YOKOTAThe array
245369a889cSKazutaka YOKOTA.Dv syncmask
246369a889cSKazutaka YOKOTAholds a bit mask and pattern to detect the first byte of the
247369a889cSKazutaka YOKOTAdata packet.
248369a889cSKazutaka YOKOTA.Dv syncmask[0]
249369a889cSKazutaka YOKOTAis the bit mask to be ANDed with a byte. If the result is equal to
250369a889cSKazutaka YOKOTA.Dv syncmask[1] ,
251369a889cSKazutaka YOKOTAthe byte is likely to be the first byte of the data packet.
252369a889cSKazutaka YOKOTANote that this method of detecting the first byte is not 100% reliable,
253369a889cSKazutaka YOKOTAthus, should be taken only as an advisory measure.
254369a889cSKazutaka YOKOTA.Pp
255369a889cSKazutaka YOKOTA.It Dv MOUSE_SETMODE Ar mousemode_t *mode
256369a889cSKazutaka YOKOTAThe command changes the current operation parameters of the mouse driver
257369a889cSKazutaka YOKOTAas specified in
258369a889cSKazutaka YOKOTA.Ar mode .
259369a889cSKazutaka YOKOTAOnly
260369a889cSKazutaka YOKOTA.Dv level
261369a889cSKazutaka YOKOTAmay be modifiable. Setting values in the other field does not generate
262369a889cSKazutaka YOKOTAerror and has no effect.
263369a889cSKazutaka YOKOTA.\" .Pp
264369a889cSKazutaka YOKOTA.\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
265369a889cSKazutaka YOKOTA.\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
266369a889cSKazutaka YOKOTA.\" These commands are not supported by the
267369a889cSKazutaka YOKOTA.\" .Nm
268369a889cSKazutaka YOKOTA.\" driver.
269369a889cSKazutaka YOKOTA.Pp
270369a889cSKazutaka YOKOTA.It Dv MOUSE_READDATA Ar mousedata_t *data
271369a889cSKazutaka YOKOTA.It Dv MOUSE_READSTATE Ar mousedata_t *state
272369a889cSKazutaka YOKOTAThese commands are not supported by the
273369a889cSKazutaka YOKOTA.Nm
274369a889cSKazutaka YOKOTAdriver.
275369a889cSKazutaka YOKOTA.Pp
276369a889cSKazutaka YOKOTA.It Dv MOUSE_GETSTATE Ar mousestatus_t *status
277369a889cSKazutaka YOKOTAThe command returns the current state of buttons and
278369a889cSKazutaka YOKOTAmovement counts in the structure as defined in
279369a889cSKazutaka YOKOTA.Xr mouse 4 .
280369a889cSKazutaka YOKOTA.El
281369a889cSKazutaka YOKOTA.Ss Console and Consolectl Ioctls
282369a889cSKazutaka YOKOTAThe user process issues console
283e4343c4eSMike Pritchard.Fn ioctl
284369a889cSKazutaka YOKOTAcalls to the current virtual console in order to control
285369a889cSKazutaka YOKOTAthe mouse pointer.
286369a889cSKazutaka YOKOTAThe console
287e4343c4eSMike Pritchard.Fn ioctl
288369a889cSKazutaka YOKOTAalso provides a method for the user process to receive a
289e4343c4eSMike Pritchard.Xr signal 3
290e4343c4eSMike Pritchardwhen a button is pressed.
291e4343c4eSMike Pritchard.Pp
292369a889cSKazutaka YOKOTAThe mouse daemon
293e4343c4eSMike Pritchard.Xr moused 8
294369a889cSKazutaka YOKOTAuses
295e4343c4eSMike Pritchard.Fn ioctl
296369a889cSKazutaka YOKOTAcalls to the console control device
297369a889cSKazutaka YOKOTA.Pa /dev/consolectl
298369a889cSKazutaka YOKOTAto inform the console of mouse actions including mouse movement
299369a889cSKazutaka YOKOTAand button status.
300e4343c4eSMike Pritchard.Pp
301369a889cSKazutaka YOKOTABoth classes
302369a889cSKazutaka YOKOTA.Fn ioctl
303369a889cSKazutaka YOKOTAcommands are defined as
304369a889cSKazutaka YOKOTA.Dv CONS_MOUSECTL
305369a889cSKazutaka YOKOTAwhich takes the following argument.
306369a889cSKazutaka YOKOTA.Bd -literal
307e4343c4eSMike Pritchardstruct mouse_info {
308e4343c4eSMike Pritchard    int operation;
309e4343c4eSMike Pritchard    union {
310e4343c4eSMike Pritchard        struct mouse_data data;
311e4343c4eSMike Pritchard        struct mouse_mode mode;
312369a889cSKazutaka YOKOTA        struct mouse_event event;
313e4343c4eSMike Pritchard    } u;
314e4343c4eSMike Pritchard};
315e4343c4eSMike Pritchard.Ed
316369a889cSKazutaka YOKOTA.Pp
317369a889cSKazutaka YOKOTA.Bl -tag -width operation -compact
318e4343c4eSMike Pritchard.It Dv operation
319e4343c4eSMike PritchardThis can be one of
320369a889cSKazutaka YOKOTA.Pp
321369a889cSKazutaka YOKOTA.Bl -tag -width MOUSE_MOVEABS -compact
322e4343c4eSMike Pritchard.It Dv MOUSE_SHOW
323e4343c4eSMike PritchardEnables and displays mouse cursor.
324e4343c4eSMike Pritchard.It Dv MOUSE_HIDE
325e4343c4eSMike PritchardDisables and hides mouse cursor.
326e4343c4eSMike Pritchard.It Dv MOUSE_MOVEABS
327e4343c4eSMike PritchardMoves mouse cursor to position supplied in
328e4343c4eSMike Pritchard.Dv u.data .
329e4343c4eSMike Pritchard.It Dv MOUSE_MOVEREL
330369a889cSKazutaka YOKOTAAdds position supplied in
331e4343c4eSMike Pritchard.Dv u.data
332e4343c4eSMike Pritchardto current position.
333e4343c4eSMike Pritchard.It Dv MOUSE_GETINFO
334369a889cSKazutaka YOKOTAReturns current mouse position in the current virtual console
335369a889cSKazutaka YOKOTAand button status in
336e4343c4eSMike Pritchard.Dv u.data .
337e4343c4eSMike Pritchard.It Dv MOUSE_MODE
338e4343c4eSMike PritchardThis sets the
339e4343c4eSMike Pritchard.Xr signal 3
340e4343c4eSMike Pritchardto be delivered to the current process when a button is pressed.
341e4343c4eSMike PritchardThe signal to be delivered is set in
342e4343c4eSMike Pritchard.Dv u.mode .
343e4343c4eSMike Pritchard.El
344369a889cSKazutaka YOKOTA.Pp
345369a889cSKazutaka YOKOTAThe above operations are for virtual consoles. The operations defined
346369a889cSKazutaka YOKOTAbelow are for the console control device and used by
347369a889cSKazutaka YOKOTA.Xr moused 8
348369a889cSKazutaka YOKOTAto pass mouse data to the console driver.
349369a889cSKazutaka YOKOTA.Pp
350369a889cSKazutaka YOKOTA.Bl -tag -width MOUSE_MOVEABS -compact
351369a889cSKazutaka YOKOTA.It Dv MOUSE_ACTION
352369a889cSKazutaka YOKOTA.It Dv MOUSE_MOTIONEVENT
353369a889cSKazutaka YOKOTAThese operations take the information in
354369a889cSKazutaka YOKOTA.Dv u.data
355369a889cSKazutaka YOKOTAand act upon it.  Mouse data will be sent to the
356369a889cSKazutaka YOKOTA.Nm
357369a889cSKazutaka YOKOTAdriver if it is open.
358369a889cSKazutaka YOKOTA.Dv MOUSE_ACTION
359369a889cSKazutaka YOKOTAalso processes button press actions and sends signal to the process if
360369a889cSKazutaka YOKOTArequested or performs cut and paste operations
361369a889cSKazutaka YOKOTAif the current console is a text interface.
362369a889cSKazutaka YOKOTA.It Dv MOUSE_BUTTONEVENT
363369a889cSKazutaka YOKOTA.Dv u.data
364369a889cSKazutaka YOKOTAspecifies a button and its click count. The console driver will
365369a889cSKazutaka YOKOTAuse this information for signal delivery if requested or
366369a889cSKazutaka YOKOTAfor cut and paste operations if the console is in text mode.
367369a889cSKazutaka YOKOTA.El
368369a889cSKazutaka YOKOTA.Pp
369369a889cSKazutaka YOKOTA.Dv MOUSE_MOTIONEVENT
370369a889cSKazutaka YOKOTAand
371369a889cSKazutaka YOKOTA.Dv MOUSE_BUTTONEVENT
372369a889cSKazutaka YOKOTAare newer interface and are designed to be used together.
373369a889cSKazutaka YOKOTAThey are intended to replace functions performed by
374369a889cSKazutaka YOKOTA.Dv MOUSE_ACTION
375369a889cSKazutaka YOKOTAalone.
376369a889cSKazutaka YOKOTA.Pp
377e4343c4eSMike Pritchard.It Dv u
378e4343c4eSMike PritchardThis union is one of
379369a889cSKazutaka YOKOTA.Pp
380369a889cSKazutaka YOKOTA.Bl -tag -width data -compact
381e4343c4eSMike Pritchard.It Dv data
382369a889cSKazutaka YOKOTA.Bd -literal
383e4343c4eSMike Pritchardstruct mouse_data {
384e4343c4eSMike Pritchard    int x;
385e4343c4eSMike Pritchard    int y;
386369a889cSKazutaka YOKOTA    int z;
387e4343c4eSMike Pritchard    int buttons;
388e4343c4eSMike Pritchard};
389e4343c4eSMike Pritchard.Ed
390369a889cSKazutaka YOKOTA.Pp
391369a889cSKazutaka YOKOTA.Dv x ,
392369a889cSKazutaka YOKOTA.Dv y
393369a889cSKazutaka YOKOTAand
394369a889cSKazutaka YOKOTA.Dv z
395369a889cSKazutaka YOKOTArepresent movement of the mouse along respective directions.
396369a889cSKazutaka YOKOTA.Dv buttons
397369a889cSKazutaka YOKOTAtells the state of buttons. It encodes up to 31 buttons in the bit 0 though
398369a889cSKazutaka YOKOTAthe bit 30.  If a button is held down, the corresponding bit is set.
399369a889cSKazutaka YOKOTA.Pp
400e4343c4eSMike Pritchard.It Dv mode
401369a889cSKazutaka YOKOTA.Bd -literal
402e4343c4eSMike Pritchardstruct mouse_mode {
403e4343c4eSMike Pritchard    int mode;
404e4343c4eSMike Pritchard    int signal;
405e4343c4eSMike Pritchard};
406e4343c4eSMike Pritchard.Ed
407369a889cSKazutaka YOKOTA.Pp
408369a889cSKazutaka YOKOTAThe
409369a889cSKazutaka YOKOTA.Dv signal
410369a889cSKazutaka YOKOTAfield specifies the signal to be delivered to the process. It must be
411369a889cSKazutaka YOKOTAone of the values defined in
412369a889cSKazutaka YOKOTA.Ao Pa signal.h Ac .
413369a889cSKazutaka YOKOTAThe
414369a889cSKazutaka YOKOTA.Dv mode
415369a889cSKazutaka YOKOTAfield is currently unused.
416369a889cSKazutaka YOKOTA.Pp
417369a889cSKazutaka YOKOTA.It Dv event
418369a889cSKazutaka YOKOTA.Bd -literal
419369a889cSKazutaka YOKOTAstruct mouse_event {
420369a889cSKazutaka YOKOTA    int id;
421369a889cSKazutaka YOKOTA    int value;
422369a889cSKazutaka YOKOTA};
423369a889cSKazutaka YOKOTA.Ed
424369a889cSKazutaka YOKOTA.Pp
425369a889cSKazutaka YOKOTAThe
426369a889cSKazutaka YOKOTA.Dv id
427369a889cSKazutaka YOKOTAfield specifies a button number as in
428369a889cSKazutaka YOKOTA.Dv u.data.buttons .
429369a889cSKazutaka YOKOTAOnly one bit/button is set.
430369a889cSKazutaka YOKOTAThe
431369a889cSKazutaka YOKOTA.Dv value
432369a889cSKazutaka YOKOTAfield
433369a889cSKazutaka YOKOTAholds the click count: the number of times the user has clicked the button
434369a889cSKazutaka YOKOTAsuccessively.
435369a889cSKazutaka YOKOTA.Pp
436e4343c4eSMike Pritchard.El
437e4343c4eSMike Pritchard.El
438e4343c4eSMike Pritchard.Sh FILES
439e4343c4eSMike Pritchard.Bl -tag -width /dev/consolectl -compact
440e4343c4eSMike Pritchard.It Pa /dev/consolectl
441e4343c4eSMike Pritcharddevice to control the console
442e4343c4eSMike Pritchard.It Pa /dev/sysmouse
443369a889cSKazutaka YOKOTAvirtualized mouse driver
444369a889cSKazutaka YOKOTA.It Pa /dev/ttyv%d
445369a889cSKazutaka YOKOTAvirtual consoles
446e4343c4eSMike Pritchard.El
447e4343c4eSMike Pritchard.Sh SEE ALSO
448e4343c4eSMike Pritchard.Xr vidcontrol 1 ,
449369a889cSKazutaka YOKOTA.Xr ioctl 2 ,
450e4343c4eSMike Pritchard.Xr signal 3 ,
451369a889cSKazutaka YOKOTA.Xr mouse 4 ,
452e4343c4eSMike Pritchard.Xr moused 8
453e4343c4eSMike Pritchard.Sh HISTORY
454e4343c4eSMike PritchardThe
455e4343c4eSMike Pritchard.Nm
456e4343c4eSMike Pritchardmanual page example first appeared in
4572c8478e1SJohn-Mark Gurney.Fx 2.2 .
458aaf1f16eSPhilippe Charnier.Sh AUTHORS
459e4343c4eSMike PritchardThis
460369a889cSKazutaka YOKOTAmanual page was written by
461369a889cSKazutaka YOKOTA.An John-Mark Gurney Aq gurney_j@efn.org
462369a889cSKazutaka YOKOTAand
463aaf1f16eSPhilippe Charnier.An Kazutaka Yokota Aq yokota@FreeBSD.org .
464