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