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