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.\" 30369a889cSKazutaka YOKOTA.Dd December 3, 1997 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 38f6b5c74cSPoul-Henning Kamp.Fd #include <sys/mouse.h> 3900d25f51SPoul-Henning Kamp.Fd #include <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 60369a889cSKazutaka YOKOTAis running, otherwise the user process won't 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; 97369a889cSKazutaka YOKOTA-128 through 127. 98369a889cSKazutaka YOKOTA.It Byte 3 99f227cbfbSChris CostelloThe first half of vertical movement count in two's complement; 100369a889cSKazutaka YOKOTA-128 through 127. 101369a889cSKazutaka YOKOTA.It Byte 4 102f227cbfbSChris CostelloThe second half of the horizontal movement count in two's complement; 103369a889cSKazutaka YOKOTA-128 through 127. To obtain the full horizontal movement count, add 104369a889cSKazutaka YOKOTAthe byte 2 and 4. 105369a889cSKazutaka YOKOTA.It Byte 5 106f227cbfbSChris CostelloThe second half of the vertical movement count in two's complement; 107369a889cSKazutaka YOKOTA-128 through 127. To obtain the full vertical movement count, add 108369a889cSKazutaka YOKOTAthe byte 3 and 5. 109369a889cSKazutaka YOKOTA.El 110369a889cSKazutaka YOKOTA.Pp 111369a889cSKazutaka YOKOTAAt the level one, the extended level, mouse data is encoded 112369a889cSKazutaka YOKOTAin the standard format 113369a889cSKazutaka YOKOTA.Dv MOUSE_PROTO_SYSMOUSE 114369a889cSKazutaka YOKOTAas defined in 115369a889cSKazutaka YOKOTA.Xr mouse 4 . 116369a889cSKazutaka YOKOTA.\" .Ss Acceleration 117369a889cSKazutaka YOKOTA.\" The 118369a889cSKazutaka YOKOTA.\" .Nm 119369a889cSKazutaka YOKOTA.\" driver can somewhat `accelerate' the movement of the pointing device. 120369a889cSKazutaka YOKOTA.\" The faster you move the device, the further the pointer 121369a889cSKazutaka YOKOTA.\" travels on the screen. 122369a889cSKazutaka YOKOTA.\" The driver has an internal variable which governs the effect of 123369a889cSKazutaka YOKOTA.\" the acceleration. Its value can be modified via the driver flag 124369a889cSKazutaka YOKOTA.\" or via an ioctl call. 125369a889cSKazutaka YOKOTA.Sh IOCTLS 126369a889cSKazutaka YOKOTAThis section describes two classes of 127369a889cSKazutaka YOKOTA.Xr ioctl 2 128369a889cSKazutaka YOKOTAcommands: 129369a889cSKazutaka YOKOTAcommands for the 130369a889cSKazutaka YOKOTA.Nm 131369a889cSKazutaka YOKOTAdriver itself, and commands for the console and the console control drivers. 132369a889cSKazutaka YOKOTA.Ss Sysmouse Ioctls 133369a889cSKazutaka YOKOTAThere are a few commands for mouse drivers. 134369a889cSKazutaka YOKOTAGeneral description of the commands is given in 135369a889cSKazutaka YOKOTA.Xr mouse 4 . 1367f9d55b4STim VanderhoekFollowing are the features specific to the 137369a889cSKazutaka YOKOTA.Nm 138369a889cSKazutaka YOKOTAdriver. 139369a889cSKazutaka YOKOTA.Pp 140369a889cSKazutaka YOKOTA.Bl -tag -width MOUSE -compact 141369a889cSKazutaka YOKOTA.It Dv MOUSE_GETLEVEL Ar int *level 142369a889cSKazutaka YOKOTA.It Dv MOUSE_SETLEVEL Ar int *level 143369a889cSKazutaka YOKOTAThese commands manipulate the operation level of the mouse driver. 144369a889cSKazutaka YOKOTA.Pp 145369a889cSKazutaka YOKOTA.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw 146369a889cSKazutaka YOKOTAReturns the hardware information of the attached device in the following 147369a889cSKazutaka YOKOTAstructure. Only the 148369a889cSKazutaka YOKOTA.Dv iftype 149369a889cSKazutaka YOKOTAfield is guaranteed to be filled with the correct value in the current 150369a889cSKazutaka YOKOTAversion of the 151369a889cSKazutaka YOKOTA.Nm 152369a889cSKazutaka YOKOTAdriver. 153369a889cSKazutaka YOKOTA.Bd -literal 154369a889cSKazutaka YOKOTAtypedef struct mousehw { 155369a889cSKazutaka YOKOTA int buttons; /* number of buttons */ 156369a889cSKazutaka YOKOTA int iftype; /* I/F type */ 157369a889cSKazutaka YOKOTA int type; /* mouse/track ball/pad... */ 158369a889cSKazutaka YOKOTA int model; /* I/F dependent model ID */ 159369a889cSKazutaka YOKOTA int hwid; /* I/F dependent hardware ID */ 160369a889cSKazutaka YOKOTA} mousehw_t; 161369a889cSKazutaka YOKOTA.Ed 162369a889cSKazutaka YOKOTA.Pp 163369a889cSKazutaka YOKOTAThe 164369a889cSKazutaka YOKOTA.Dv buttons 165369a889cSKazutaka YOKOTAfield holds the number of buttons detected by the driver. 166369a889cSKazutaka YOKOTA.Pp 167369a889cSKazutaka YOKOTAThe 168369a889cSKazutaka YOKOTA.Dv iftype 169369a889cSKazutaka YOKOTAis always 170369a889cSKazutaka YOKOTA.Dv MOUSE_IF_SYSMOUSE . 171369a889cSKazutaka YOKOTA.Pp 172369a889cSKazutaka YOKOTAThe 173369a889cSKazutaka YOKOTA.Dv type 174369a889cSKazutaka YOKOTAtells the device type: 175369a889cSKazutaka YOKOTA.Dv MOUSE_MOUSE , 176369a889cSKazutaka YOKOTA.Dv MOUSE_TRACKBALL , 177369a889cSKazutaka YOKOTA.Dv MOUSE_STICK , 178369a889cSKazutaka YOKOTA.Dv MOUSE_PAD , 179369a889cSKazutaka YOKOTAor 180369a889cSKazutaka YOKOTA.Dv MOUSE_UNKNOWN . 181369a889cSKazutaka YOKOTA.Pp 182369a889cSKazutaka YOKOTAThe 183369a889cSKazutaka YOKOTA.Dv model 184369a889cSKazutaka YOKOTAis always 185369a889cSKazutaka YOKOTA.Dv MOUSE_MODEL_GENERIC 186369a889cSKazutaka YOKOTAat the operation level 0. 187369a889cSKazutaka YOKOTAIt may be 188369a889cSKazutaka YOKOTA.Dv MOUSE_MODEL_GENERIC 189369a889cSKazutaka YOKOTAor one of 190369a889cSKazutaka YOKOTA.Dv MOUSE_MODEL_XXX 191369a889cSKazutaka YOKOTAconstants at higher operation levels. 192369a889cSKazutaka YOKOTA.Pp 193369a889cSKazutaka YOKOTAThe 194369a889cSKazutaka YOKOTA.Dv hwid 195369a889cSKazutaka YOKOTAis always zero. 196369a889cSKazutaka YOKOTA.Pp 197369a889cSKazutaka YOKOTA.It Dv MOUSE_GETMODE Ar mousemode_t *mode 198369a889cSKazutaka YOKOTAThe command gets the current operation parameters of the mouse 199369a889cSKazutaka YOKOTAdriver. 200369a889cSKazutaka YOKOTA.Bd -literal 201369a889cSKazutaka YOKOTAtypedef struct mousemode { 202369a889cSKazutaka YOKOTA int protocol; /* MOUSE_PROTO_XXX */ 203369a889cSKazutaka YOKOTA int rate; /* report rate (per sec) */ 204369a889cSKazutaka YOKOTA int resolution; /* MOUSE_RES_XXX, -1 if unknown */ 205369a889cSKazutaka YOKOTA int accelfactor; /* acceleration factor */ 206369a889cSKazutaka YOKOTA int level; /* driver operation level */ 207369a889cSKazutaka YOKOTA int packetsize; /* the length of the data packet */ 208369a889cSKazutaka YOKOTA unsigned char syncmask[2]; /* sync. bits */ 209369a889cSKazutaka YOKOTA} mousemode_t; 210369a889cSKazutaka YOKOTA.Ed 211369a889cSKazutaka YOKOTA.Pp 212369a889cSKazutaka YOKOTAThe 213369a889cSKazutaka YOKOTA.Dv protocol 214369a889cSKazutaka YOKOTAfield tells the format in which the device status is returned 215369a889cSKazutaka YOKOTAwhen the mouse data is read by the user program. 216369a889cSKazutaka YOKOTAIt is 217369a889cSKazutaka YOKOTA.Dv MOUSE_PROTO_MSC 218369a889cSKazutaka YOKOTAat the operation level zero. 219369a889cSKazutaka YOKOTA.Dv MOUSE_PROTO_SYSMOUSE 220369a889cSKazutaka YOKOTAat the operation level one. 221369a889cSKazutaka YOKOTA.Pp 222369a889cSKazutaka YOKOTAThe 223369a889cSKazutaka YOKOTA.Dv rate 224369a889cSKazutaka YOKOTAis always set to -1. 225369a889cSKazutaka YOKOTA.Pp 226369a889cSKazutaka YOKOTAThe 227369a889cSKazutaka YOKOTA.Dv resolution 228369a889cSKazutaka YOKOTAis always set to -1. 229369a889cSKazutaka YOKOTA.Pp 230369a889cSKazutaka YOKOTAThe 231369a889cSKazutaka YOKOTA.Dv accelfactor 232369a889cSKazutaka YOKOTAis always 0. 233369a889cSKazutaka YOKOTA.Pp 234369a889cSKazutaka YOKOTAThe 235369a889cSKazutaka YOKOTA.Dv packetsize 2366d249eeeSSheldon Hearnfield specifies the length of the data packet. 2376d249eeeSSheldon HearnIt depends on the 238369a889cSKazutaka YOKOTAoperation level. 239369a889cSKazutaka YOKOTA.Pp 240369a889cSKazutaka YOKOTA.Bl -tag -width level_0__ -compact 241369a889cSKazutaka YOKOTA.It Em level 0 242369a889cSKazutaka YOKOTA5 bytes 243369a889cSKazutaka YOKOTA.It Em level 1 244369a889cSKazutaka YOKOTA8 bytes 245369a889cSKazutaka YOKOTA.El 246369a889cSKazutaka YOKOTA.Pp 247369a889cSKazutaka YOKOTAThe array 248369a889cSKazutaka YOKOTA.Dv syncmask 249369a889cSKazutaka YOKOTAholds a bit mask and pattern to detect the first byte of the 250369a889cSKazutaka YOKOTAdata packet. 251369a889cSKazutaka YOKOTA.Dv syncmask[0] 2526d249eeeSSheldon Hearnis the bit mask to be ANDed with a byte. 2536d249eeeSSheldon HearnIf the result is equal to 254369a889cSKazutaka YOKOTA.Dv syncmask[1] , 255369a889cSKazutaka YOKOTAthe byte is likely to be the first byte of the data packet. 2567f9d55b4STim VanderhoekNote that this method of detecting the first byte is not 100% reliable; 2577f9d55b4STim Vanderhoekthus, it should be taken only as an advisory measure. 258369a889cSKazutaka YOKOTA.Pp 259369a889cSKazutaka YOKOTA.It Dv MOUSE_SETMODE Ar mousemode_t *mode 260369a889cSKazutaka YOKOTAThe command changes the current operation parameters of the mouse driver 261369a889cSKazutaka YOKOTAas specified in 262369a889cSKazutaka YOKOTA.Ar mode . 263369a889cSKazutaka YOKOTAOnly 264369a889cSKazutaka YOKOTA.Dv level 2656d249eeeSSheldon Hearnmay be modifiable. 2666d249eeeSSheldon HearnSetting values in the other field does not generate 267369a889cSKazutaka YOKOTAerror and has no effect. 268369a889cSKazutaka YOKOTA.\" .Pp 269369a889cSKazutaka YOKOTA.\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars 270369a889cSKazutaka YOKOTA.\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars 271369a889cSKazutaka YOKOTA.\" These commands are not supported by the 272369a889cSKazutaka YOKOTA.\" .Nm 273369a889cSKazutaka YOKOTA.\" driver. 274369a889cSKazutaka YOKOTA.Pp 275369a889cSKazutaka YOKOTA.It Dv MOUSE_READDATA Ar mousedata_t *data 276369a889cSKazutaka YOKOTA.It Dv MOUSE_READSTATE Ar mousedata_t *state 277369a889cSKazutaka YOKOTAThese commands are not supported by the 278369a889cSKazutaka YOKOTA.Nm 279369a889cSKazutaka YOKOTAdriver. 280369a889cSKazutaka YOKOTA.Pp 28133099659SKazutaka YOKOTA.It Dv MOUSE_GETSTATUS Ar mousestatus_t *status 282369a889cSKazutaka YOKOTAThe command returns the current state of buttons and 283369a889cSKazutaka YOKOTAmovement counts in the structure as defined in 284369a889cSKazutaka YOKOTA.Xr mouse 4 . 285369a889cSKazutaka YOKOTA.El 286369a889cSKazutaka YOKOTA.Ss Console and Consolectl Ioctls 287369a889cSKazutaka YOKOTAThe user process issues console 288e4343c4eSMike Pritchard.Fn ioctl 289369a889cSKazutaka YOKOTAcalls to the current virtual console in order to control 290369a889cSKazutaka YOKOTAthe mouse pointer. 291369a889cSKazutaka YOKOTAThe console 292e4343c4eSMike Pritchard.Fn ioctl 293369a889cSKazutaka YOKOTAalso provides a method for the user process to receive a 294e4343c4eSMike Pritchard.Xr signal 3 295e4343c4eSMike Pritchardwhen a button is pressed. 296e4343c4eSMike Pritchard.Pp 297369a889cSKazutaka YOKOTAThe mouse daemon 298e4343c4eSMike Pritchard.Xr moused 8 299369a889cSKazutaka YOKOTAuses 300e4343c4eSMike Pritchard.Fn ioctl 301369a889cSKazutaka YOKOTAcalls to the console control device 302369a889cSKazutaka YOKOTA.Pa /dev/consolectl 303369a889cSKazutaka YOKOTAto inform the console of mouse actions including mouse movement 304369a889cSKazutaka YOKOTAand button status. 305e4343c4eSMike Pritchard.Pp 3067f9d55b4STim VanderhoekBoth classes of 307369a889cSKazutaka YOKOTA.Fn ioctl 308369a889cSKazutaka YOKOTAcommands are defined as 309369a889cSKazutaka YOKOTA.Dv CONS_MOUSECTL 310369a889cSKazutaka YOKOTAwhich takes the following argument. 311369a889cSKazutaka YOKOTA.Bd -literal 312e4343c4eSMike Pritchardstruct mouse_info { 313e4343c4eSMike Pritchard int operation; 314e4343c4eSMike Pritchard union { 315e4343c4eSMike Pritchard struct mouse_data data; 316e4343c4eSMike Pritchard struct mouse_mode mode; 317369a889cSKazutaka YOKOTA struct mouse_event event; 318e4343c4eSMike Pritchard } u; 319e4343c4eSMike Pritchard}; 320e4343c4eSMike Pritchard.Ed 321369a889cSKazutaka YOKOTA.Pp 322369a889cSKazutaka YOKOTA.Bl -tag -width operation -compact 323e4343c4eSMike Pritchard.It Dv operation 324e4343c4eSMike PritchardThis can be one of 325369a889cSKazutaka YOKOTA.Pp 326369a889cSKazutaka YOKOTA.Bl -tag -width MOUSE_MOVEABS -compact 327e4343c4eSMike Pritchard.It Dv MOUSE_SHOW 328e4343c4eSMike PritchardEnables and displays mouse cursor. 329e4343c4eSMike Pritchard.It Dv MOUSE_HIDE 330e4343c4eSMike PritchardDisables and hides mouse cursor. 331e4343c4eSMike Pritchard.It Dv MOUSE_MOVEABS 332e4343c4eSMike PritchardMoves mouse cursor to position supplied in 333e4343c4eSMike Pritchard.Dv u.data . 334e4343c4eSMike Pritchard.It Dv MOUSE_MOVEREL 335369a889cSKazutaka YOKOTAAdds position supplied in 336e4343c4eSMike Pritchard.Dv u.data 337e4343c4eSMike Pritchardto current position. 338e4343c4eSMike Pritchard.It Dv MOUSE_GETINFO 339369a889cSKazutaka YOKOTAReturns current mouse position in the current virtual console 340369a889cSKazutaka YOKOTAand button status in 341e4343c4eSMike Pritchard.Dv u.data . 342e4343c4eSMike Pritchard.It Dv MOUSE_MODE 343e4343c4eSMike PritchardThis sets the 344e4343c4eSMike Pritchard.Xr signal 3 345e4343c4eSMike Pritchardto be delivered to the current process when a button is pressed. 346e4343c4eSMike PritchardThe signal to be delivered is set in 347e4343c4eSMike Pritchard.Dv u.mode . 348e4343c4eSMike Pritchard.El 349369a889cSKazutaka YOKOTA.Pp 3506d249eeeSSheldon HearnThe above operations are for virtual consoles. 3516d249eeeSSheldon HearnThe operations defined 3527f9d55b4STim Vanderhoekbelow are for the console control device and are used by 353369a889cSKazutaka YOKOTA.Xr moused 8 354369a889cSKazutaka YOKOTAto pass mouse data to the console driver. 355369a889cSKazutaka YOKOTA.Pp 356369a889cSKazutaka YOKOTA.Bl -tag -width MOUSE_MOVEABS -compact 357369a889cSKazutaka YOKOTA.It Dv MOUSE_ACTION 358369a889cSKazutaka YOKOTA.It Dv MOUSE_MOTIONEVENT 359369a889cSKazutaka YOKOTAThese operations take the information in 360369a889cSKazutaka YOKOTA.Dv u.data 361369a889cSKazutaka YOKOTAand act upon it. Mouse data will be sent to the 362369a889cSKazutaka YOKOTA.Nm 363369a889cSKazutaka YOKOTAdriver if it is open. 364369a889cSKazutaka YOKOTA.Dv MOUSE_ACTION 365369a889cSKazutaka YOKOTAalso processes button press actions and sends signal to the process if 366369a889cSKazutaka YOKOTArequested or performs cut and paste operations 367369a889cSKazutaka YOKOTAif the current console is a text interface. 368369a889cSKazutaka YOKOTA.It Dv MOUSE_BUTTONEVENT 369369a889cSKazutaka YOKOTA.Dv u.data 3706d249eeeSSheldon Hearnspecifies a button and its click count. 3716d249eeeSSheldon HearnThe console driver will 372369a889cSKazutaka YOKOTAuse this information for signal delivery if requested or 373369a889cSKazutaka YOKOTAfor cut and paste operations if the console is in text mode. 374369a889cSKazutaka YOKOTA.El 375369a889cSKazutaka YOKOTA.Pp 376369a889cSKazutaka YOKOTA.Dv MOUSE_MOTIONEVENT 377369a889cSKazutaka YOKOTAand 378369a889cSKazutaka YOKOTA.Dv MOUSE_BUTTONEVENT 379369a889cSKazutaka YOKOTAare newer interface and are designed to be used together. 380369a889cSKazutaka YOKOTAThey are intended to replace functions performed by 381369a889cSKazutaka YOKOTA.Dv MOUSE_ACTION 382369a889cSKazutaka YOKOTAalone. 383369a889cSKazutaka YOKOTA.Pp 384e4343c4eSMike Pritchard.It Dv u 385e4343c4eSMike PritchardThis union is one of 386369a889cSKazutaka YOKOTA.Pp 387369a889cSKazutaka YOKOTA.Bl -tag -width data -compact 388e4343c4eSMike Pritchard.It Dv data 389369a889cSKazutaka YOKOTA.Bd -literal 390e4343c4eSMike Pritchardstruct mouse_data { 391e4343c4eSMike Pritchard int x; 392e4343c4eSMike Pritchard int y; 393369a889cSKazutaka YOKOTA int z; 394e4343c4eSMike Pritchard int buttons; 395e4343c4eSMike Pritchard}; 396e4343c4eSMike Pritchard.Ed 397369a889cSKazutaka YOKOTA.Pp 398369a889cSKazutaka YOKOTA.Dv x , 399369a889cSKazutaka YOKOTA.Dv y 400369a889cSKazutaka YOKOTAand 401369a889cSKazutaka YOKOTA.Dv z 402369a889cSKazutaka YOKOTArepresent movement of the mouse along respective directions. 403369a889cSKazutaka YOKOTA.Dv buttons 4046d249eeeSSheldon Hearntells the state of buttons. 4056d249eeeSSheldon HearnIt encodes up to 31 buttons in the bit 0 though 406369a889cSKazutaka YOKOTAthe bit 30. If a button is held down, the corresponding bit is set. 407369a889cSKazutaka YOKOTA.Pp 408e4343c4eSMike Pritchard.It Dv mode 409369a889cSKazutaka YOKOTA.Bd -literal 410e4343c4eSMike Pritchardstruct mouse_mode { 411e4343c4eSMike Pritchard int mode; 412e4343c4eSMike Pritchard int signal; 413e4343c4eSMike Pritchard}; 414e4343c4eSMike Pritchard.Ed 415369a889cSKazutaka YOKOTA.Pp 416369a889cSKazutaka YOKOTAThe 417369a889cSKazutaka YOKOTA.Dv signal 4186d249eeeSSheldon Hearnfield specifies the signal to be delivered to the process. 4196d249eeeSSheldon HearnIt must be 420369a889cSKazutaka YOKOTAone of the values defined in 421369a889cSKazutaka YOKOTA.Ao Pa signal.h Ac . 422369a889cSKazutaka YOKOTAThe 423369a889cSKazutaka YOKOTA.Dv mode 424369a889cSKazutaka YOKOTAfield is currently unused. 425369a889cSKazutaka YOKOTA.Pp 426369a889cSKazutaka YOKOTA.It Dv event 427369a889cSKazutaka YOKOTA.Bd -literal 428369a889cSKazutaka YOKOTAstruct mouse_event { 429369a889cSKazutaka YOKOTA int id; 430369a889cSKazutaka YOKOTA int value; 431369a889cSKazutaka YOKOTA}; 432369a889cSKazutaka YOKOTA.Ed 433369a889cSKazutaka YOKOTA.Pp 434369a889cSKazutaka YOKOTAThe 435369a889cSKazutaka YOKOTA.Dv id 436369a889cSKazutaka YOKOTAfield specifies a button number as in 437369a889cSKazutaka YOKOTA.Dv u.data.buttons . 438369a889cSKazutaka YOKOTAOnly one bit/button is set. 439369a889cSKazutaka YOKOTAThe 440369a889cSKazutaka YOKOTA.Dv value 441369a889cSKazutaka YOKOTAfield 442369a889cSKazutaka YOKOTAholds the click count: the number of times the user has clicked the button 443369a889cSKazutaka YOKOTAsuccessively. 444369a889cSKazutaka YOKOTA.Pp 445e4343c4eSMike Pritchard.El 446e4343c4eSMike Pritchard.El 447e4343c4eSMike Pritchard.Sh FILES 448e4343c4eSMike Pritchard.Bl -tag -width /dev/consolectl -compact 449e4343c4eSMike Pritchard.It Pa /dev/consolectl 450e4343c4eSMike Pritcharddevice to control the console 451e4343c4eSMike Pritchard.It Pa /dev/sysmouse 452369a889cSKazutaka YOKOTAvirtualized mouse driver 453369a889cSKazutaka YOKOTA.It Pa /dev/ttyv%d 454369a889cSKazutaka YOKOTAvirtual consoles 455e4343c4eSMike Pritchard.El 456e4343c4eSMike Pritchard.Sh SEE ALSO 457e4343c4eSMike Pritchard.Xr vidcontrol 1 , 458369a889cSKazutaka YOKOTA.Xr ioctl 2 , 459e4343c4eSMike Pritchard.Xr signal 3 , 460369a889cSKazutaka YOKOTA.Xr mouse 4 , 461e4343c4eSMike Pritchard.Xr moused 8 462e4343c4eSMike Pritchard.Sh HISTORY 463e4343c4eSMike PritchardThe 464e4343c4eSMike Pritchard.Nm 465e4343c4eSMike Pritchardmanual page example first appeared in 4662c8478e1SJohn-Mark Gurney.Fx 2.2 . 467aaf1f16eSPhilippe Charnier.Sh AUTHORS 468f4d874a1SRuslan Ermilov.An -nosplit 469e4343c4eSMike PritchardThis 470369a889cSKazutaka YOKOTAmanual page was written by 471369a889cSKazutaka YOKOTA.An John-Mark Gurney Aq gurney_j@efn.org 472369a889cSKazutaka YOKOTAand 473aaf1f16eSPhilippe Charnier.An Kazutaka Yokota Aq yokota@FreeBSD.org . 474