xref: /freebsd/share/man/man4/sysmouse.4 (revision 66b23135f82c138598f53b21f3a044b8b81cc733)
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.\"
287f3dea24SPeter Wemm.\" $FreeBSD$
29e4343c4eSMike Pritchard.\"
3086c18b36SGavin Atkinson.Dd January 16, 2010
31474fc32bSAlexey Zelkin.Dt SYSMOUSE 4
323d45e180SRuslan Ermilov.Os
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
3832eef9aeSRuslan Ermilov.In sys/mouse.h
3932eef9aeSRuslan Ermilov.In sys/consio.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
47c4d9468eSRuslan Ermilov(such as the
48c4d9468eSRuslan Ermilov.Tn X\ Window System )
49369a889cSKazutaka YOKOTAto share the mouse.
50369a889cSKazutaka YOKOTA.Pp
51369a889cSKazutaka YOKOTAThe user process which wants to utilize mouse operation simply opens
52369a889cSKazutaka YOKOTA.Pa /dev/sysmouse
53369a889cSKazutaka YOKOTAwith a
54369a889cSKazutaka YOKOTA.Xr open 2
55369a889cSKazutaka YOKOTAcall and reads
56369a889cSKazutaka YOKOTAmouse data from the device via
57369a889cSKazutaka YOKOTA.Xr read 2 .
58369a889cSKazutaka YOKOTAMake sure that
59369a889cSKazutaka YOKOTA.Xr moused 8
600227791bSRuslan Ermilovis running, otherwise the user process will not see any data coming from
61369a889cSKazutaka YOKOTAthe mouse.
62369a889cSKazutaka YOKOTA.Pp
63369a889cSKazutaka YOKOTA.Ss Operation Levels
64e4343c4eSMike PritchardThe
65369a889cSKazutaka YOKOTA.Nm
66369a889cSKazutaka YOKOTAdriver has two levels of operation.
67369a889cSKazutaka YOKOTAThe current operation level can be referred to and changed via ioctl calls.
68369a889cSKazutaka YOKOTA.Pp
69369a889cSKazutaka YOKOTAThe level zero, the basic level, is the lowest level at which the driver
70369a889cSKazutaka YOKOTAoffers the basic service to user programs.
71369a889cSKazutaka YOKOTAThe
72369a889cSKazutaka YOKOTA.Nm
73369a889cSKazutaka YOKOTAdriver
74369a889cSKazutaka YOKOTAprovides horizontal and vertical movement of the mouse
75369a889cSKazutaka YOKOTAand state of up to three buttons in the
76369a889cSKazutaka YOKOTA.Tn MouseSystems
77369a889cSKazutaka YOKOTAformat as follows.
78369a889cSKazutaka YOKOTA.Pp
79369a889cSKazutaka YOKOTA.Bl -tag -width Byte_1 -compact
80369a889cSKazutaka YOKOTA.It Byte 1
81369a889cSKazutaka YOKOTA.Bl -tag -width bit_7 -compact
82369a889cSKazutaka YOKOTA.It bit 7
83369a889cSKazutaka YOKOTAAlways one.
84369a889cSKazutaka YOKOTA.It bit 6..3
85369a889cSKazutaka YOKOTAAlways zero.
86369a889cSKazutaka YOKOTA.It bit 2
87369a889cSKazutaka YOKOTALeft button status; cleared if pressed, otherwise set.
88369a889cSKazutaka YOKOTA.It bit 1
896d249eeeSSheldon HearnMiddle button status; cleared if pressed, otherwise set.
906d249eeeSSheldon HearnAlways one,
91369a889cSKazutaka YOKOTAif the device does not have the middle button.
92369a889cSKazutaka YOKOTA.It bit 0
93369a889cSKazutaka YOKOTARight button status; cleared if pressed, otherwise set.
94369a889cSKazutaka YOKOTA.El
95369a889cSKazutaka YOKOTA.It Byte 2
96f227cbfbSChris CostelloThe first half of horizontal movement count in two's complement;
9766b23135SUlrich Spörlein\-128 through 127.
98369a889cSKazutaka YOKOTA.It Byte 3
99f227cbfbSChris CostelloThe first half of vertical movement count in two's complement;
10066b23135SUlrich Spörlein\-128 through 127.
101369a889cSKazutaka YOKOTA.It Byte 4
102f227cbfbSChris CostelloThe second half of the horizontal movement count in two's complement;
10366b23135SUlrich Spörlein\-128 through 127.
1045203edcdSRuslan ErmilovTo obtain the full horizontal movement count, add
105369a889cSKazutaka YOKOTAthe byte 2 and 4.
106369a889cSKazutaka YOKOTA.It Byte 5
107f227cbfbSChris CostelloThe second half of the vertical movement count in two's complement;
10866b23135SUlrich Spörlein\-128 through 127.
1095203edcdSRuslan ErmilovTo obtain the full vertical movement count, add
110369a889cSKazutaka YOKOTAthe byte 3 and 5.
111369a889cSKazutaka YOKOTA.El
112369a889cSKazutaka YOKOTA.Pp
113369a889cSKazutaka YOKOTAAt the level one, the extended level, mouse data is encoded
114369a889cSKazutaka YOKOTAin the standard format
115369a889cSKazutaka YOKOTA.Dv MOUSE_PROTO_SYSMOUSE
116369a889cSKazutaka YOKOTAas defined in
117369a889cSKazutaka YOKOTA.Xr mouse 4 .
118369a889cSKazutaka YOKOTA.\" .Ss Acceleration
119369a889cSKazutaka YOKOTA.\" The
120369a889cSKazutaka YOKOTA.\" .Nm
121369a889cSKazutaka YOKOTA.\" driver can somewhat `accelerate' the movement of the pointing device.
122369a889cSKazutaka YOKOTA.\" The faster you move the device, the further the pointer
123369a889cSKazutaka YOKOTA.\" travels on the screen.
124369a889cSKazutaka YOKOTA.\" The driver has an internal variable which governs the effect of
125369a889cSKazutaka YOKOTA.\" the acceleration. Its value can be modified via the driver flag
126369a889cSKazutaka YOKOTA.\" or via an ioctl call.
127369a889cSKazutaka YOKOTA.Sh IOCTLS
128369a889cSKazutaka YOKOTAThis section describes two classes of
129369a889cSKazutaka YOKOTA.Xr ioctl 2
130369a889cSKazutaka YOKOTAcommands:
131369a889cSKazutaka YOKOTAcommands for the
132369a889cSKazutaka YOKOTA.Nm
133369a889cSKazutaka YOKOTAdriver itself, and commands for the console and the console control drivers.
134369a889cSKazutaka YOKOTA.Ss Sysmouse Ioctls
135369a889cSKazutaka YOKOTAThere are a few commands for mouse drivers.
136369a889cSKazutaka YOKOTAGeneral description of the commands is given in
137369a889cSKazutaka YOKOTA.Xr mouse 4 .
1387f9d55b4STim VanderhoekFollowing are the features specific to the
139369a889cSKazutaka YOKOTA.Nm
140369a889cSKazutaka YOKOTAdriver.
141369a889cSKazutaka YOKOTA.Pp
142369a889cSKazutaka YOKOTA.Bl -tag -width MOUSE -compact
143369a889cSKazutaka YOKOTA.It Dv MOUSE_GETLEVEL Ar int *level
144369a889cSKazutaka YOKOTA.It Dv MOUSE_SETLEVEL Ar int *level
145369a889cSKazutaka YOKOTAThese commands manipulate the operation level of the mouse driver.
146369a889cSKazutaka YOKOTA.Pp
147369a889cSKazutaka YOKOTA.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
148369a889cSKazutaka YOKOTAReturns the hardware information of the attached device in the following
149b5e7e999SRuslan Ermilovstructure.
150b5e7e999SRuslan ErmilovOnly the
15166b23135SUlrich Spörlein.Va iftype
152369a889cSKazutaka YOKOTAfield is guaranteed to be filled with the correct value in the current
153369a889cSKazutaka YOKOTAversion of the
154369a889cSKazutaka YOKOTA.Nm
155369a889cSKazutaka YOKOTAdriver.
156369a889cSKazutaka YOKOTA.Bd -literal
157369a889cSKazutaka YOKOTAtypedef struct mousehw {
158369a889cSKazutaka YOKOTA    int buttons;    /* number of buttons */
159369a889cSKazutaka YOKOTA    int iftype;     /* I/F type */
160369a889cSKazutaka YOKOTA    int type;       /* mouse/track ball/pad... */
161369a889cSKazutaka YOKOTA    int model;      /* I/F dependent model ID */
162369a889cSKazutaka YOKOTA    int hwid;       /* I/F dependent hardware ID */
163369a889cSKazutaka YOKOTA} mousehw_t;
164369a889cSKazutaka YOKOTA.Ed
165369a889cSKazutaka YOKOTA.Pp
166369a889cSKazutaka YOKOTAThe
16766b23135SUlrich Spörlein.Va buttons
168369a889cSKazutaka YOKOTAfield holds the number of buttons detected by the driver.
169369a889cSKazutaka YOKOTA.Pp
170369a889cSKazutaka YOKOTAThe
17166b23135SUlrich Spörlein.Va iftype
172369a889cSKazutaka YOKOTAis always
173369a889cSKazutaka YOKOTA.Dv MOUSE_IF_SYSMOUSE .
174369a889cSKazutaka YOKOTA.Pp
175369a889cSKazutaka YOKOTAThe
17666b23135SUlrich Spörlein.Va type
177369a889cSKazutaka YOKOTAtells the device type:
178369a889cSKazutaka YOKOTA.Dv MOUSE_MOUSE ,
179369a889cSKazutaka YOKOTA.Dv MOUSE_TRACKBALL ,
180369a889cSKazutaka YOKOTA.Dv MOUSE_STICK ,
181369a889cSKazutaka YOKOTA.Dv MOUSE_PAD ,
182369a889cSKazutaka YOKOTAor
183369a889cSKazutaka YOKOTA.Dv MOUSE_UNKNOWN .
184369a889cSKazutaka YOKOTA.Pp
185369a889cSKazutaka YOKOTAThe
18666b23135SUlrich Spörlein.Va model
187369a889cSKazutaka YOKOTAis always
188369a889cSKazutaka YOKOTA.Dv MOUSE_MODEL_GENERIC
189369a889cSKazutaka YOKOTAat the operation level 0.
190369a889cSKazutaka YOKOTAIt may be
191369a889cSKazutaka YOKOTA.Dv MOUSE_MODEL_GENERIC
192369a889cSKazutaka YOKOTAor one of
193369a889cSKazutaka YOKOTA.Dv MOUSE_MODEL_XXX
194369a889cSKazutaka YOKOTAconstants at higher operation levels.
195369a889cSKazutaka YOKOTA.Pp
196369a889cSKazutaka YOKOTAThe
19766b23135SUlrich Spörlein.Va hwid
198369a889cSKazutaka YOKOTAis always zero.
199369a889cSKazutaka YOKOTA.Pp
200369a889cSKazutaka YOKOTA.It Dv MOUSE_GETMODE Ar mousemode_t *mode
201369a889cSKazutaka YOKOTAThe command gets the current operation parameters of the mouse
202369a889cSKazutaka YOKOTAdriver.
203369a889cSKazutaka YOKOTA.Bd -literal
204369a889cSKazutaka YOKOTAtypedef struct mousemode {
205369a889cSKazutaka YOKOTA    int protocol;    /* MOUSE_PROTO_XXX */
206369a889cSKazutaka YOKOTA    int rate;        /* report rate (per sec) */
207369a889cSKazutaka YOKOTA    int resolution;  /* MOUSE_RES_XXX, -1 if unknown */
208369a889cSKazutaka YOKOTA    int accelfactor; /* acceleration factor */
209369a889cSKazutaka YOKOTA    int level;       /* driver operation level */
210369a889cSKazutaka YOKOTA    int packetsize;  /* the length of the data packet */
211369a889cSKazutaka YOKOTA    unsigned char syncmask[2]; /* sync. bits */
212369a889cSKazutaka YOKOTA} mousemode_t;
213369a889cSKazutaka YOKOTA.Ed
214369a889cSKazutaka YOKOTA.Pp
215369a889cSKazutaka YOKOTAThe
21666b23135SUlrich Spörlein.Va protocol
217369a889cSKazutaka YOKOTAfield tells the format in which the device status is returned
218369a889cSKazutaka YOKOTAwhen the mouse data is read by the user program.
219369a889cSKazutaka YOKOTAIt is
220369a889cSKazutaka YOKOTA.Dv MOUSE_PROTO_MSC
221369a889cSKazutaka YOKOTAat the operation level zero.
222369a889cSKazutaka YOKOTA.Dv MOUSE_PROTO_SYSMOUSE
223369a889cSKazutaka YOKOTAat the operation level one.
224369a889cSKazutaka YOKOTA.Pp
225369a889cSKazutaka YOKOTAThe
22666b23135SUlrich Spörlein.Va rate
22766b23135SUlrich Spörleinis always set to \-1.
228369a889cSKazutaka YOKOTA.Pp
229369a889cSKazutaka YOKOTAThe
23066b23135SUlrich Spörlein.Va resolution
23166b23135SUlrich Spörleinis always set to \-1.
232369a889cSKazutaka YOKOTA.Pp
233369a889cSKazutaka YOKOTAThe
23466b23135SUlrich Spörlein.Va accelfactor
235369a889cSKazutaka YOKOTAis always 0.
236369a889cSKazutaka YOKOTA.Pp
237369a889cSKazutaka YOKOTAThe
23866b23135SUlrich Spörlein.Va packetsize
2396d249eeeSSheldon Hearnfield specifies the length of the data packet.
2406d249eeeSSheldon HearnIt depends on the
241369a889cSKazutaka YOKOTAoperation level.
242369a889cSKazutaka YOKOTA.Pp
243369a889cSKazutaka YOKOTA.Bl -tag -width level_0__ -compact
244369a889cSKazutaka YOKOTA.It Em level 0
245369a889cSKazutaka YOKOTA5 bytes
246369a889cSKazutaka YOKOTA.It Em level 1
247369a889cSKazutaka YOKOTA8 bytes
248369a889cSKazutaka YOKOTA.El
249369a889cSKazutaka YOKOTA.Pp
250369a889cSKazutaka YOKOTAThe array
25166b23135SUlrich Spörlein.Va syncmask
252369a889cSKazutaka YOKOTAholds a bit mask and pattern to detect the first byte of the
253369a889cSKazutaka YOKOTAdata packet.
25466b23135SUlrich Spörlein.Va syncmask[0]
2556d249eeeSSheldon Hearnis the bit mask to be ANDed with a byte.
2566d249eeeSSheldon HearnIf the result is equal to
25766b23135SUlrich Spörlein.Va syncmask[1] ,
258369a889cSKazutaka YOKOTAthe byte is likely to be the first byte of the data packet.
2597f9d55b4STim VanderhoekNote that this method of detecting the first byte is not 100% reliable;
2607f9d55b4STim Vanderhoekthus, it should be taken only as an advisory measure.
261369a889cSKazutaka YOKOTA.Pp
262369a889cSKazutaka YOKOTA.It Dv MOUSE_SETMODE Ar mousemode_t *mode
263369a889cSKazutaka YOKOTAThe command changes the current operation parameters of the mouse driver
264369a889cSKazutaka YOKOTAas specified in
265369a889cSKazutaka YOKOTA.Ar mode .
266369a889cSKazutaka YOKOTAOnly
26766b23135SUlrich Spörlein.Va level
2686d249eeeSSheldon Hearnmay be modifiable.
2696d249eeeSSheldon HearnSetting values in the other field does not generate
270369a889cSKazutaka YOKOTAerror and has no effect.
271369a889cSKazutaka YOKOTA.\" .Pp
272369a889cSKazutaka YOKOTA.\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
273369a889cSKazutaka YOKOTA.\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
274369a889cSKazutaka YOKOTA.\" These commands are not supported by the
275369a889cSKazutaka YOKOTA.\" .Nm
276369a889cSKazutaka YOKOTA.\" driver.
277369a889cSKazutaka YOKOTA.Pp
278369a889cSKazutaka YOKOTA.It Dv MOUSE_READDATA Ar mousedata_t *data
279369a889cSKazutaka YOKOTA.It Dv MOUSE_READSTATE Ar mousedata_t *state
280369a889cSKazutaka YOKOTAThese commands are not supported by the
281369a889cSKazutaka YOKOTA.Nm
282369a889cSKazutaka YOKOTAdriver.
283369a889cSKazutaka YOKOTA.Pp
28433099659SKazutaka YOKOTA.It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
285369a889cSKazutaka YOKOTAThe command returns the current state of buttons and
286369a889cSKazutaka YOKOTAmovement counts in the structure as defined in
287369a889cSKazutaka YOKOTA.Xr mouse 4 .
288369a889cSKazutaka YOKOTA.El
289369a889cSKazutaka YOKOTA.Ss Console and Consolectl Ioctls
290369a889cSKazutaka YOKOTAThe user process issues console
291e4343c4eSMike Pritchard.Fn ioctl
292369a889cSKazutaka YOKOTAcalls to the current virtual console in order to control
293369a889cSKazutaka YOKOTAthe mouse pointer.
294369a889cSKazutaka YOKOTAThe console
295e4343c4eSMike Pritchard.Fn ioctl
296369a889cSKazutaka YOKOTAalso provides a method for the user process to receive a
297e4343c4eSMike Pritchard.Xr signal 3
298e4343c4eSMike Pritchardwhen a button is pressed.
299e4343c4eSMike Pritchard.Pp
300369a889cSKazutaka YOKOTAThe mouse daemon
301e4343c4eSMike Pritchard.Xr moused 8
302369a889cSKazutaka YOKOTAuses
303e4343c4eSMike Pritchard.Fn ioctl
304369a889cSKazutaka YOKOTAcalls to the console control device
305369a889cSKazutaka YOKOTA.Pa /dev/consolectl
306369a889cSKazutaka YOKOTAto inform the console of mouse actions including mouse movement
307369a889cSKazutaka YOKOTAand button status.
308e4343c4eSMike Pritchard.Pp
3097f9d55b4STim VanderhoekBoth classes of
310369a889cSKazutaka YOKOTA.Fn ioctl
311369a889cSKazutaka YOKOTAcommands are defined as
312369a889cSKazutaka YOKOTA.Dv CONS_MOUSECTL
313369a889cSKazutaka YOKOTAwhich takes the following argument.
314369a889cSKazutaka YOKOTA.Bd -literal
315e4343c4eSMike Pritchardstruct mouse_info {
316e4343c4eSMike Pritchard    int operation;
317e4343c4eSMike Pritchard    union {
318e4343c4eSMike Pritchard        struct mouse_data data;
319e4343c4eSMike Pritchard        struct mouse_mode mode;
320369a889cSKazutaka YOKOTA        struct mouse_event event;
321e4343c4eSMike Pritchard    } u;
322e4343c4eSMike Pritchard};
323e4343c4eSMike Pritchard.Ed
324369a889cSKazutaka YOKOTA.Pp
325369a889cSKazutaka YOKOTA.Bl -tag -width operation -compact
32666b23135SUlrich Spörlein.It Va operation
327e4343c4eSMike PritchardThis can be one of
328369a889cSKazutaka YOKOTA.Pp
329369a889cSKazutaka YOKOTA.Bl -tag -width MOUSE_MOVEABS -compact
330e4343c4eSMike Pritchard.It Dv MOUSE_SHOW
331e4343c4eSMike PritchardEnables and displays mouse cursor.
332e4343c4eSMike Pritchard.It Dv MOUSE_HIDE
333e4343c4eSMike PritchardDisables and hides mouse cursor.
334e4343c4eSMike Pritchard.It Dv MOUSE_MOVEABS
335e4343c4eSMike PritchardMoves mouse cursor to position supplied in
33666b23135SUlrich Spörlein.Va u.data .
337e4343c4eSMike Pritchard.It Dv MOUSE_MOVEREL
338369a889cSKazutaka YOKOTAAdds position supplied in
33966b23135SUlrich Spörlein.Va u.data
340e4343c4eSMike Pritchardto current position.
341e4343c4eSMike Pritchard.It Dv MOUSE_GETINFO
342369a889cSKazutaka YOKOTAReturns current mouse position in the current virtual console
343369a889cSKazutaka YOKOTAand button status in
34466b23135SUlrich Spörlein.Va u.data .
345e4343c4eSMike Pritchard.It Dv MOUSE_MODE
346e4343c4eSMike PritchardThis sets the
347e4343c4eSMike Pritchard.Xr signal 3
348e4343c4eSMike Pritchardto be delivered to the current process when a button is pressed.
349e4343c4eSMike PritchardThe signal to be delivered is set in
35066b23135SUlrich Spörlein.Va u.mode .
351e4343c4eSMike Pritchard.El
352369a889cSKazutaka YOKOTA.Pp
3536d249eeeSSheldon HearnThe above operations are for virtual consoles.
3546d249eeeSSheldon HearnThe operations defined
3557f9d55b4STim Vanderhoekbelow are for the console control device and are used by
356369a889cSKazutaka YOKOTA.Xr moused 8
357369a889cSKazutaka YOKOTAto pass mouse data to the console driver.
358369a889cSKazutaka YOKOTA.Pp
359369a889cSKazutaka YOKOTA.Bl -tag -width MOUSE_MOVEABS -compact
360369a889cSKazutaka YOKOTA.It Dv MOUSE_ACTION
36106a9897cSMarkus Brueffer.It Dv MOUSE_MOTION_EVENT
362369a889cSKazutaka YOKOTAThese operations take the information in
36366b23135SUlrich Spörlein.Va u.data
364b5e7e999SRuslan Ermilovand act upon it.
365b5e7e999SRuslan ErmilovMouse data will be sent to the
366369a889cSKazutaka YOKOTA.Nm
367369a889cSKazutaka YOKOTAdriver if it is open.
368369a889cSKazutaka YOKOTA.Dv MOUSE_ACTION
369369a889cSKazutaka YOKOTAalso processes button press actions and sends signal to the process if
370369a889cSKazutaka YOKOTArequested or performs cut and paste operations
371369a889cSKazutaka YOKOTAif the current console is a text interface.
37206a9897cSMarkus Brueffer.It Dv MOUSE_BUTTON_EVENT
37366b23135SUlrich Spörlein.Va u.data
3746d249eeeSSheldon Hearnspecifies a button and its click count.
3756d249eeeSSheldon HearnThe console driver will
376369a889cSKazutaka YOKOTAuse this information for signal delivery if requested or
377369a889cSKazutaka YOKOTAfor cut and paste operations if the console is in text mode.
378369a889cSKazutaka YOKOTA.El
379369a889cSKazutaka YOKOTA.Pp
38006a9897cSMarkus Brueffer.Dv MOUSE_MOTION_EVENT
381369a889cSKazutaka YOKOTAand
38206a9897cSMarkus Brueffer.Dv MOUSE_BUTTON_EVENT
383369a889cSKazutaka YOKOTAare newer interface and are designed to be used together.
384369a889cSKazutaka YOKOTAThey are intended to replace functions performed by
385369a889cSKazutaka YOKOTA.Dv MOUSE_ACTION
386369a889cSKazutaka YOKOTAalone.
387369a889cSKazutaka YOKOTA.Pp
38866b23135SUlrich Spörlein.It Va u
389e4343c4eSMike PritchardThis union is one of
390369a889cSKazutaka YOKOTA.Pp
391369a889cSKazutaka YOKOTA.Bl -tag -width data -compact
39266b23135SUlrich Spörlein.It Va data
393369a889cSKazutaka YOKOTA.Bd -literal
394e4343c4eSMike Pritchardstruct mouse_data {
395e4343c4eSMike Pritchard    int x;
396e4343c4eSMike Pritchard    int y;
397369a889cSKazutaka YOKOTA    int z;
398e4343c4eSMike Pritchard    int buttons;
399e4343c4eSMike Pritchard};
400e4343c4eSMike Pritchard.Ed
401369a889cSKazutaka YOKOTA.Pp
40266b23135SUlrich Spörlein.Va x , y
403369a889cSKazutaka YOKOTAand
40466b23135SUlrich Spörlein.Va z
405369a889cSKazutaka YOKOTArepresent movement of the mouse along respective directions.
40666b23135SUlrich Spörlein.Va buttons
4076d249eeeSSheldon Hearntells the state of buttons.
4086d249eeeSSheldon HearnIt encodes up to 31 buttons in the bit 0 though
409b5e7e999SRuslan Ermilovthe bit 30.
410b5e7e999SRuslan ErmilovIf a button is held down, the corresponding bit is set.
411369a889cSKazutaka YOKOTA.Pp
41266b23135SUlrich Spörlein.It Va mode
413369a889cSKazutaka YOKOTA.Bd -literal
414e4343c4eSMike Pritchardstruct mouse_mode {
415e4343c4eSMike Pritchard    int mode;
416e4343c4eSMike Pritchard    int signal;
417e4343c4eSMike Pritchard};
418e4343c4eSMike Pritchard.Ed
419369a889cSKazutaka YOKOTA.Pp
420369a889cSKazutaka YOKOTAThe
42166b23135SUlrich Spörlein.Va signal
4226d249eeeSSheldon Hearnfield specifies the signal to be delivered to the process.
4236d249eeeSSheldon HearnIt must be
424369a889cSKazutaka YOKOTAone of the values defined in
425743d5d51SRuslan Ermilov.In signal.h .
426369a889cSKazutaka YOKOTAThe
42766b23135SUlrich Spörlein.Va mode
428369a889cSKazutaka YOKOTAfield is currently unused.
429369a889cSKazutaka YOKOTA.Pp
43066b23135SUlrich Spörlein.It Va event
431369a889cSKazutaka YOKOTA.Bd -literal
432369a889cSKazutaka YOKOTAstruct mouse_event {
433369a889cSKazutaka YOKOTA    int id;
434369a889cSKazutaka YOKOTA    int value;
435369a889cSKazutaka YOKOTA};
436369a889cSKazutaka YOKOTA.Ed
437369a889cSKazutaka YOKOTA.Pp
438369a889cSKazutaka YOKOTAThe
43966b23135SUlrich Spörlein.Va id
440369a889cSKazutaka YOKOTAfield specifies a button number as in
44166b23135SUlrich Spörlein.Va u.data.buttons .
442369a889cSKazutaka YOKOTAOnly one bit/button is set.
443369a889cSKazutaka YOKOTAThe
44466b23135SUlrich Spörlein.Va value
445369a889cSKazutaka YOKOTAfield
446369a889cSKazutaka YOKOTAholds the click count: the number of times the user has clicked the button
447369a889cSKazutaka YOKOTAsuccessively.
448369a889cSKazutaka YOKOTA.Pp
449e4343c4eSMike Pritchard.El
450e4343c4eSMike Pritchard.El
451e4343c4eSMike Pritchard.Sh FILES
452e4343c4eSMike Pritchard.Bl -tag -width /dev/consolectl -compact
453e4343c4eSMike Pritchard.It Pa /dev/consolectl
454e4343c4eSMike Pritcharddevice to control the console
455e4343c4eSMike Pritchard.It Pa /dev/sysmouse
456369a889cSKazutaka YOKOTAvirtualized mouse driver
457369a889cSKazutaka YOKOTA.It Pa /dev/ttyv%d
458369a889cSKazutaka YOKOTAvirtual consoles
459e4343c4eSMike Pritchard.El
460e4343c4eSMike Pritchard.Sh SEE ALSO
461e4343c4eSMike Pritchard.Xr vidcontrol 1 ,
462369a889cSKazutaka YOKOTA.Xr ioctl 2 ,
463e4343c4eSMike Pritchard.Xr signal 3 ,
464369a889cSKazutaka YOKOTA.Xr mouse 4 ,
465e4343c4eSMike Pritchard.Xr moused 8
466e4343c4eSMike Pritchard.Sh HISTORY
467e4343c4eSMike PritchardThe
468e4343c4eSMike Pritchard.Nm
46986c18b36SGavin Atkinsondriver first appeared in
4702c8478e1SJohn-Mark Gurney.Fx 2.2 .
471aaf1f16eSPhilippe Charnier.Sh AUTHORS
472f4d874a1SRuslan Ermilov.An -nosplit
473e4343c4eSMike PritchardThis
474369a889cSKazutaka YOKOTAmanual page was written by
475369a889cSKazutaka YOKOTA.An John-Mark Gurney Aq gurney_j@efn.org
476369a889cSKazutaka YOKOTAand
477aaf1f16eSPhilippe Charnier.An Kazutaka Yokota Aq yokota@FreeBSD.org .
478