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