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