3 .\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer as
11 .\" the first lines of this file unmodified.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
16 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 .\" $FreeBSD: src/share/man/man4/psm.4,v 1.24.2.9 2002/12/29 16:35:38 schweikh Exp $
34 .Nd PS/2 mouse style pointing device driver
36 .Cd "device psm0 at atkbdc? irq 12"
38 .Cd "options KBD_RESETDELAY=N"
39 .Cd "options KBD_MAXWAIT=N"
40 .Cd "options PSM_DEBUG=N"
41 .Cd "options KBDIO_DEBUG=N"
45 driver provides support for the PS/2 mouse style pointing device.
46 Currently there can be only one
48 device node in the system.
49 As the PS/2 mouse port is located
50 at the auxiliary port of the keyboard controller,
51 the keyboard controller driver,
53 must also be configured in the kernel.
54 Note that there is currently no provision of changing the
58 Basic PS/2 style pointing device has two or three buttons.
59 Some devices may have a roller or a wheel and/or additional buttons.
61 The PS/2 style pointing device usually has several grades of resolution,
62 that is, sensitivity of movement.
63 They are typically 25, 50, 100 and 200
65 Some devices may have finer resolution.
66 The current resolution can be changed at runtime.
69 driver allows the user to initially set the resolution
72 .Sx "DRIVER CONFIGURATION" )
73 or change it later via the
80 Frequency, or report rate, at which the device sends movement
81 and button state reports to the host system is also configurable.
82 The PS/2 style pointing device typically supports 10, 20, 40, 60, 80, 100
83 and 200 reports per second.
84 60 or 100 appears to be the default value for many devices.
85 Note that when there is no movement and no button has changed its state,
86 the device won't send anything to the host system.
87 The report rate can be changed via an ioctl call.
91 driver has three levels of operation.
92 The current operation level can be set via an ioctl call.
94 At the level zero the basic support is provided; the device driver will report
95 horizontal and vertical movement of the attached device
96 and state of up to three buttons.
97 The movement and status are encoded in a series of fixed-length data packets
99 .Sx "Data Packet Format" ) .
100 This is the default level of operation and the driver is initially
101 at this level when opened by the user program.
103 The operation level one, the `extended' level, supports a roller (or wheel),
104 if any, and up to 11 buttons.
105 The movement of the roller is reported as movement along the Z axis.
106 8 byte data packets are sent to the user program at this level.
108 At the operation level two, data from the pointing device is passed to the
110 Modern PS/2 type pointing devices often use proprietary data format.
111 Therefore, the user program is expected to have
112 intimate knowledge about the format from a particular device when operating
113 the driver at this level.
114 This level is called `native' level.
115 .Ss Data Packet Format
116 Data packets read from the
118 driver are formatted differently at each operation level.
120 A data packet from the PS/2 mouse style pointing device
121 is three bytes long at the operation level zero:
123 .Bl -tag -width Byte_1 -compact
125 .Bl -tag -width bit_7 -compact
127 One indicates overflow in the vertical movement count.
129 One indicates overflow in the horizontal movement count.
131 Set if the vertical movement count is negative.
133 Set if the horizontal movement count is negative.
136 .\" The ALPS GlidePoint clears this bit when the user `taps' the surface of
137 .\" the pad, otherwise the bit is set.
138 .\" Most, if not all, other devices always set this bit.
140 Middle button status; set if pressed.
141 For devices without the middle
142 button, this bit is always zero.
144 Right button status; set if pressed.
146 Left button status; set if pressed.
149 Horizontal movement count in two's complement;
151 Note that the sign bit is in the first byte.
153 Vertical movement count in two's complement;
155 Note that the sign bit is in the first byte.
158 At the level one, a data packet is encoded
159 in the standard format
160 .Dv MOUSE_PROTO_SYSMOUSE
164 At the level two, native level, there is no standard on the size and format
169 driver can somewhat `accelerate' the movement of the pointing device.
170 The faster you move the device, the further the pointer
171 travels on the screen.
172 The driver has an internal variable which governs the effect of
174 Its value can be modified via the driver flag
175 or via an ioctl call.
176 .Sh DRIVER CONFIGURATION
177 .Ss Kernel Configuration Options
178 The following kernel configuration options can be used to control the
181 .Bl -tag -width MOUSE
182 .It Em KBD_RESETDELAY=X , KBD_MAXWAIT=Y
185 driver will attempt to reset the pointing device during the boot process.
186 It sometimes takes a long while before the device will respond after
188 These options control how long the driver should wait before
189 it eventually gives up waiting.
195 If the driver seems unable to detect your pointing
196 device, you may want to increase these values.
197 The default values are
203 .It Em PSM_DEBUG=N , KBDIO_DEBUG=N
204 Sets the debug level to
206 The default debug level is zero.
214 driver accepts the following driver flags in the kernel configuration file.
215 .Bl -tag -width MOUSE
216 .It bit 0..3 RESOLUTION
217 This flag specifies the resolution of the pointing device.
218 It must be zero through four.
219 The greater the value
220 is, the finer resolution the device will select.
221 Actual resolution selected by this field varies according to the model
223 Typical resolutions are:
225 .Bl -tag -width 0_(medium_high)__ -compact
227 25 pulse per inch (ppi)
228 .It Em 2 (medium low)
230 .It Em 3 (medium high)
236 Leaving this flag zero will selects the default resolution for the
237 device (whatever it is).
238 .It bit 4..7 ACCELERATION
239 This flag controls the amount of acceleration effect.
240 The smaller the value of this flag is, more sensitive the movement becomes.
241 The minimum value allowed, thus the value for the most sensitive setting,
243 Setting this flag to zero will completely disables the
245 .It bit 8 NOCHECKSYNC
248 driver tries to detect the first byte of the data packet by checking
249 the bit pattern of that byte.
250 Although this method should work with most
251 PS/2 pointing devices, it may interfere with some devices which are not
252 so compatible with known devices.
253 If you think your pointing device is not functioning as expected,
254 and the kernel frequently prints the following message to the console,
255 .Bd -literal -offset indent
256 psmintr: out of sync (xxxx != yyyy).
259 set this flag to disable synchronization check and see if it helps.
263 driver will not try to identify the model of the pointing device and
264 will not carry out model-specific initialization.
265 The device should always act like a standard PS/2 mouse without such
267 Extra features, such as wheels and additional buttons, won't be
272 When this flag is set, the
274 driver won't reset the pointing device when initializing the device.
278 is started after another OS has run, the pointing device will inherit
279 settings from the previous OS.
280 However, because there is no way for the
282 driver to know the settings, the device and the driver may not
284 The flag should never be necessary under normal circumstances.
286 Some pad devices report as if the fourth button is pressed
287 when the user `taps' the surface of the device (see
289 This flag will make the
291 driver assume that the device behaves this way.
292 Without the flag, the driver will assume this behavior
293 for ALPS GlidePoint models only.
294 .It bit 12 IGNOREPORTERROR
297 driver ignore certain error conditions when probing the PS/2 mouse port.
298 It should never be necessary under normal circumstances.
299 .It bit 13 HOOKRESUME
300 The built-in PS/2 pointing device of some laptop computers is somehow
301 not operable immediately after the system `resumes' from
302 the power saving mode,
303 though it will eventually become available.
304 There are reports that
305 stimulating the device by performing I/O will help
306 waking up the device quickly.
307 This flag will enable a piece of code in the
310 the `resume' event and exercise some harmless I/O operations on the
312 .It bit 14 INITAFTERSUSPEND
313 This flag adds more drastic action for the above problem.
316 driver to reset and re-initialize the pointing device
317 after the `resume' event.
318 It has no effect unless the
323 Extended support for Synaptics touchpads can be enabled by setting
324 .Va hw.psm.synaptics_support
330 to handle packets from guest devices (sticks) and extra buttons.
332 Tap and drag gestures can be disabled by setting
333 .Va hw.psm.tap_enabled
337 Currently, this is only supported on Synaptics touchpads with Extended
338 support disabled. The behaviour may be changed after boot by setting
339 the sysctl with the same name and by restarting
342 .Pa /etc/rc.d/moused .
346 commands for mouse drivers.
347 These commands and related structures and constants are defined in
349 General description of the commands is given in
351 This section explains the features specific to the
355 .Bl -tag -width MOUSE -compact
356 .It Dv MOUSE_GETLEVEL Ar int *level
357 .It Dv MOUSE_SETLEVEL Ar int *level
358 These commands manipulate the operation level of the
362 .It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
363 Returns the hardware information of the attached device in the following
366 typedef struct mousehw {
367 int buttons; /* number of buttons */
368 int iftype; /* I/F type */
369 int type; /* mouse/track ball/pad... */
370 int model; /* I/F dependent model ID */
371 int hwid; /* I/F dependent hardware ID */
377 field holds the number of buttons on the device.
380 driver currently can detect the 3 button mouse from Logitech and report
382 The 3 button mouse from the other manufacturer may or may not be
384 However, it will not affect the operation of
394 tells the device type:
396 .Dv MOUSE_TRACKBALL ,
401 The user should not heavily rely on this field, as the
402 driver may not always, in fact it is very rarely able to, identify
408 .Dv MOUSE_MODEL_GENERIC
409 at the operation level 0.
411 .Dv MOUSE_MODEL_GENERIC
414 constants at higher operation levels.
417 driver may or may not set an appropriate value in this field.
421 is the ID value returned by the device.
424 .Bl -tag -width 0__ -compact
426 Mouse (Microsoft, Logitech and many other manufacturers)
428 Microsoft Ballpoint mouse
430 Microsoft IntelliMouse
433 .It Dv MOUSE_SYN_GETHWINFO Ar synapticshw_t *synhw
434 Retrieves extra information associated with Synaptics Touchpads.
436 .Va hw.psm.synaptics_support
439 typedef struct synapticshw {
440 int infoMajor; /* major hardware revision */
441 int infoMinor; /* minor hardware revision */
442 int infoRot180; /* touchpad is rotated */
443 int infoPortrait; /* touchpad is a portrait */
444 int infoSensor; /* sensor model */
445 int infoHardware; /* hardware model */
446 int infoNewAbs; /* supports the newabs format */
447 int capPen; /* can detect a pen */
448 int infoSimpleC; /* supports simple commands */
449 int infoGeometry; /* touchpad dimensions */
450 int capExtended; /* supports extended packets */
451 int capSleep; /* can be suspended/resumed */
452 int capFourButtons; /* has four buttons */
453 int capMultiFinger; /* can detect multiple fingers */
454 int capPalmDetect; /* can detect a palm */
455 int capPassthrough; /* can passthrough guest packets */
460 .Em Synaptics TouchPad Interfacing Guide
461 for more information about the fields in this structure.
463 .It Dv MOUSE_GETMODE Ar mousemode_t *mode
464 The command gets the current operation parameters of the mouse
467 typedef struct mousemode {
468 int protocol; /* MOUSE_PROTO_XXX */
469 int rate; /* report rate (per sec), -1 if unknown */
470 int resolution; /* MOUSE_RES_XXX, -1 if unknown */
471 int accelfactor; /* acceleration factor */
472 int level; /* driver operation level */
473 int packetsize; /* the length of the data packet */
474 unsigned char syncmask[2]; /* sync. bits */
482 at the operation level zero and two.
483 .Dv MOUSE_PROTO_SYSMOUSE
484 at the operation level one.
488 is the status report rate (reports/sec) at which the device will send
489 movement report to the host computer.
490 Typical supported values are 10, 20, 40, 60, 80, 100 and 200.
491 Some mice may accept other arbitrary values too.
495 of the pointing device must be one of
497 constants or a positive value.
498 The greater the value
499 is, the finer resolution the mouse will select.
500 Actual resolution selected by the
502 constant varies according to the model of mouse.
503 Typical resolutions are:
505 .Bl -tag -width MOUSE_RES_MEDIUMHIGH__ -compact
508 .It Dv MOUSE_RES_MEDIUMLOW
510 .It Dv MOUSE_RES_MEDIUMHIGH
512 .It Dv MOUSE_RES_HIGH
518 field holds a value to control acceleration feature
521 It must be zero or greater. If it is zero, acceleration is disabled.
525 field specifies the length of the data packet.
527 operation level and the model of the pointing device.
529 .Bl -tag -width level_0__ -compact
535 Depends on the model of the device
540 holds a bit mask and pattern to detect the first byte of the
543 is the bit mask to be ANDed with a byte.
544 If the result is equal to
545 .Fa syncmask Ns Bq 1 ,
546 the byte is likely to be the first byte of the data packet.
547 Note that this detection method is not 100% reliable,
548 thus, should be taken only as an advisory measure.
550 .It Dv MOUSE_SETMODE Ar mousemode_t *mode
551 The command changes the current operation parameters of the mouse driver
561 Setting values in the other field does not generate
562 error and has no effect.
564 If you do not want to change the current setting of a field, put -1
566 You may also put zero in
570 and the default value for the fields will be selected.
572 .\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
573 .\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
574 .\" These commands are not supported by the
578 .It Dv MOUSE_READDATA Ar mousedata_t *data
579 .\" The command reads the raw data from the device.
581 .\" typedef struct mousedata {
582 .\" int len; /* # of data in the buffer */
583 .\" int buf[16]; /* data buffer */
587 .\" Upon returning to the user program, the driver will place the number
588 .\" of valid data bytes in the buffer in the
592 .It Dv MOUSE_READSTATE Ar mousedata_t *state
593 .\" The command reads the hardware settings from the device.
594 .\" Upon returning to the user program, the driver will place the number
595 .\" of valid data bytes in the buffer in the
597 .\" field. It is usually 3 bytes.
598 .\" The buffer is formatted as follows:
600 .\" .Bl -tag -width Byte_1 -compact
602 .\" .Bl -tag -width bit_6 -compact
606 .\" 0 - stream mode, 1 - remote mode.
607 .\" In the stream mode, the pointing device sends the device status
608 .\" whenever its state changes. In the remote mode, the host computer
609 .\" must request the status to be sent.
612 .\" driver puts the device in the stream mode.
614 .\" Set if the pointing device is currently enabled. Otherwise zero.
616 .\" 0 - 1:1 scaling, 1 - 2:1 scaling.
617 .\" 1:1 scaling is the default.
621 .\" Left button status; set if pressed.
623 .\" Middle button status; set if pressed.
625 .\" Right button status; set if pressed.
628 .\" .Bl -tag -width bit_6_0 -compact
632 .\" Resolution code: zero through three. Actual resolution for
633 .\" the resolution code varies from one device to another.
636 .\" The status report rate (reports/sec) at which the device will send
637 .\" movement report to the host computer.
639 These commands are not currently supported by the
643 .It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
644 The command returns the current state of buttons and
645 movement counts as described in
649 .Bl -tag -width /dev/npsm0 -compact
654 .Dl "device psm0 at atkbdc? irq 12 flags 0x2000"
658 driver to the kernel with the optional code to stimulate the pointing device
659 after the `resume' event.
661 .Dl "device psm0 at atkbdc? flags 0x024 irq 12"
663 Set the device resolution high (4) and the acceleration factor to 2.
665 At debug level 0, little information is logged except for the following
666 line during boot process:
667 .Bd -literal -offset indent
673 the device ID code returned by the found pointing device.
678 At debug level 1 more information will be logged
679 while the driver probes the auxiliary port (mouse port).
680 Messages are logged with the LOG_KERN facility at the LOG_DEBUG level
683 .Bd -literal -offset indent
684 psm0: current command byte:xxxx
685 kbdio: TEST_AUX_PORT status:0000
686 kbdio: RESET_AUX return code:00fa
687 kbdio: RESET_AUX status:00aa
688 kbdio: RESET_AUX ID:0000
692 psm0: model AAAA, device ID X, N buttons
693 psm0: config:00000www, flags:0000uuuu, packet size:M
694 psm0: syncmask:xx, syncbits:yy
697 The first line shows the command byte value of the keyboard
698 controller just before the auxiliary port is probed.
699 It usually is 4D, 45, 47 or 65, depending on how the motherboard BIOS
700 initialized the keyboard controller upon power-up.
702 The second line shows the result of the keyboard controller's
703 test on the auxiliary port interface, with zero indicating
704 no error; note that some controllers report no error even if
705 the port does not exist in the system, however.
707 The third through fifth lines show the reset status of the pointing device.
708 The functioning device should return the sequence of FA AA <ID>.
709 The ID code is described above.
711 The seventh line shows the current hardware settings.
713 .\" .Dv MOUSE_READSTATE
715 These bytes are formatted as follows:
717 .Bl -tag -width Byte_1 -compact
719 .Bl -tag -width bit_6 -compact
723 0 - stream mode, 1 - remote mode.
724 In the stream mode, the pointing device sends the device status
725 whenever its state changes.
726 In the remote mode, the host computer
727 must request the status to be sent.
730 driver puts the device in the stream mode.
732 Set if the pointing device is currently enabled.
735 0 - 1:1 scaling, 1 - 2:1 scaling.
736 1:1 scaling is the default.
740 Left button status; set if pressed.
742 Middle button status; set if pressed.
744 Right button status; set if pressed.
747 .Bl -tag -width bit_6_0 -compact
751 Resolution code: zero through three.
752 Actual resolution for
753 the resolution code varies from one device to another.
756 The status report rate (reports/sec) at which the device will send
757 movement report to the host computer.
760 Note that the pointing device will not be enabled until the
762 driver is opened by the user program.
764 The rest of the lines show the device ID code, the number of detected
765 buttons and internal variables.
767 At debug level 2, much more detailed information is logged.
769 Many pad devices behave as if the first (left) button were pressed if
770 the user `taps' the surface of the pad.
771 In contrast, some pad products, e.g. some versions of ALPS GlidePoint
772 and Interlink VersaPad, treat the tapping action
773 as fourth button events.
775 It is reported that Interlink VersaPad requires both
779 flags in order to recover from suspended state.
780 These flags are automatically set when VersaPad is detected by the
784 Some PS/2 mouse models from MouseSystems require to be put in the
785 high resolution mode to work properly.
786 Use the driver flag to
789 There is not a guaranteed way to re-synchronize with the first byte
790 of the packet once we are out of synchronization with the data
792 However, if you are using the \fIXFree86\fP server and experiencing
793 the problem, you may be able to make the X server synchronize with the mouse
794 by switching away to a virtual terminal and getting back to the X server,
795 unless the X server is accessing the mouse via
797 Clicking any button without moving the mouse may also work.
807 .%T Synaptics TouchPad Interfacing Guide
808 .%O http://www.synaptics.com/
814 driver is based on the work done by quite a number of people, including
825 This manual page was written by
826 .An Kazutaka Yokota Aq Mt yokota@FreeBSD.org .