1.\" $NetBSD: wsmouse.4,v 1.24 2021/10/12 07:43:49 wiz Exp $ 2.\" 3.\" Copyright (c) 1999 4.\" Matthias Drochner. All rights reserved. 5.\" 6.\" Copyright (c) 2006 7.\" Julio M. Merino Vidal. All rights reserved. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.Dd September 25, 2021 31.Dt WSMOUSE 4 32.Os 33.Sh NAME 34.Nm wsmouse 35.Nd generic mouse support in wscons 36.Sh SYNOPSIS 37.Cd "wsmouse* at pms? mux 0" 38(PS/2 mouse, including ``IntelliMouse''-compatible wheel mice) 39.Cd "wsmouse* at ums? mux 0" 40(USB mouse) 41.Cd "wsmouse* at uts? mux 0" 42(USB touchscreen) 43.Cd "wsmouse* at lms? mux 0" 44(Logitech bus mouse, i386 only) 45.Cd "wsmouse* at mms? mux 0" 46(Microsoft InPort mouse, i386 only) 47.Cd "wsmouse0 at ams? mux 0" 48(Apple ADB mouse) 49.Cd "wsmouse* at btms? mux 0" 50(Bluetooth mouse) 51.Cd "wsmouse* at lkms? mux 0" 52(DEC VSXXX serial mice) 53.Sh DESCRIPTION 54The 55.Nm 56driver is an abstraction layer for mice within the 57.Xr wscons 4 58framework. 59It is attached to the hardware specific mouse drivers and 60provides a character device interface which returns 61.Fa struct wscons_event 62via 63.Xr read 2 . 64For use with X servers, 65.Dq mouse events 66can be generated. 67.Pp 68The 69.Xr wsconsctl 8 70utility gives access to several configurable details that affect this 71driver. 72.Ss Ioctls 73The following 74.Xr ioctl 2 75calls are provided by the 76.Nm 77driver or by devices which use it. 78Their definitions are found in 79.Pa dev/wscons/wsconsio.h . 80.Bl -tag -width Dv 81.It Dv WSMOUSEIO_GETPARAMS Pq Li "struct wsmouse_parameters" 82.It Dv WSMOUSEIO_SETPARAMS Pq Li "struct wsmouse_parameters" 83Obtain and set various mouse parameters as a key/value set. 84Currently these primarily relate to touchpads. 85The structure 86.Vt struct wsmouse_parameters 87is defined as follows: 88.Bd -literal -offset indent 89struct wsmouse_param { 90 enum wsmousecfg key; 91 int value; 92}; 93 94struct wsmouse_parameters { 95 struct wsmouse_param *params; 96 unsigned int nparams; 97}; 98.Ed 99.Pp 100The number of parameters to read or write must be specified in 101.Va nparams . 102For each parameter, when 103.Dv WSMOUSEIO_GETPARAMS 104is used, a key must be specified. 105When 106.Dv WSMOUSEIO_SETPARAMS 107is used, a key and a value must be specified. 108A single ioctl may retrieve up to 109.Dv WSMOUSECFG_MAX 110.Va nparams . 111.It Dv WSMOUSEIO_GETREPEAT Pq Li "struct wsmouse_repeat" 112Retrieve the current automatic button repeating configuration. 113The structure returned is as follows: 114.Bd -literal -offset indent 115struct wsmouse_repeat { 116 unsigned long wr_buttons; 117 unsigned int wr_delay_first; 118 unsigned int wr_delay_decrement; 119 unsigned int wr_delay_minimum; 120}; 121.Ed 122.Pp 123The 124.Va wr_buttons 125field is a bit mask that specifies which buttons send press and 126release events periodically while they are physically held down. 127The least significant bit corresponds to button 0. 128.Pp 129The other three fields describe the frequency upon which these 130automatic events are sent. 131.Va wr_delay_first 132specifies the milliseconds before the first repeated event is sent. 133.Va wr_delay_decrement 134is used to calculate the delay between the most recently generated 135event and the forthcoming one: the previous delay is taken and it is 136decreased by the value given in this variable. 137.Va wr_delay_minimum 138specifies the minimum delay, in milliseconds, between two consecutive 139events. 140.It Dv WSMOUSEIO_SETREPEAT Pq Li "struct wsmouse_repeat" 141Set the automatic button repeating configuration. 142See 143.Dv WSMOUSEIO_GETREPEAT 144above for more details. 145.It Dv WSMOUSEIO_SETVERSION Pq Li "int" 146Set the wscons_event protocol version. 147The default is 0 for binary compatibility. 148The latest version is 149always available as 150.Dv WSMOUSE_EVENT_VERSION , 151and is currently 1. 152All new code should use a call similar to the below to ensure the 153correct version is returned. 154.Bd -literal -offset indent 155int ver = WSMOUSE_EVENT_VERSION; 156if (ioctl(fd, WSMOUSEIO_SETVERSION, &ver) == -1) 157 err(EXIT_FAILURE, "cannot set version"); 158.Ed 159.El 160.Sh FILES 161.Bl -item 162.It 163.Pa /dev/wsmouse* 164.It 165.Pa /usr/include/dev/wscons/wsconsio.h . 166.El 167.Sh SEE ALSO 168.Xr btms 4 , 169.Xr dreamcast/mms 4 , 170.Xr i386/lms 4 , 171.Xr i386/mms 4 , 172.Xr pms 4 , 173.Xr uep 4 , 174.Xr ums 4 , 175.Xr uts 4 , 176.Xr wscons 4 , 177.Xr wsmux 4 , 178.Xr moused 8 , 179.Xr wsconsctl 8 , 180.Xr wsmoused 8 , 181.Xr wsmouse 9 182