xref: /freebsd/usr.sbin/moused/moused.8 (revision 5521ff5a4d1929056e7ffc982fac3341ca54df7c)
1.\" Copyright (c) 1996
2.\"	Mike Pritchard <mpp@FreeBSD.org>.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
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.
18.\"
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
29.\" SUCH DAMAGE.
30.\"
31.\" $FreeBSD$
32.\"
33.Dd April 1, 2000
34.Dt MOUSED 8
35.Os FreeBSD
36.Sh NAME
37.Nm moused
38.Nd pass mouse data to the console driver
39.Sh SYNOPSIS
40.Nm
41.Op Fl DPRacdfs
42.Op Fl I Ar file
43.Op Fl F Ar rate
44.Op Fl r Ar resolution
45.Op Fl S Ar baudrate
46.Op Fl a Ar X Ns Op , Ns Ar Y
47.Op Fl C Ar threshold
48.Op Fl m Ar N=M
49.Op Fl w Ar N
50.Op Fl z Ar target
51.Op Fl t Ar mousetype
52.Op Fl 3 Op Fl E Ar timeout
53.Fl p Ar port
54.Pp
55.Nm
56.Op Fl Pd
57.Fl p Ar port
58.Fl i Ar info
59.Sh DESCRIPTION
60The mouse daemon
61.Nm
62and the console driver work together to support
63mouse operation in the text console and user programs.
64They virtualize the mouse and provide user programs with mouse data
65in the standard format
66.Pq see Xr sysmouse 4 .
67.Pp
68The mouse daemon listens to the specified port for mouse data,
69interprets and then passes it via ioctls to the console driver.
70The mouse daemon
71reports translation movement, button press/release
72events and movement of the roller or the wheel if available.
73The roller/wheel movement is reported as ``Z'' axis movement.
74.Pp
75The console driver will display the mouse pointer on the screen
76and provide cut and paste functions if the mouse pointer is enabled
77in the virtual console via
78.Xr vidcontrol 1 .
79If
80.Xr sysmouse 4
81is opened by the user program, the console driver also passes the mouse
82data to the device so that the user program will see it.
83.Pp
84If the mouse daemon receives the signal
85.Dv SIGHUP ,
86it will reopen the mouse port and reinitializes itself.
87Useful if
88the mouse is attached/detached while the system is suspended.
89.Pp
90The following options are available:
91.Bl -tag -width indent
92.It Fl 3
93Emulate the third (middle) button for 2-button mice.
94It is emulated
95by pressing the left and right physical buttons simultaneously.
96.It Fl C Ar threshold
97Set double click speed as the maximum interval in msec between button clicks.
98Without this option, the default value of 500 msec will be assumed.
99This option will have effect only on the cut and paste operations
100in the text mode console.
101The user program which is reading mouse data
102via
103.Xr sysmouse 4
104will not be affected.
105.It Fl D
106Lower DTR on the serial port.
107This option is valid only if
108.Ar mousesystems
109is selected as the protocol type.
110The DTR line may need to be dropped for a 3-button mouse
111to operate in the
112.Ar mousesystems
113mode.
114.It Fl E Ar timeout
115When the third button emulation is enabled
116.Pq see above ,
117the
118.Nm
119daemon waits
120.Ar timeout
121msec at most before deciding whether two buttons are being pressed
122simultaneously.
123The default timeout is 100 msec.
124.It Fl F Ar rate
125Set the report rate (reports/sec) of the device if supported.
126.It Fl I Ar file
127Write the process id of the
128.Nm
129daemon in the specified file.
130Without this option, the process id will be stored in
131.Pa /var/run/moused.pid .
132.It Fl P
133Do not start the Plug and Play COM device enumeration procedure
134when identifying the serial mouse.
135If this option is given together with the
136.Fl i
137option, the
138.Nm
139command will not be able to print useful information for the serial mouse.
140.It Fl R
141Lower RTS on the serial port.
142This option is valid only if
143.Ar mousesystems
144is selected as the protocol type by the
145.Fl t
146option below.
147It is often used with the
148.Fl D
149option above.
150Both RTS and DTR lines may need to be dropped for
151a 3-button mouse to operate in the
152.Ar mousesystems
153mode.
154.It Fl S Ar baudrate
155Select the baudrate for the serial port (1200 to 9600).
156Not all serial mice support this option.
157.It Fl a Ar X Ns Op , Ns Ar Y
158Accelerate or decelerate the mouse input.
159This is a linear acceleration only.
160Values less than 1.0 slow down movement, values greater than 1.0 speed it
161up.
162Specifying only one value sets the acceleration for both axes.
163.It Fl c
164Some mice report middle button down events
165as if the left and right buttons are being pressed.
166This option handles this.
167.It Fl d
168Enable debugging messages.
169.It Fl f
170Do not become a daemon and instead run as a foreground process.
171Useful for testing and debugging.
172.It Fl i Ar info
173Print specified information and quit.  Available pieces of
174information are:
175.Pp
176.Bl -tag -compact -width modelxxx
177.It Ar port
178Port (device file) name, i.e.
179.Pa /dev/cuaa0 ,
180.Pa /dev/mse0
181and
182.Pa /dev/psm0 .
183.It Ar if
184Interface type: serial, bus, inport or ps/2.
185.It Ar type
186Protocol type.
187It is one of the types listed under the
188.Fl t
189option below or
190.Ar sysmouse
191if the driver supports the
192.Ar sysmouse
193data format standard.
194.It Ar model
195Mouse model.  The
196.Nm
197command may not always be able to identify the model.
198.It Ar all
199All of the above items.  Print port, interface, type and model in this order
200in one line.
201.El
202.Pp
203If the
204.Nm
205command cannot determine the requested information, it prints ``unknown''
206or ``generic''.
207.It Fl m Ar N=M
208Assign the physical button
209.Ar M
210to the logical button
211.Ar N .
212You may specify as many instances of this option as you like.
213More than one physical button may be assigned to a logical button at the
214same time.
215In this case the logical button will be down,
216if either of the assigned physical buttons is held down.
217Do not put space around `='.
218.It Fl p Ar port
219Use
220.Ar port
221to communicate with the mouse.
222.It Fl r Ar resolution
223Set the resolution of the device; in Dots Per Inch, or
224.Ar low ,
225.Ar medium-low ,
226.Ar medium-high
227or
228.Ar high .
229This option may not be supported by all the device.
230.It Fl s
231Select a baudrate of 9600 for the serial line.
232Not all serial mice support this option.
233.It Fl t Ar type
234Specify the protocol type of the mouse attached to the port.
235You may explicitly specify a type listed below, or use
236.Ar auto
237to let the
238.Nm
239command to automatically select an appropriate protocol for the given
240mouse.
241If you entirely ommit this options in the command line,
242.Fl t Ar auto
243is assumed.
244Under normal circumstances,
245you need to use this option only if the
246.Nm
247command is not able to detect the protocol automatically
248.Pq see the Sx Configuring Mouse Daemon .
249.Pp
250Note that if a protocol type is specified with this option, the
251.Fl P
252option above is implied and Plug and Play COM device enumeration
253procedure will be disabled.
254.Pp
255Also note that if your mouse is attached to the PS/2 mouse port, you should
256always choose
257.Ar auto
258or
259.Ar ps/2 ,
260regardless of the brand and model of the mouse.  Likewise, if your
261mouse is attached to the bus mouse port, choose
262.Ar auto
263or
264.Ar busmouse .
265Serial mouse protocols will not work with these mice.
266.Pp
267For the USB mouse, the protocol must be
268.Ar auto .
269No other protocol will work with the USB mouse.
270.Pp
271Valid types for this option are
272listed below.
273.Pp
274For the serial mouse:
275.Bl -tag -compact -width mousesystemsxxx
276.It Ar microsoft
277Microsoft serial mouse protocol.  Most 2-button serial mice use this protocol.
278.It Ar intellimouse
279Microsoft IntelliMouse protocol.  Genius NetMouse, ASCII Mie Mouse,
280Logitech MouseMan+ and FirstMouse+ use this protocol too.
281Other mice with a roller/wheel may be compatible with this protocol.
282.It Ar mousesystems
283MouseSystems 5-byte protocol.  3-button mice may use this protocol.
284.It Ar mmseries
285MM Series mouse protocol.
286.It Ar logitech
287Logitech mouse protocol.  Note that this is for old Logitech models.
288.Ar mouseman
289or
290.Ar intellimouse
291should be specified for newer models.
292.It Ar mouseman
293Logitech MouseMan and TrackMan protocol.  Some 3-button mice may be compatible
294with this protocol.  Note that MouseMan+ and FirstMouse+ use
295.Ar intellimouse
296protocol rather than this one.
297.It Ar glidepoint
298ALPS GlidePoint protocol.
299.It Ar thinkingmouse
300Kensington ThinkingMouse protocol.
301.It Ar mmhitab
302Hitachi tablet protocol.
303.It Ar x10mouseremote
304X10 MouseRemote.
305.It Ar kidspad
306Genius Kidspad and Easypad protocol.
307.It Ar versapad
308Interlink VersaPad protocol.
309.El
310.Pp
311For the bus and InPort mouse:
312.Bl -tag -compact -width mousesystemsxxx
313.It Ar busmouse
314This is the only protocol type available for
315the bus and InPort mouse and should be specified for any bus mice
316and InPort mice, regardless of the brand.
317.El
318.Pp
319For the PS/2 mouse:
320.Bl -tag -compact -width mousesystemsxxx
321.It Ar ps/2
322This is the only protocol type available for the PS/2 mouse
323and should be specified for any PS/2 mice, regardless of the brand.
324.El
325.Pp
326For the USB mouse,
327.Ar auto
328is the only protocol type available for the USB mouse
329and should be specified for any USB mice, regardless of the brand.
330.It Fl w Ar N
331Make the physical button
332.Ar N
333act as the wheel mode button.
334While this button is pressed, X and Y axis movement is reported to be zero
335and the Y axis movement is mapped to Z axis.
336You may further map the Z axis movement to virtual buttons by the
337.Fl z
338option below.
339.It Fl z Ar target
340Map Z axis (roller/wheel) movement to another axis or to virtual buttons.
341Valid
342.Ar target
343maybe:
344.Bl -tag -compact -width x__
345.It Ar x
346.It Ar y
347X or Y axis movement will be reported when the Z axis movement is detected.
348.It Ar N
349Report down events for the virtual buttons
350.Ar N
351and
352.Ar N+1
353respectively when negative and positive Z axis movement
354is detected.
355There do not need to be physical buttons
356.Ar N
357and
358.Ar N+1 .
359Note that mapping to logical buttons is carried out after mapping
360from the Z axis movement to the virtual buttons is done.
361.It Ar N1 N2
362Report down events for the virtual buttons
363.Ar N1
364and
365.Ar N2
366respectively when negative and positive Z axis movement
367is detected.
368.It Ar N1 N2 N3 N4
369This is useful for the mouse with two wheels of which
370the second wheel is used to generate horizontal scroll action,
371and for the mouse which has a knob or a stick which can detect
372the horizontal force applied by the user.
373.Pp
374The motion of the second wheel will be mapped to the buttons
375.Ar N3 ,
376for the negative direction, and
377.Ar N4 ,
378for the positive direction.
379If the buttons
380.Ar N3
381and
382.Ar N4
383actually exist in this mouse, their actions will not be detected.
384.Pp
385Note that horizontal movement or second roller/wheel movement may not
386always be detected,
387because there appears to be no accepted standard as to how it is encoded.
388.Pp
389Note also that some mice think left is the negative horizontal direction,
390others may think otherwise.
391Moreover, there are some mice whose two wheels are both mounted vertically,
392and the direction of the second vertical wheel does not match the
393first one's.
394.El
395.El
396.Ss Configuring Mouse Daemon
397The first thing you need to know is the interface type
398of the mouse you are going to use.
399It can be determined by looking at the connector of the mouse.
400The serial mouse has a D-Sub female 9- or 25-pin connector.
401The bus and InPort mice have either a D-Sub male 9-pin connector
402or a round DIN 9-pin connector.
403The PS/2 mouse is equipped with a small, round DIN 6-pin connector.
404Some mice come with adapters with which the connector can
405be converted to another.  If you are to use such an adapter,
406remember the connector at the very end of the mouse/adapter pair is
407what matters.
408The USB mouse has a flat rectangular connector.
409.Pp
410The next thing to decide is a port to use for the given interface.
411For the bus, InPort and PS/2 mice, there is little choice:
412the bus and InPort mice always use
413.Pa /dev/mse0 ,
414and the PS/2 mouse is always at
415.Pa /dev/psm0 .
416There may be more than one serial port to which the serial
417mouse can be attached.  Many people often assign the first, built-in
418serial port
419.Pa /dev/cuaa0
420to the mouse.
421You can attach multiple USB mice to your system or to your USB hub.
422They are accessible as
423.Pa /dev/ums0 , /dev/ums1 ,
424and so on.
425.Pa
426You may want to create a symbolic link
427.Pa /dev/mouse
428pointing to the real port to which the mouse is connected, so that you
429can easily distinguish which is your ``mouse'' port later.
430.Pp
431The next step is to guess the appropriate protocol type for the mouse.
432The
433.Nm
434command may be able to automatically determine the protocol type.
435Run the
436.Nm
437command with the
438.Fl i
439option and see what it says.  If the command can identify
440the protocol type, no further investigation is necessary on your part.
441You may start the daemon without explicitly specifying a protocol type
442.Pq see Sx EXAMPLES .
443.Pp
444The command may print
445.Ar sysmouse
446if the mouse driver supports this protocol type.
447.Pp
448Note that the
449.Dv type
450and
451.Dv model
452printed by the
453.Fl i
454option do not necessarily match the product name of the pointing device
455in question, but they may give the name of the device with which it is
456compatible.
457.Pp
458If the
459.Fl i
460option yields nothing, you need to specify a protocol type to the
461.Nm
462command by the
463.Fl t
464option.
465You have to make a guess and try.
466There is rule of thumb:
467.Pp
468.Bl -enum -compact -width 1.X
469.It
470The bus and InPort mice always use
471.Ar busmouse
472protocol regardless of the brand of the mouse.
473.It
474The
475.Ar ps/2
476protocol should always be specified for the PS/2 mouse
477regardless of the brand of the mouse.
478.It
479You must specify the
480.Ar auto
481protocol for the USB mouse.
482.It
483Most 2-button serial mice support the
484.Ar microsoft
485protocol.
486.It
4873-button serial mice may work with the
488.Ar mousesystems
489protocol.
490If it does not, it may work with the
491.Ar microsoft
492protocol although
493the third (middle) button will not function.
4943-button serial mice may also work with the
495.Ar mouseman
496protocol under which the third button may function as expected.
497.It
4983-button serial mice may have a small switch to choose between ``MS''
499and ``PC'', or ``2'' and ``3''.
500``MS'' or ``2'' usually mean the
501.Ar microsoft
502protocol.
503``PC'' or ``3'' will choose the
504.Ar mousesystems
505protocol.
506.It
507If the mouse has a roller or a wheel, it may be compatible with the
508.Ar intellimouse
509protocol.
510.El
511.Pp
512To test if the selected protocol type is correct for the given mouse,
513enable the mouse pointer in the current virtual console,
514.Pp
515.Dl vidcontrol -m on
516.Pp
517start the mouse daemon in the foreground mode,
518.Pp
519.Dl moused -f -p Ar _selected_port_ -t Ar _selected_protocol_
520.Pp
521and see if the mouse pointer travels correctly
522according to the mouse movement.
523Then try cut & paste features by
524clicking the left, right and middle buttons.
525Type ^C to stop
526the command.
527.Ss Multiple Mice
528As many instances of the mouse daemon as the number of mice attached to
529the system may be run simultaneously; one
530instance for each mouse.
531This is useful if the user wants to use the built-in PS/2 pointing device
532of a laptop computer while on the road, but wants to use a serial
533mouse when s/he attaches the system to the docking station in the office.
534Run two mouse daemons and tell the application program
535.Pq such as the X Window System
536to use
537.Xr sysmouse ,
538then the application program will always see mouse data from either mice.
539When the serial mouse is not attached, the corresponding mouse daemon
540will not detect any movement or button state change and the application
541program will only see mouse data coming from the daemon for the
542PS/2 mouse.
543In contrast when both mice are attached and both of them
544are moved at the same time in this configuration,
545the mouse pointer will travel across the screen just as if movement of
546the mice is combined all together.
547.Sh FILES
548.Bl -tag -width /dev/consolectl -compact
549.It Pa /dev/consolectl
550device to control the console
551.It Pa /dev/mse%d
552bus and InPort mouse driver
553.It Pa /dev/psm%d
554PS/2 mouse driver
555.It Pa /dev/sysmouse
556virtualized mouse driver
557.It Pa /dev/ttyv%d
558virtual consoles
559.It Pa /dev/ums%d
560USB mouse driver
561.It Pa /var/run/moused.pid
562process id of the currently running
563.Nm
564daemon
565.It Pa /var/run/MouseRemote
566UNIX-domain stream socket for X10 MouseRemote events
567.El
568.Sh EXAMPLES
569.Pp
570.Dl moused -p /dev/cuaa0 -i type
571.Pp
572Let the
573.Nm
574command determine the protocol type of the mouse at the serial port
575.Pa /dev/cuaa0 .
576If successful, the command will print the type, otherwise it will say
577``unknown''.
578.Pp
579.Dl moused -p /dev/cuaa0
580.Dl vidcontrol -m on
581.Pp
582If the
583.Nm
584command is able to identify the protocol type of the mouse at the specified
585port automatically, you can start the daemon without the
586.Fl t
587option and enable the mouse pointer in the text console as above.
588.Pp
589.Dl moused -p /dev/mouse -t microsoft
590.Dl vidcontrol -m on
591.Pp
592Start the mouse daemon on the serial port
593.Pa /dev/mouse .
594The protocol type
595.Ar microsoft
596is explicitly specified by the
597.Fl t
598option.
599.Pp
600.Dl moused -p /dev/mouse -m 1=3 -m 3=1
601.Pp
602Assign the physical button 3 (right button) to the logical button 1
603(logical left) and the physical button 1 (left) to the logical
604button 3 (logical right).
605This will effectively swap the left and right buttons.
606.Pp
607.Dl moused -p /dev/mouse -t intellimouse -z 4
608.Pp
609Report negative Z axis (roller) movement as the button 4 pressed
610and positive Z axis movement as the button 5 pressed.
611.Sh CAVEATS
612The
613.Nm
614command does not currently work with the alternative console driver
615.Xr pcvt 4 .
616.Pp
617Many pad devices behave as if the first (left) button were pressed if
618the user `taps' the surface of the pad.
619In contrast, some ALPS GlidePoint and Interlink VersaPad models
620treat the tapping action
621as fourth button events.
622Use the option ``-m 1=4'' for these models
623to obtain the same effect as the other pad devices.
624.Pp
625Cut and paste functions in the virtual console assume that there
626are three buttons on the mouse.
627The logical button 1 (logical left) selects a region of text in the
628console and copies it to the cut buffer.
629The logical button 3 (logical right) extends the selected region.
630The logical button 2 (logical middle) pastes the selected text
631at the text cursor position.
632If the mouse has only two buttons, the middle, `paste' button
633is not available.
634To obtain the paste function, use the
635.Fl 3
636option to emulate the middle button, or use the
637.Fl m
638option to assign the physical right button to the logical middle button:
639``-m 2=3''.
640.Sh SEE ALSO
641.Xr kill 1 ,
642.Xr vidcontrol 1 ,
643.Xr keyboard 4 ,
644.Xr mse 4 ,
645.Xr pcvt 4 ,
646.Xr psm 4 ,
647.Xr screen 4 ,
648.Xr sysmouse 4 ,
649.Xr ums 4
650.Sh STANDARDS
651The
652.Nm
653command partially supports
654.Dq Plug and Play External COM Device Specification
655in order to support PnP serial mice.
656However, due to various degrees of conformance to the specification by
657existing serial mice, it does not strictly follow the version 1.0 of the
658standard.
659Even with this less strict approach,
660it may not always determine an appropriate protocol type
661for the given serial mouse.
662.Sh AUTHORS
663.An -nosplit
664The
665.Nm
666command was written by
667.An Michael Smith Aq msmith@FreeBSD.org .
668This manual page was written by
669.An Mike Pritchard Aq mpp@FreeBSD.org .
670The command and manual page have since been updated by
671.An Kazutaka Yokota Aq yokota@FreeBSD.org .
672.Sh HISTORY
673The
674.Nm
675command first appeared in
676.Fx 2.2 .
677