MOUSED(8)

NAME
moused - pass mouse data to the console driver

SYNOPSIS
moused [-dfg] [-I file] [-F rate] [-r resolution] [-VH [-U distance -L distance]] [-A exp[,offset]] [-a X[,Y]] [-C threshold] [-m N=M] [-w N] [-z target] [-t interfacetype] [-l level] [-3 [-E timeout]] [-T distance[,time[,after]]] -p port

moused [-d] -p port -i info

DESCRIPTION
The moused utility and the console driver work together to support mouse operation in the text console and user programs. They virtualize the mouse and provide user programs with mouse data in the standard format (see sysmouse(4)).

The mouse daemon listens to the specified port for mouse data, interprets and then passes it via ioctls to the console driver. Supported data interfaces are "input event device" AKA evdev and sysmouse(4) level 1. The mouse daemon reports translation movement, button press/release events and movement of the roller or the wheel if available. The roller/wheel movement is reported as “Z” axis movement.

The console driver will display the mouse pointer on the screen and provide cut and paste functions if the mouse pointer is enabled in the virtual console via vidcontrol(1). If sysmouse(4) is opened by the user program, the console driver also passes the mouse data to the device so that the user program will see it.

If the mouse daemon receives the signal SIGHUP, it will reopen the mouse port and reinitialize itself. Useful if the mouse is attached/detached while the system is suspended.

If the mouse daemon receives the signal SIGUSR1, it will stop passing mouse events. Sending the signal SIGUSR1 again will resume passing mouse events. Useful if your typing on a laptop is interrupted by accidentally touching the mouse pad.

The following options are available:

-3  Emulate the third (middle) button for 2-button mice. It is emulated by pressing the left and right physical buttons simultaneously.

-C threshold
    Set double click speed as the maximum interval in msec between button clicks. Without this option, the default value of 500 msec will be assumed. This option will have effect only on the cut and paste operations in the text mode console. The user program which is reading mouse data via sysmouse(4) will not be affected.

-E timeout
    When the third button emulation is enabled (see above), the moused utility waits timeout msec at most before deciding whether two buttons are being pressed simultaneously. The default timeout is 100 msec.

-F rate
    Only for sysmouse(4) interface. Set the report rate (reports/sec) of the device if supported.

-L distance
    When “Virtual Scrolling” is enabled, the -L option can be used to set the distance (in pixels) that the mouse must move before a scroll event is generated. This effectively controls the scrolling speed. The default distance is 2 pixels.

-H  Enable “Horizontal Virtual Scrolling”. With this option set, holding the middle mouse button down will cause motion to be interpreted as horizontal scrolling. Use the -U option to set the distance the mouse must move before the scrolling mode is activated and the -L option to set the scrolling speed. This option may be used with or without the -V option.

-I file
    Write the process id of the moused utility in the specified file. Without this option, the process id will be stored in /var/run/moused.pid.

-T distance[,time[,after]]
    Terminate drift. Use this option if mouse pointer slowly wanders when mouse is not moved. Movements up to distance (for example 4) pixels (X+Y) in time msec (default 500) are ignored, except during after msec (default 4000) since last real mouse movement.

-V  Enable “Virtual Scrolling”. With this option set, holding the middle mouse button down will cause motion to be interpreted as scrolling. Use the -U option to set the distance the mouse must move before the scrolling mode is activated and the -L option to set the scrolling speed.

-U distance
    When “Virtual Scrolling” is enabled, the -U option can be used to set the distance (in pixels) that the mouse must move before the scrolling mode is activated. The default distance is 3 pixels.

-A exp[,offset]
    Apply exponential (dynamic) acceleration to mouse movements: the faster you move the mouse, the more it will be accelerated. That means that small mouse movements are not accelerated, so they are still very accurate, while a faster movement will drive the pointer quickly across the screen.

    The exp value specifies the exponent, which is basically the amount of acceleration. Useful values are in the range 1.1 to 2.0, but it depends on your mouse hardware and your personal preference. A value of 1.0 means no exponential acceleration. A value of 2.0 means squared acceleration (i.e. if you move the mouse twice as fast, the pointer will move four times as fast on the screen). Values beyond 2.0 are possible but not recommended. A good value to start is probably 1.5.

    The optional offset value specifies the distance at which the acceleration begins. The default is 1.0, which means that the acceleration is applied to movements larger than one unit. If you specify a larger value, it takes more speed for the acceleration to kick in, i.e. the speed range for small and accurate movements is wider. Usually the default should be sufficient, but if you're not satisfied with the behaviour, try a value of 2.0.

    Note that the -A option interacts badly with the X server's own acceleration, which doesn't work very well anyway. Therefore it is recommended to switch it off if necessary: “xset m 1”.

-a X[,Y]
    Accelerate or decelerate the mouse input. This is a linear acceleration only. Values less than 1.0 slow down movement, values greater than 1.0 speed it up. Specifying only one value sets the acceleration for both axes.

    You can use the -a and -A options at the same time to have the combined effect of linear and exponential acceleration.

-d  Enable debugging messages.

-f  Do not become a daemon and instead run as a foreground process. Useful for testing and debugging.

-g  Only for evdev interface. Become the sole recipient of all incoming input events. This prevents other processes from getting input events on the device.

-i info
    Print specified information and quit. Available pieces of information are:

    port
        Port (device file) name, i.e. /dev/input/event0, /dev/ums0 and /dev/psm0.
    if  Interface type: “evdev” or “sysmouse”.
    type
        Device type: “mouse” or “touchpad”.
    model
        Mouse model.
    all All of the above items. Print port, type and model in this order in one line.

    If the moused utility cannot determine the requested information, it prints “unknown” or “generic”.

-l level
    Ignored. Used for compatibility with legacy moused.

-m N=M
    Assign the physical button M to the logical button N. You may specify as many instances of this option as you like. More than one physical button may be assigned to a logical button at the same time. In this case the logical button will be down, if either of the assigned physical buttons is held down. Do not put space around ‘=’.

-p port
    Use port to communicate with the mouse.

-r resolution
    Only for sysmouse(4) interface. Set the resolution of the device; in Dots Per Inch, or low, medium-low, medium-high or high. This option may not be supported by all the device.

-t type
    Force the interface type of the mouse attached to the port. You may explicitly specify a type listed below, or use auto to let the moused utility automatically select an appropriate protocol for the given character device. If you entirely omit this option in the command line, -t auto is assumed.

    Valid types for this option are listed below.
    evdev
        Input event device usualy residing in /dev/input.
    sysmouse
        Traditional protocol used by e.g. ums(4) and psm(4) drivers.

    Note that this option restricts usage of the given port rather then gives a hint.

-q config
    Path to configuration file.

-Q quirks
    Path to quirks directory.

-w N
    Make the physical button N act as the wheel mode button. While this button is pressed, X and Y axis movement is reported to be zero and the Y axis movement is mapped to Z axis. You may further map the Z axis movement to virtual buttons by the -z option below.

-z target
    Map Z axis (roller/wheel) movement to another axis or to virtual buttons. Valid target maybe:
    x
    y   X or Y axis movement will be reported when the Z axis movement is detected.
    N   Report down events for the virtual buttons N and N+1 respectively when negative and positive Z axis movement is detected. There do not need to be physical buttons N and N+1. Note that mapping to logical buttons is carried out after mapping from the Z axis movement to the virtual buttons is done.
    N1 N2
        Report down events for the virtual buttons N1 and N2 respectively when negative and positive Z axis movement is detected.
    N1 N2 N3 N4
        This is useful for the mouse with two wheels of which the second wheel is used to generate horizontal scroll action, and for the mouse which has a knob or a stick which can detect the horizontal force applied by the user.

        The motion of the second wheel will be mapped to the buttons N3, for the negative direction, and N4, for the positive direction. If the buttons N3 and N4 actually exist in this mouse, their actions will not be detected.

        Note that horizontal movement or second roller/wheel movement may not always be detected, because there appears to be no accepted standard as to how it is encoded.

        Note also that some mice think left is the negative horizontal direction; others may think otherwise. Moreover, there are some mice whose two wheels are both mounted vertically, and the direction of the second vertical wheel does not match the first one.

  Multiple Mice
The moused utility may operate in 2 different modes depending on the value of -p option. When started with -p auto option specified the moused handles all recognized pointing devices in a single instance. Device hotplug is supported through devd(8). Only evdev interface is available in this mode. When started with -p <selected_port> option specified the moused handles single device located at <selected_port>. Both evdev and sysmouse(4) level 1 interfaces are available in this mode. Multiple moused instances may be run simultaneously.

FILES
/dev/consolectl
    device to control the console
/dev/input/event%d
    Input event device
/dev/psm%d
    PS/2 mouse driver
/dev/sysmouse
    virtualized mouse driver
/dev/ums%d
    USB mouse driver
/var/run/moused.pid
    process id of the currently running moused utility

EXAMPLES

    moused -p auto
    vidcontrol -m on

Start moused utility to handle all evdev pointing devices automatically with hotplug support. And enable the mouse pointer in the text console after than. The daemon can be started without the -p option as well.

    moused -f -d -g -p /dev/input/event0

Start the mouse daemon on the /dev/input/event0 in the exclusive foreground debug mode. Exclusive mode may disable mouse in Xorg session.

    moused -p /dev/input/event0 -m 1=3 -m 3=1

Assign the physical button 3 (right button) to the logical button 1 (logical left) and the physical button 1 (left) to the logical button 3 (logical right). This will effectively swap the left and right buttons.

    moused -p /dev/input/event0 -z 4

Report negative Z axis movement (i.e., mouse wheel) as the button 4 pressed and positive Z axis movement (i.e., mouse wheel) as the button 5 pressed.

If you add

    ALL ALL = NOPASSWD: /usr/bin/killall -USR1 moused

to your /usr/local/etc/sudoers file, and bind

    killall -USR1 moused

to a key in your window manager, you can suspend mouse events on your laptop if you keep brushing over the mouse pad while typing.

SEE ALSO
moused.conf(5), kill(1), vidcontrol(1), xset(1), keyboard(4), psm(4), sysmouse(4), ums(4), devd(8)

HISTORY
The moused utility first appeared in FreeBSD 2.2. It was rewritten to support multiple input event devices in FreeBSD 15.0.

AUTHORS
-nosplit The moused utility was originally written by Michael Smith <msmith@FreeBSD.org>. This manual page was written by Mike Pritchard <mpp@FreeBSD.org>. The command and manual page have since been updated by Kazutaka Yokota <yokota@FreeBSD.org>. Multiple input event devices support was added by Vladimir Kondratyev <wulf@FreeBSD.org>.

CAVEATS
Cut and paste functions in the virtual console assume that there are three buttons on the mouse. The logical button 1 (logical left) selects a region of text in the console and copies it to the cut buffer. The logical button 3 (logical right) extends the selected region. The logical button 2 (logical middle) pastes the selected text at the text cursor position. If the mouse has only two buttons, the middle, `paste' button is not available. To obtain the paste function, use the -3 option to emulate the middle button, or use the -m option to assign the physical right button to the logical middle button: “-m 2=3”.