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
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 Horizontal Virtual Scrolling .
145 With this option set, holding the middle mouse
146 button down will cause motion to be interpreted as
147 horizontal scrolling.
150 option to set the distance the mouse must move before the scrolling mode is
152 This option may be used with or without the
156 Write the process id of the
158 utility in the specified file.
159 Without this option, the process id will be stored in
160 .Pa /var/run/moused.pid .
162 Do not start the Plug and Play COM device enumeration procedure
163 when identifying the serial mouse.
164 If this option is given together with the
168 utility will not be able to print useful information for the serial mouse.
170 Lower RTS on the serial port.
171 This option is valid only if
173 is selected as the protocol type by the
176 It is often used with the
179 Both RTS and DTR lines may need to be dropped for
180 a 3-button mouse to operate in the
184 Select the baudrate for the serial port (1200 to 9600).
185 Not all serial mice support this option.
186 .It Fl T Ar distance Ns Op , Ns Ar time Ns Op , Ns Ar after
188 Use this option if mouse pointer slowly wanders when mouse is not moved.
191 (for example 4) pixels (X+Y) in
193 msec (default 500) are ignored, except during
195 msec (default 4000) since last real mouse movement.
198 .Dq Virtual Scrolling .
199 With this option set, holding the middle mouse
200 button down will cause motion to be interpreted as scrolling.
203 option to set the distance the mouse must move before the scrolling mode is
207 .Dq Virtual Scrolling
210 option can be used to set the
212 (in pixels) that the mouse must move before the scrolling
217 .It Fl A Ar exp Ns Op , Ns Ar offset
218 Apply exponential (dynamic) acceleration to mouse movements:
219 the faster you move the mouse, the more it will be accelerated.
220 That means that small mouse movements are not accelerated,
221 so they are still very accurate, while a faster movement will
222 drive the pointer quickly across the screen.
226 value specifies the exponent, which is basically
227 the amount of acceleration. Useful values are in the
228 range 1.1 to 2.0, but it depends on your mouse hardware
229 and your personal preference. A value of 1.0 means no
230 exponential acceleration. A value of 2.0 means squared
231 acceleration (i.e. if you move the mouse twice as fast,
232 the pointer will move four times as fast on the screen).
233 Values beyond 2.0 are possible but not recommended.
234 A good value to start is probably 1.5.
238 value specifies the distance at which the acceleration
239 begins. The default is 1.0, which means that the
240 acceleration is applied to movements larger than one unit.
241 If you specify a larger value, it takes more speed for
242 the acceleration to kick in, i.e. the speed range for
243 small and accurate movements is wider.
244 Usually the default should be sufficient, but if you're
245 not satisfied with the behaviour, try a value of 2.0.
249 option interacts badly with the X server's own acceleration,
250 which doesn't work very well anyway. Therefore it is
251 recommended to switch it off if necessary:
253 .It Fl a Ar X Ns Op , Ns Ar Y
254 Accelerate or decelerate the mouse input.
255 This is a linear acceleration only.
256 Values less than 1.0 slow down movement, values greater than 1.0 speed it
258 Specifying only one value sets the acceleration for both axes.
264 options at the same time to have the combined effect
265 of linear and exponential acceleration.
267 Some mice report middle button down events
268 as if the left and right buttons are being pressed.
269 This option handles this.
271 Enable debugging messages.
273 Do not become a daemon and instead run as a foreground process.
274 Useful for testing and debugging.
276 Print specified information and quit.
280 .Bl -tag -compact -width modelxxx
282 Port (device file) name, i.e.\&
288 Interface type: serial, bus, inport or ps/2.
291 It is one of the types listed under the
295 if the driver supports the
297 data format standard.
302 utility may not always be able to identify the model.
304 All of the above items.
305 Print port, interface, type and model in this order
311 utility cannot determine the requested information, it prints
316 Specifies at which level
318 should operate the mouse driver.
323 for more information on this.
325 Assign the physical button
327 to the logical button
329 You may specify as many instances of this option as you like.
330 More than one physical button may be assigned to a logical button at the
332 In this case the logical button will be down,
333 if either of the assigned physical buttons is held down.
334 Do not put space around
339 to communicate with the mouse.
340 .It Fl r Ar resolution
341 Set the resolution of the device; in Dots Per Inch, or
347 This option may not be supported by all the device.
349 Select a baudrate of 9600 for the serial line.
350 Not all serial mice support this option.
352 Specify the protocol type of the mouse attached to the port.
353 You may explicitly specify a type listed below, or use
357 utility automatically select an appropriate protocol for the given
359 If you entirely omit this option in the command line,
362 Under normal circumstances,
363 you need to use this option only if the
365 utility is not able to detect the protocol automatically
367 .Sx "Configuring Mouse Daemon" ) .
369 Note that if a protocol type is specified with this option, the
371 option above is implied and Plug and Play COM device enumeration
372 procedure will be disabled.
374 Also note that if your mouse is attached to the PS/2 mouse port, you should
379 regardless of the brand and model of the mouse.
381 mouse is attached to the bus mouse port, choose
385 Serial mouse protocols will not work with these mice.
387 For the USB mouse, the protocol must be
389 No other protocol will work with the USB mouse.
391 Valid types for this option are
394 For the serial mouse:
395 .Bl -tag -compact -width mousesystemsxxx
397 Microsoft serial mouse protocol.
398 Most 2-button serial mice use this protocol.
400 Microsoft IntelliMouse protocol.
404 Logitech MouseMan+ and FirstMouse+ use this protocol too.
405 Other mice with a roller/wheel may be compatible with this protocol.
407 MouseSystems 5-byte protocol.
408 3-button mice may use this protocol.
410 MM Series mouse protocol.
412 Logitech mouse protocol.
413 Note that this is for old Logitech models.
417 should be specified for newer models.
419 Logitech MouseMan and TrackMan protocol.
420 Some 3-button mice may be compatible
422 Note that MouseMan+ and FirstMouse+ use
424 protocol rather than this one.
426 ALPS GlidePoint protocol.
428 Kensington ThinkingMouse protocol.
430 Hitachi tablet protocol.
431 .It Ar x10mouseremote
434 Genius Kidspad and Easypad protocol.
436 Interlink VersaPad protocol.
439 GTCO Digipad protocol.
441 For the bus and InPort mouse:
442 .Bl -tag -compact -width mousesystemsxxx
444 This is the only protocol type available for
445 the bus and InPort mouse and should be specified for any bus mice
446 and InPort mice, regardless of the brand.
450 .Bl -tag -compact -width mousesystemsxxx
452 This is the only protocol type available for the PS/2 mouse
453 and should be specified for any PS/2 mice, regardless of the brand.
458 is the only protocol type available for the USB mouse
459 and should be specified for any USB mice, regardless of the brand.
461 Make the physical button
463 act as the wheel mode button.
464 While this button is pressed, X and Y axis movement is reported to be zero
465 and the Y axis movement is mapped to Z axis.
466 You may further map the Z axis movement to virtual buttons by the
470 Map Z axis (roller/wheel) movement to another axis or to virtual buttons.
474 .Bl -tag -compact -width x__
477 X or Y axis movement will be reported when the Z axis movement is detected.
479 Report down events for the virtual buttons
483 respectively when negative and positive Z axis movement
485 There do not need to be physical buttons
489 Note that mapping to logical buttons is carried out after mapping
490 from the Z axis movement to the virtual buttons is done.
492 Report down events for the virtual buttons
496 respectively when negative and positive Z axis movement
499 This is useful for the mouse with two wheels of which
500 the second wheel is used to generate horizontal scroll action,
501 and for the mouse which has a knob or a stick which can detect
502 the horizontal force applied by the user.
504 The motion of the second wheel will be mapped to the buttons
506 for the negative direction, and
508 for the positive direction.
513 actually exist in this mouse, their actions will not be detected.
515 Note that horizontal movement or second roller/wheel movement may not
517 because there appears to be no accepted standard as to how it is encoded.
519 Note also that some mice think left is the negative horizontal direction;
520 others may think otherwise.
521 Moreover, there are some mice whose two wheels are both mounted vertically,
522 and the direction of the second vertical wheel does not match the
526 .Ss Configuring Mouse Daemon
527 The first thing you need to know is the interface type
528 of the mouse you are going to use.
529 It can be determined by looking at the connector of the mouse.
530 The serial mouse has a D-Sub female 9- or 25-pin connector.
531 The bus and InPort mice have either a D-Sub male 9-pin connector
532 or a round DIN 9-pin connector.
533 The PS/2 mouse is equipped with a small, round DIN 6-pin connector.
534 Some mice come with adapters with which the connector can
535 be converted to another.
536 If you are to use such an adapter,
537 remember the connector at the very end of the mouse/adapter pair is
539 The USB mouse has a flat rectangular connector.
541 The next thing to decide is a port to use for the given interface.
542 For the bus, InPort and PS/2 mice, there is little choice:
543 the bus and InPort mice always use
545 and the PS/2 mouse is always at
547 There may be more than one serial port to which the serial
548 mouse can be attached.
549 Many people often assign the first, built-in
553 You can attach multiple USB mice to your system or to your USB hub.
554 They are accessible as
555 .Pa /dev/ums0 , /dev/ums1 ,
558 You may want to create a symbolic link
560 pointing to the real port to which the mouse is connected, so that you
561 can easily distinguish which is your
565 The next step is to guess the appropriate protocol type for the mouse.
568 utility may be able to automatically determine the protocol type.
573 option and see what it says.
574 If the command can identify
575 the protocol type, no further investigation is necessary on your part.
576 You may start the daemon without explicitly specifying a protocol type
580 The command may print
582 if the mouse driver supports this protocol type.
590 option do not necessarily match the product name of the pointing device
591 in question, but they may give the name of the device with which it is
596 option yields nothing, you need to specify a protocol type to the
601 You have to make a guess and try.
602 There is rule of thumb:
604 .Bl -enum -compact -width 1.X
606 The bus and InPort mice always use
608 protocol regardless of the brand of the mouse.
612 protocol should always be specified for the PS/2 mouse
613 regardless of the brand of the mouse.
617 protocol for the USB mouse.
619 Most 2-button serial mice support the
623 3-button serial mice may work with the
626 If it does not, it may work with the
629 the third (middle) button will not function.
630 3-button serial mice may also work with the
632 protocol under which the third button may function as expected.
634 3-button serial mice may have a small switch to choose between
655 If the mouse has a roller or a wheel, it may be compatible with the
660 To test if the selected protocol type is correct for the given mouse,
661 enable the mouse pointer in the current virtual console,
663 .Dl "vidcontrol -m on"
665 start the mouse daemon in the foreground mode,
667 .Dl "moused -f -p <selected_port> -t <selected_protocol>"
669 and see if the mouse pointer travels correctly
670 according to the mouse movement.
671 Then try cut & paste features by
672 clicking the left, right and middle buttons.
676 As many instances of the mouse daemon as the number of mice attached to
677 the system may be run simultaneously; one
678 instance for each mouse.
679 This is useful if the user wants to use the built-in PS/2 pointing device
680 of a laptop computer while on the road, but wants to use a serial
681 mouse when s/he attaches the system to the docking station in the office.
682 Run two mouse daemons and tell the application program
684 .Tn "X\ Window System" )
687 then the application program will always see mouse data from either mouse.
688 When the serial mouse is not attached, the corresponding mouse daemon
689 will not detect any movement or button state change and the application
690 program will only see mouse data coming from the daemon for the
692 In contrast when both mice are attached and both of them
693 are moved at the same time in this configuration,
694 the mouse pointer will travel across the screen just as if movement of
695 the mice is combined all together.
697 .Bl -tag -width /dev/consolectl -compact
698 .It Pa /dev/consolectl
699 device to control the console
701 bus and InPort mouse driver
705 virtualized mouse driver
710 .It Pa /var/run/moused.pid
711 process id of the currently running
714 .It Pa /var/run/MouseRemote
715 UNIX-domain stream socket for X10 MouseRemote events
718 .Dl "moused -p /dev/cuad0 -i type"
722 utility determine the protocol type of the mouse at the serial port
724 If successful, the command will print the type, otherwise it will say
726 .Bd -literal -offset indent
733 utility is able to identify the protocol type of the mouse at the specified
734 port automatically, you can start the daemon without the
736 option and enable the mouse pointer in the text console as above.
737 .Bd -literal -offset indent
738 moused -p /dev/mouse -t microsoft
742 Start the mouse daemon on the serial port
746 is explicitly specified by the
750 .Dl "moused -p /dev/mouse -m 1=3 -m 3=1"
752 Assign the physical button 3 (right button) to the logical button 1
753 (logical left) and the physical button 1 (left) to the logical
754 button 3 (logical right).
755 This will effectively swap the left and right buttons.
757 .Dl "moused -p /dev/mouse -t intellimouse -z 4"
759 Report negative Z axis movement (i.e., mouse wheel) as the button 4 pressed
760 and positive Z axis movement (i.e., mouse wheel) as the button 5 pressed.
764 .Dl "ALL ALL = NOPASSWD: /usr/bin/killall -USR1 moused"
767 .Pa /usr/local/etc/sudoers
770 .Dl "killall -USR1 moused"
772 to a key in your window manager, you can suspend mouse events on your laptop if
773 you keep brushing over the mouse pad while typing.
775 Many pad devices behave as if the first (left) button were pressed if
778 the surface of the pad.
779 In contrast, some ALPS GlidePoint and Interlink VersaPad models
780 treat the tapping action
781 as fourth button events.
785 to obtain the same effect as the other pad devices.
787 Cut and paste functions in the virtual console assume that there
788 are three buttons on the mouse.
789 The logical button 1 (logical left) selects a region of text in the
790 console and copies it to the cut buffer.
791 The logical button 3 (logical right) extends the selected region.
792 The logical button 2 (logical middle) pastes the selected text
793 at the text cursor position.
794 If the mouse has only two buttons, the middle, `paste' button
796 To obtain the paste function, use the
798 option to emulate the middle button, or use the
800 option to assign the physical right button to the logical middle button:
815 utility partially supports
816 .Dq Plug and Play External COM Device Specification
817 in order to support PnP serial mice.
818 However, due to various degrees of conformance to the specification by
819 existing serial mice, it does not strictly follow the version 1.0 of the
821 Even with this less strict approach,
822 it may not always determine an appropriate protocol type
823 for the given serial mouse.
827 utility first appeared in
833 utility was written by
834 .An Michael Smith Aq msmith@FreeBSD.org .
835 This manual page was written by
836 .An Mike Pritchard Aq mpp@FreeBSD.org .
837 The command and manual page have since been updated by
838 .An Kazutaka Yokota Aq yokota@FreeBSD.org .