2 .\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by Mike Pritchard.
15 .\" 4. Neither the name of the author nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 .Nd pass mouse data to the console driver
44 .Op Fl r Ar resolution
46 .Op Fl VH Op Fl U Ar distance Fl L Ar distance
47 .Op Fl A Ar exp Ns Op , Ns Ar offset
48 .Op Fl a Ar X Ns Op , Ns Ar Y
55 .Op Fl 3 Op Fl E Ar timeout
56 .Op Fl T Ar distance Ns Op , Ns Ar time Ns Op , Ns Ar after
66 utility and the console driver work together to support
67 mouse operation in the text console and user programs.
68 They virtualize the mouse and provide user programs with mouse data
69 in the standard format
73 The mouse daemon listens to the specified port for mouse data,
74 interprets and then passes it via ioctls to the console driver.
76 reports translation movement, button press/release
77 events and movement of the roller or the wheel if available.
78 The roller/wheel movement is reported as
82 The console driver will display the mouse pointer on the screen
83 and provide cut and paste functions if the mouse pointer is enabled
84 in the virtual console via
88 is opened by the user program, the console driver also passes the mouse
89 data to the device so that the user program will see it.
91 If the mouse daemon receives the signal
93 it will reopen the mouse port and reinitialize itself.
95 the mouse is attached/detached while the system is suspended.
97 If the mouse daemon receives the signal
99 it will stop passing mouse events.
102 again will resume passing mouse events.
103 Useful if your typing on a laptop is
104 interrupted by accidentally touching the mouse pad.
106 The following options are available:
107 .Bl -tag -width indent
109 Emulate the third (middle) button for 2-button mice.
111 by pressing the left and right physical buttons simultaneously.
112 .It Fl C Ar threshold
113 Set double click speed as the maximum interval in msec between button clicks.
114 Without this option, the default value of 500 msec will be assumed.
115 This option will have effect only on the cut and paste operations
116 in the text mode console.
117 The user program which is reading mouse data
120 will not be affected.
122 Lower DTR on the serial port.
123 This option is valid only if
125 is selected as the protocol type.
126 The DTR line may need to be dropped for a 3-button mouse
131 When the third button emulation is enabled
137 msec at most before deciding whether two buttons are being pressed
139 The default timeout is 100 msec.
141 Set the report rate (reports/sec) of the device if supported.
144 .Dq Virtual Scrolling
147 option can be used to set the
149 (in pixels) that the mouse must move before a scroll event
150 is generated. This effectively controls the scrolling speed.
156 .Dq Horizontal Virtual Scrolling .
157 With this option set, holding the middle mouse
158 button down will cause motion to be interpreted as
159 horizontal scrolling.
162 option to set the distance the mouse must move before the scrolling mode is
165 option to set the scrolling speed.
166 This option may be used with or without the
170 Write the process id of the
172 utility in the specified file.
173 Without this option, the process id will be stored in
174 .Pa /var/run/moused.pid .
176 Do not start the Plug and Play COM device enumeration procedure
177 when identifying the serial mouse.
178 If this option is given together with the
182 utility will not be able to print useful information for the serial mouse.
184 Lower RTS on the serial port.
185 This option is valid only if
187 is selected as the protocol type by the
190 It is often used with the
193 Both RTS and DTR lines may need to be dropped for
194 a 3-button mouse to operate in the
198 Select the baudrate for the serial port (1200 to 9600).
199 Not all serial mice support this option.
200 .It Fl T Ar distance Ns Op , Ns Ar time Ns Op , Ns Ar after
202 Use this option if mouse pointer slowly wanders when mouse is not moved.
205 (for example 4) pixels (X+Y) in
207 msec (default 500) are ignored, except during
209 msec (default 4000) since last real mouse movement.
212 .Dq Virtual Scrolling .
213 With this option set, holding the middle mouse
214 button down will cause motion to be interpreted as scrolling.
217 option to set the distance the mouse must move before the scrolling mode is
220 option to set the scrolling speed.
223 .Dq Virtual Scrolling
226 option can be used to set the
228 (in pixels) that the mouse must move before the scrolling
233 .It Fl A Ar exp Ns Op , Ns Ar offset
234 Apply exponential (dynamic) acceleration to mouse movements:
235 the faster you move the mouse, the more it will be accelerated.
236 That means that small mouse movements are not accelerated,
237 so they are still very accurate, while a faster movement will
238 drive the pointer quickly across the screen.
242 value specifies the exponent, which is basically
243 the amount of acceleration. Useful values are in the
244 range 1.1 to 2.0, but it depends on your mouse hardware
245 and your personal preference. A value of 1.0 means no
246 exponential acceleration. A value of 2.0 means squared
247 acceleration (i.e. if you move the mouse twice as fast,
248 the pointer will move four times as fast on the screen).
249 Values beyond 2.0 are possible but not recommended.
250 A good value to start is probably 1.5.
254 value specifies the distance at which the acceleration
255 begins. The default is 1.0, which means that the
256 acceleration is applied to movements larger than one unit.
257 If you specify a larger value, it takes more speed for
258 the acceleration to kick in, i.e. the speed range for
259 small and accurate movements is wider.
260 Usually the default should be sufficient, but if you're
261 not satisfied with the behaviour, try a value of 2.0.
265 option interacts badly with the X server's own acceleration,
266 which doesn't work very well anyway. Therefore it is
267 recommended to switch it off if necessary:
269 .It Fl a Ar X Ns Op , Ns Ar Y
270 Accelerate or decelerate the mouse input.
271 This is a linear acceleration only.
272 Values less than 1.0 slow down movement, values greater than 1.0 speed it
274 Specifying only one value sets the acceleration for both axes.
280 options at the same time to have the combined effect
281 of linear and exponential acceleration.
283 Some mice report middle button down events
284 as if the left and right buttons are being pressed.
285 This option handles this.
287 Enable debugging messages.
289 Do not become a daemon and instead run as a foreground process.
290 Useful for testing and debugging.
292 Print specified information and quit.
296 .Bl -tag -compact -width modelxxx
298 Port (device file) name, i.e.\&
304 Interface type: serial, bus, inport or ps/2.
307 It is one of the types listed under the
311 if the driver supports the
313 data format standard.
318 utility may not always be able to identify the model.
320 All of the above items.
321 Print port, interface, type and model in this order
327 utility cannot determine the requested information, it prints
332 Specifies at which level
334 should operate the mouse driver.
339 for more information on this.
341 Assign the physical button
343 to the logical button
345 You may specify as many instances of this option as you like.
346 More than one physical button may be assigned to a logical button at the
348 In this case the logical button will be down,
349 if either of the assigned physical buttons is held down.
350 Do not put space around
355 to communicate with the mouse.
356 .It Fl r Ar resolution
357 Set the resolution of the device; in Dots Per Inch, or
363 This option may not be supported by all the device.
365 Select a baudrate of 9600 for the serial line.
366 Not all serial mice support this option.
368 Specify the protocol type of the mouse attached to the port.
369 You may explicitly specify a type listed below, or use
373 utility automatically select an appropriate protocol for the given
375 If you entirely omit this option in the command line,
378 Under normal circumstances,
379 you need to use this option only if the
381 utility is not able to detect the protocol automatically
383 .Sx "Configuring Mouse Daemon" ) .
385 Note that if a protocol type is specified with this option, the
387 option above is implied and Plug and Play COM device enumeration
388 procedure will be disabled.
390 Also note that if your mouse is attached to the PS/2 mouse port, you should
395 regardless of the brand and model of the mouse.
397 mouse is attached to the bus mouse port, choose
401 Serial mouse protocols will not work with these mice.
403 For the USB mouse, the protocol must be
405 No other protocol will work with the USB mouse.
407 Valid types for this option are
410 For the serial mouse:
411 .Bl -tag -compact -width mousesystemsxxx
413 Microsoft serial mouse protocol.
414 Most 2-button serial mice use this protocol.
416 Microsoft IntelliMouse protocol.
420 Logitech MouseMan+ and FirstMouse+ use this protocol too.
421 Other mice with a roller/wheel may be compatible with this protocol.
423 MouseSystems 5-byte protocol.
424 3-button mice may use this protocol.
426 MM Series mouse protocol.
428 Logitech mouse protocol.
429 Note that this is for old Logitech models.
433 should be specified for newer models.
435 Logitech MouseMan and TrackMan protocol.
436 Some 3-button mice may be compatible
438 Note that MouseMan+ and FirstMouse+ use
440 protocol rather than this one.
442 ALPS GlidePoint protocol.
444 Kensington ThinkingMouse protocol.
446 Hitachi tablet protocol.
447 .It Ar x10mouseremote
450 Genius Kidspad and Easypad protocol.
452 Interlink VersaPad protocol.
454 GTCO Digipad protocol.
457 For the bus and InPort mouse:
458 .Bl -tag -compact -width mousesystemsxxx
460 This is the only protocol type available for
461 the bus and InPort mouse and should be specified for any bus mice
462 and InPort mice, regardless of the brand.
466 .Bl -tag -compact -width mousesystemsxxx
468 This is the only protocol type available for the PS/2 mouse
469 and should be specified for any PS/2 mice, regardless of the brand.
474 is the only protocol type available for the USB mouse
475 and should be specified for any USB mice, regardless of the brand.
477 Make the physical button
479 act as the wheel mode button.
480 While this button is pressed, X and Y axis movement is reported to be zero
481 and the Y axis movement is mapped to Z axis.
482 You may further map the Z axis movement to virtual buttons by the
486 Map Z axis (roller/wheel) movement to another axis or to virtual buttons.
490 .Bl -tag -compact -width x__
493 X or Y axis movement will be reported when the Z axis movement is detected.
495 Report down events for the virtual buttons
499 respectively when negative and positive Z axis movement
501 There do not need to be physical buttons
505 Note that mapping to logical buttons is carried out after mapping
506 from the Z axis movement to the virtual buttons is done.
508 Report down events for the virtual buttons
512 respectively when negative and positive Z axis movement
515 This is useful for the mouse with two wheels of which
516 the second wheel is used to generate horizontal scroll action,
517 and for the mouse which has a knob or a stick which can detect
518 the horizontal force applied by the user.
520 The motion of the second wheel will be mapped to the buttons
522 for the negative direction, and
524 for the positive direction.
529 actually exist in this mouse, their actions will not be detected.
531 Note that horizontal movement or second roller/wheel movement may not
533 because there appears to be no accepted standard as to how it is encoded.
535 Note also that some mice think left is the negative horizontal direction;
536 others may think otherwise.
537 Moreover, there are some mice whose two wheels are both mounted vertically,
538 and the direction of the second vertical wheel does not match the
542 .Ss Configuring Mouse Daemon
543 The first thing you need to know is the interface type
544 of the mouse you are going to use.
545 It can be determined by looking at the connector of the mouse.
546 The serial mouse has a D-Sub female 9- or 25-pin connector.
547 The bus and InPort mice have either a D-Sub male 9-pin connector
548 or a round DIN 9-pin connector.
549 The PS/2 mouse is equipped with a small, round DIN 6-pin connector.
550 Some mice come with adapters with which the connector can
551 be converted to another.
552 If you are to use such an adapter,
553 remember the connector at the very end of the mouse/adapter pair is
555 The USB mouse has a flat rectangular connector.
557 The next thing to decide is a port to use for the given interface.
558 For the bus, InPort and PS/2 mice, there is little choice:
559 the bus and InPort mice always use
561 and the PS/2 mouse is always at
563 There may be more than one serial port to which the serial
564 mouse can be attached.
565 Many people often assign the first, built-in
569 You can attach multiple USB mice to your system or to your USB hub.
570 They are accessible as
571 .Pa /dev/ums0 , /dev/ums1 ,
574 You may want to create a symbolic link
576 pointing to the real port to which the mouse is connected, so that you
577 can easily distinguish which is your
581 The next step is to guess the appropriate protocol type for the mouse.
584 utility may be able to automatically determine the protocol type.
589 option and see what it says.
590 If the command can identify
591 the protocol type, no further investigation is necessary on your part.
592 You may start the daemon without explicitly specifying a protocol type
596 The command may print
598 if the mouse driver supports this protocol type.
606 option do not necessarily match the product name of the pointing device
607 in question, but they may give the name of the device with which it is
612 option yields nothing, you need to specify a protocol type to the
617 You have to make a guess and try.
618 There is rule of thumb:
620 .Bl -enum -compact -width 1.X
622 The bus and InPort mice always use
624 protocol regardless of the brand of the mouse.
628 protocol should always be specified for the PS/2 mouse
629 regardless of the brand of the mouse.
633 protocol for the USB mouse.
635 Most 2-button serial mice support the
639 3-button serial mice may work with the
642 If it does not, it may work with the
645 the third (middle) button will not function.
646 3-button serial mice may also work with the
648 protocol under which the third button may function as expected.
650 3-button serial mice may have a small switch to choose between
671 If the mouse has a roller or a wheel, it may be compatible with the
676 To test if the selected protocol type is correct for the given mouse,
677 enable the mouse pointer in the current virtual console,
679 .Dl "vidcontrol -m on"
681 start the mouse daemon in the foreground mode,
683 .Dl "moused -f -p <selected_port> -t <selected_protocol>"
685 and see if the mouse pointer travels correctly
686 according to the mouse movement.
687 Then try cut & paste features by
688 clicking the left, right and middle buttons.
692 As many instances of the mouse daemon as the number of mice attached to
693 the system may be run simultaneously; one
694 instance for each mouse.
695 This is useful if the user wants to use the built-in PS/2 pointing device
696 of a laptop computer while on the road, but wants to use a serial
697 mouse when s/he attaches the system to the docking station in the office.
698 Run two mouse daemons and tell the application program
700 .Tn "X\ Window System" )
703 then the application program will always see mouse data from either mouse.
704 When the serial mouse is not attached, the corresponding mouse daemon
705 will not detect any movement or button state change and the application
706 program will only see mouse data coming from the daemon for the
708 In contrast when both mice are attached and both of them
709 are moved at the same time in this configuration,
710 the mouse pointer will travel across the screen just as if movement of
711 the mice is combined all together.
713 .Bl -tag -width /dev/consolectl -compact
714 .It Pa /dev/consolectl
715 device to control the console
717 bus and InPort mouse driver
721 virtualized mouse driver
726 .It Pa /var/run/moused.pid
727 process id of the currently running
730 .It Pa /var/run/MouseRemote
731 UNIX-domain stream socket for X10 MouseRemote events
734 .Dl "moused -p /dev/cuad0 -i type"
738 utility determine the protocol type of the mouse at the serial port
740 If successful, the command will print the type, otherwise it will say
742 .Bd -literal -offset indent
749 utility is able to identify the protocol type of the mouse at the specified
750 port automatically, you can start the daemon without the
752 option and enable the mouse pointer in the text console as above.
753 .Bd -literal -offset indent
754 moused -p /dev/mouse -t microsoft
758 Start the mouse daemon on the serial port
762 is explicitly specified by the
766 .Dl "moused -p /dev/mouse -m 1=3 -m 3=1"
768 Assign the physical button 3 (right button) to the logical button 1
769 (logical left) and the physical button 1 (left) to the logical
770 button 3 (logical right).
771 This will effectively swap the left and right buttons.
773 .Dl "moused -p /dev/mouse -t intellimouse -z 4"
775 Report negative Z axis movement (i.e., mouse wheel) as the button 4 pressed
776 and positive Z axis movement (i.e., mouse wheel) as the button 5 pressed.
780 .Dl "ALL ALL = NOPASSWD: /usr/bin/killall -USR1 moused"
783 .Pa /usr/local/etc/sudoers
786 .Dl "killall -USR1 moused"
788 to a key in your window manager, you can suspend mouse events on your laptop if
789 you keep brushing over the mouse pad while typing.
803 utility partially supports
804 .Dq Plug and Play External COM Device Specification
805 in order to support PnP serial mice.
806 However, due to various degrees of conformance to the specification by
807 existing serial mice, it does not strictly follow the version 1.0 of the
809 Even with this less strict approach,
810 it may not always determine an appropriate protocol type
811 for the given serial mouse.
815 utility first appeared in
821 utility was written by
822 .An Michael Smith Aq msmith@FreeBSD.org .
823 This manual page was written by
824 .An Mike Pritchard Aq mpp@FreeBSD.org .
825 The command and manual page have since been updated by
826 .An Kazutaka Yokota Aq yokota@FreeBSD.org .
828 Many pad devices behave as if the first (left) button were pressed if
831 the surface of the pad.
832 In contrast, some ALPS GlidePoint and Interlink VersaPad models
833 treat the tapping action
834 as fourth button events.
838 to obtain the same effect as the other pad devices.
840 Cut and paste functions in the virtual console assume that there
841 are three buttons on the mouse.
842 The logical button 1 (logical left) selects a region of text in the
843 console and copies it to the cut buffer.
844 The logical button 3 (logical right) extends the selected region.
845 The logical button 2 (logical middle) pastes the selected text
846 at the text cursor position.
847 If the mouse has only two buttons, the middle, `paste' button
849 To obtain the paste function, use the
851 option to emulate the middle button, or use the
853 option to assign the physical right button to the logical middle button: