p The .Fa enable member defines the function to be called to enable monitoring pointer movements and passing these events to wscons. The .Fa disable member defines the function to disable movement events. The .Fa ioctl member defines the function to be called to perform mouse-specific ioctl calls.
p There is a .Fa void * cookie provided by the mouse driver associated with these functions, which is passed to them when they are invoked. t Fa struct wsmousedev_attach_args A structure used to attach the .Xr wsmouse 4 child device. It has the following members: d -literal const struct wsmouse_accessops *accessops; void *accesscookie; .Ed .El .Sh FUNCTIONS l -tag -width compact t Fn wsmouse_input "msdev" "btns" "x" "y" "z" "w" "flags" Callback from the mouse driver to the wsmouse interface driver. Arguments are as follows: l -tag -width msdev -compact t Fa msdev This is the .Fa struct device pointer passed from .Fn config_found on attaching the child .Xr wsmouse 4 to specify the mouse device. t Fa btns This specifies the current button status. Bits for pressed buttons (which will cause the .Dv WSCONS_EVENT_MOUSE_DOWN event on .Xr wsmouse 4 device) should be set, and bits for released buttons (which will cause the .Dv WSCONS_EVENT_MOUSE_UP event) should be zero. The left most button state should be in LSB, i.e. for typical three button mouse, the left button is 0x01, the middle button is 0x02, and the right button is 0x04. t Fa x Absolute or relative X-axis value to specify the pointer coordinate. Rightward (moving the mouse right) is positive. t Fa y Absolute or relative Y-axis value to specify the pointer coordinate. Upward (moving the mouse forward) is positive. Note that this aspect is opposite from the one used in the X server dix layer. t Fa z Absolute or relative Z-axis value to specify the pointer coordinate. Usually this axis is used for the wheel. Downward (turning the wheel backward) is positive. t Fa w Absolute or relative W-axis value to specify the pointer coordinate. Usually this axis would be used for the horizontal component of the wheel. t Fa flags This argument specifies whether the pointer device and the measurement of the .Fa x , .Fa y , .Fa z , and .Fa w axes is in relative or absolute mode. Valid values for .Fa flags are: l -tag -width compact t WSMOUSE_INPUT_DELTA Relative mode. t WSMOUSE_INPUT_ABSOLUTE_X Absolute mode in .Fa x axis. t WSMOUSE_INPUT_ABSOLUTE_Y Absolute mode in .Fa y axis. t WSMOUSE_INPUT_ABSOLUTE_Z Absolute mode in .Fa z axis. t WSMOUSE_INPUT_ABSOLUTE_W Absolute mode in .Fa w axis. .El .El t Fn wsmouse_precision_scroll "msdev" "x" "y" Callback from the mouse driver to the wsmouse interface driver.
p This is used when higher precision scrolling events are required than what can be provided by a typical scroll wheel. This function generates .Dv WSCONS_EVENT_HSCROLL (for scrolling on the X axis) and .Dv WSCONS_EVENT_VSCROLL (for scrolling on the X axis) events.
p The coordinates are adjusted for speed according to the formula: .Li x * 4096 / scroll_unit
p The .Dv scroll_unit is configured through the .Xr wsmouse 4 ioctl interface, specifically the .Dv WSMOUSEIO_SETPARAMS keys .Dv WSMOUSECFG_HORIZSCROLLDIST and .Dv WSMOUSECFG_VERTSCROLLDIST . t Fn wsmousedevprint "aux" "pnp" The default wsmouse printing routine used by .Fn config_found . (see .Xr autoconf 9 ) . .El .Sh AUTOCONFIGURATION Mouse drivers which want to use the wsmouse module must be a parent to the .Xr wsmouse 4 device and provide an attachment interface. To attach the .Xr wsmouse 4 device, the mouse driver must allocate and populate a .Fa wsmousedev_attach_args structure with the supported operations and callbacks and call .Fn config_found to perform the attach (see .Xr autoconf 9 ) . .Sh OPERATION When a mouse-movement event is received, the device driver must perform any necessary movement decoding to wscons events and pass the events to wscons via .Fn wsmouse_input .
p The wscons framework calls back into the hardware driver by invoking the functions that are specified in the .Em accessops structure. The .Fn enable and .Fn disable functions are relatively simple and self-explanatory. The .Fn ioctl function is called by the wscons interface to perform mouse-specific ioctl operations (see .Xr ioctl 2 ) . The argument .Fa cmd to the .Fn ioctl function specifies the specific command to perform using the data .Fa data . Valid commands are listed in
a sys/dev/wscons/wsconsio.h . .Sh CODE REFERENCES The wscons subsystem is implemented within the directory
a sys/dev/wscons . The .Nm module itself is implemented within the file
a sys/dev/wscons/wsmouse.c . .Xr ioctl 2 operations are listed in
a sys/dev/wscons/wsconsio.h . .Sh SEE ALSO .Xr ioctl 2 , .Xr pms 4 , .Xr wscons 4 , .Xr wsmouse 4 , .Xr autoconf 9 , .Xr driver 9 , .Xr intro 9 , .Xr wscons 9 , .Xr wsdisplay 9 , .Xr wskbd 9