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