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.
34 .Nd PS/2 mouse style pointing device driver
36 .Cd "options KBD_RESETDELAY=N"
37 .Cd "options KBD_MAXWAIT=N"
38 .Cd "options PSM_DEBUG=N"
39 .Cd "options KBDIO_DEBUG=N"
43 .Pa /boot/device.hints :
44 .Cd hint.psm.0.at="atkbdc"
45 .Cd hint.psm.0.irq="12"
49 driver provides support for the PS/2 mouse style pointing device.
50 Currently there can be only one
52 device node in the system.
53 As the PS/2 mouse port is located
54 at the auxiliary port of the keyboard controller,
55 the keyboard controller driver,
57 must also be configured in the kernel.
58 Note that there is currently no provision of changing the
62 Basic PS/2 style pointing device has two or three buttons.
63 Some devices may have a roller or a wheel and/or additional buttons.
65 The PS/2 style pointing device usually has several grades of resolution,
66 that is, sensitivity of movement.
67 They are typically 25, 50, 100 and 200
69 Some devices may have finer resolution.
70 The current resolution can be changed at runtime.
73 driver allows the user to initially set the resolution
76 .Sx "DRIVER CONFIGURATION" )
77 or change it later via the
84 Frequency, or report rate, at which the device sends movement
85 and button state reports to the host system is also configurable.
86 The PS/2 style pointing device typically supports 10, 20, 40, 60, 80, 100
87 and 200 reports per second.
88 60 or 100 appears to be the default value for many devices.
89 Note that when there is no movement and no button has changed its state,
90 the device will not send anything to the host system.
91 The report rate can be changed via an ioctl call.
95 driver has three levels of operation.
96 The current operation level can be set via an ioctl call.
98 At the level zero the basic support is provided; the device driver will report
99 horizontal and vertical movement of the attached device
100 and state of up to three buttons.
101 The movement and status are encoded in a series of fixed-length data packets
103 .Sx "Data Packet Format" ) .
104 This is the default level of operation and the driver is initially
105 at this level when opened by the user program.
107 The operation level one, the `extended' level, supports a roller (or wheel),
108 if any, and up to 11 buttons.
109 The movement of the roller is reported as movement along the Z axis.
110 8 byte data packets are sent to the user program at this level.
112 At the operation level two, data from the pointing device is passed to the
113 user program as is. Conversely, command from the user program is passed
114 to the pointing device as is and the user program is responsible for
115 status validation and error recovery.
116 Modern PS/2 type pointing devices often use proprietary data format.
117 Therefore, the user program is expected to have
118 intimate knowledge about the format from a particular device when operating
119 the driver at this level.
120 This level is called `native' level.
121 .Ss Data Packet Format
122 Data packets read from the
124 driver are formatted differently at each operation level.
126 A data packet from the PS/2 mouse style pointing device
127 is three bytes long at the operation level zero:
129 .Bl -tag -width Byte_1 -compact
131 .Bl -tag -width bit_7 -compact
133 One indicates overflow in the vertical movement count.
135 One indicates overflow in the horizontal movement count.
137 Set if the vertical movement count is negative.
139 Set if the horizontal movement count is negative.
142 .\" The ALPS GlidePoint clears this bit when the user `taps' the surface of
143 .\" the pad, otherwise the bit is set.
144 .\" Most, if not all, other devices always set this bit.
146 Middle button status; set if pressed.
147 For devices without the middle
148 button, this bit is always zero.
150 Right button status; set if pressed.
152 Left button status; set if pressed.
155 Horizontal movement count in two's complement;
157 Note that the sign bit is in the first byte.
159 Vertical movement count in two's complement;
161 Note that the sign bit is in the first byte.
164 At the level one, a data packet is encoded
165 in the standard format
166 .Dv MOUSE_PROTO_SYSMOUSE
170 At the level two, native level, there is no standard on the size and format
175 driver can somewhat `accelerate' the movement of the pointing device.
176 The faster you move the device, the further the pointer
177 travels on the screen.
178 The driver has an internal variable which governs the effect of
180 Its value can be modified via the driver flag
181 or via an ioctl call.
182 .Sh DRIVER CONFIGURATION
183 .Ss Kernel Configuration Options
184 There are following kernel configuration options to control the
187 They may be set in the kernel configuration file
190 .Bl -tag -width MOUSE
191 .It Em KBD_RESETDELAY=X , KBD_MAXWAIT=Y
194 driver will attempt to reset the pointing device during the boot process.
195 It sometimes takes a long while before the device will respond after
197 These options control how long the driver should wait before
198 it eventually gives up waiting.
204 If the driver seems unable to detect your pointing
205 device, you may want to increase these values.
206 The default values are
212 .It Em PSM_DEBUG=N , KBDIO_DEBUG=N
213 Sets the debug level to
215 The default debug level is zero.
223 driver accepts the following driver flags.
225 .Pa /boot/device.hints
229 .Bl -tag -width MOUSE
230 .It bit 0..3 RESOLUTION
231 This flag specifies the resolution of the pointing device.
232 It must be zero through four.
233 The greater the value
234 is, the finer resolution the device will select.
235 Actual resolution selected by this field varies according to the model
237 Typical resolutions are:
239 .Bl -tag -width 0_(medium_high)__ -compact
241 25 pulse per inch (ppi)
242 .It Em 2 (medium low)
244 .It Em 3 (medium high)
250 Leaving this flag zero will selects the default resolution for the
251 device (whatever it is).
252 .It bit 4..7 ACCELERATION
253 This flag controls the amount of acceleration effect.
254 The smaller the value of this flag is, more sensitive the movement becomes.
255 The minimum value allowed, thus the value for the most sensitive setting,
257 Setting this flag to zero will completely disables the
259 .It bit 8 NOCHECKSYNC
262 driver tries to detect the first byte of the data packet by checking
263 the bit pattern of that byte.
264 Although this method should work with most
265 PS/2 pointing devices, it may interfere with some devices which are not
266 so compatible with known devices.
267 If you think your pointing device is not functioning as expected,
268 and the kernel frequently prints the following message to the console,
269 .Bd -literal -offset indent
270 psmintr: out of sync (xxxx != yyyy).
273 set this flag to disable synchronization check and see if it helps.
277 driver will not try to identify the model of the pointing device and
278 will not carry out model-specific initialization.
279 The device should always act like a standard PS/2 mouse without such
281 Extra features, such as wheels and additional buttons, will not be
286 When this flag is set, the
288 driver will not reset the pointing device when initializing the device.
292 is started after another OS has run, the pointing device will inherit
293 settings from the previous OS.
294 However, because there is no way for the
296 driver to know the settings, the device and the driver may not
298 The flag should never be necessary under normal circumstances.
300 Some pad devices report as if the fourth button is pressed
301 when the user `taps' the surface of the device (see
303 This flag will make the
305 driver assume that the device behaves this way.
306 Without the flag, the driver will assume this behavior
307 for ALPS GlidePoint models only.
308 .It bit 12 IGNOREPORTERROR
311 driver ignore certain error conditions when probing the PS/2 mouse port.
312 It should never be necessary under normal circumstances.
313 .It bit 13 HOOKRESUME
314 The built-in PS/2 pointing device of some laptop computers is somehow
315 not operable immediately after the system `resumes' from
316 the power saving mode,
317 though it will eventually become available.
318 There are reports that
319 stimulating the device by performing I/O will help
320 waking up the device quickly.
321 This flag will enable a piece of code in the
324 the `resume' event and exercise some harmless I/O operations on the
326 .It bit 14 INITAFTERSUSPEND
327 This flag adds more drastic action for the above problem.
330 driver to reset and re-initialize the pointing device
331 after the `resume' event.
334 Extended support for Synaptics touchpads can be enabled by setting
335 .Va hw.psm.synaptics_support
341 to handle packets from guest devices (sticks) and extra buttons.
343 Tap and drag gestures can be disabled by setting
344 .Va hw.psm.tap_enabled
348 Currently, this is only supported on Synaptics touchpads with Extended
349 support disabled. The behaviour may be changed after boot by setting
350 the sysctl with the same name and by restarting
353 .Pa /etc/rc.d/moused .
357 commands for mouse drivers.
358 These commands and related structures and constants are defined in
360 General description of the commands is given in
362 This section explains the features specific to the
366 .Bl -tag -width MOUSE -compact
367 .It Dv MOUSE_GETLEVEL Ar int *level
368 .It Dv MOUSE_SETLEVEL Ar int *level
369 These commands manipulate the operation level of the
373 .It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
374 Returns the hardware information of the attached device in the following
377 typedef struct mousehw {
378 int buttons; /* number of buttons */
379 int iftype; /* I/F type */
380 int type; /* mouse/track ball/pad... */
381 int model; /* I/F dependent model ID */
382 int hwid; /* I/F dependent hardware ID */
388 field holds the number of buttons on the device.
391 driver currently can detect the 3 button mouse from Logitech and report
393 The 3 button mouse from the other manufacturer may or may not be
395 However, it will not affect the operation of
405 tells the device type:
407 .Dv MOUSE_TRACKBALL ,
412 The user should not heavily rely on this field, as the
413 driver may not always, in fact it is very rarely able to, identify
419 .Dv MOUSE_MODEL_GENERIC
420 at the operation level 0.
422 .Dv MOUSE_MODEL_GENERIC
425 constants at higher operation levels.
428 driver may or may not set an appropriate value in this field.
432 is the ID value returned by the device.
435 .Bl -tag -width 0__ -compact
437 Mouse (Microsoft, Logitech and many other manufacturers)
439 Microsoft Ballpoint mouse
441 Microsoft IntelliMouse
444 .It Dv MOUSE_SYN_GETHWINFO Ar synapticshw_t *synhw
445 Retrieves extra information associated with Synaptics Touchpad.
446 Only available when a supported device has been detected.
448 typedef struct synapticshw {
449 int infoMajor; /* major hardware revision */
450 int infoMinor; /* minor hardware revision */
451 int infoRot180; /* touchpad is rotated */
452 int infoPortrait; /* touchpad is a portrait */
453 int infoSensor; /* sensor model */
454 int infoHardware; /* hardware model */
455 int infoNewAbs; /* supports the newabs format */
456 int capPen; /* can detect a pen */
457 int infoSimpleC; /* supports simple commands */
458 int infoGeometry; /* touchpad dimensions */
459 int capExtended; /* supports extended packets */
460 int capSleep; /* can be suspended/resumed */
461 int capFourButtons; /* has four buttons */
462 int capMultiFinger; /* can detect multiple fingers */
463 int capPalmDetect; /* can detect a palm */
464 int capPassthrough; /* can passthrough guest packets */
469 .Em Synaptics TouchPad Interfacing Guide
470 for more information about the fields in this structure.
472 .It Dv MOUSE_GETMODE Ar mousemode_t *mode
473 The command gets the current operation parameters of the mouse
476 typedef struct mousemode {
477 int protocol; /* MOUSE_PROTO_XXX */
478 int rate; /* report rate (per sec), -1 if unknown */
479 int resolution; /* MOUSE_RES_XXX, -1 if unknown */
480 int accelfactor; /* acceleration factor */
481 int level; /* driver operation level */
482 int packetsize; /* the length of the data packet */
483 unsigned char syncmask[2]; /* sync. bits */
491 at the operation level zero and two.
492 .Dv MOUSE_PROTO_SYSMOUSE
493 at the operation level one.
497 is the status report rate (reports/sec) at which the device will send
498 movement report to the host computer.
499 Typical supported values are 10, 20, 40, 60, 80, 100 and 200.
500 Some mice may accept other arbitrary values too.
504 of the pointing device must be one of
506 constants or a positive value.
507 The greater the value
508 is, the finer resolution the mouse will select.
509 Actual resolution selected by the
511 constant varies according to the model of mouse.
512 Typical resolutions are:
514 .Bl -tag -width MOUSE_RES_MEDIUMHIGH__ -compact
517 .It Dv MOUSE_RES_MEDIUMLOW
519 .It Dv MOUSE_RES_MEDIUMHIGH
521 .It Dv MOUSE_RES_HIGH
527 field holds a value to control acceleration feature
530 It must be zero or greater.
531 If it is zero, acceleration is disabled.
535 field specifies the length of the data packet.
537 operation level and the model of the pointing device.
539 .Bl -tag -width level_0__ -compact
545 Depends on the model of the device
550 holds a bit mask and pattern to detect the first byte of the
553 is the bit mask to be ANDed with a byte.
554 If the result is equal to
556 the byte is likely to be the first byte of the data packet.
557 Note that this detection method is not 100% reliable,
558 thus, should be taken only as an advisory measure.
560 .It Dv MOUSE_SETMODE Ar mousemode_t *mode
561 The command changes the current operation parameters of the mouse driver
571 Setting values in the other field does not generate
572 error and has no effect.
574 If you do not want to change the current setting of a field, put -1
576 You may also put zero in
580 and the default value for the fields will be selected.
582 .\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
583 .\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
584 .\" These commands are not supported by the
588 .It Dv MOUSE_READDATA Ar mousedata_t *data
589 .\" The command reads the raw data from the device.
591 .\" typedef struct mousedata {
592 .\" int len; /* # of data in the buffer */
593 .\" int buf[16]; /* data buffer */
597 .\" Upon returning to the user program, the driver will place the number
598 .\" of valid data bytes in the buffer in the
602 .It Dv MOUSE_READSTATE Ar mousedata_t *state
603 .\" The command reads the hardware settings from the device.
604 .\" Upon returning to the user program, the driver will place the number
605 .\" of valid data bytes in the buffer in the
607 .\" field. It is usually 3 bytes.
608 .\" The buffer is formatted as follows:
610 .\" .Bl -tag -width Byte_1 -compact
612 .\" .Bl -tag -width bit_6 -compact
616 .\" 0 - stream mode, 1 - remote mode.
617 .\" In the stream mode, the pointing device sends the device status
618 .\" whenever its state changes. In the remote mode, the host computer
619 .\" must request the status to be sent.
622 .\" driver puts the device in the stream mode.
624 .\" Set if the pointing device is currently enabled. Otherwise zero.
626 .\" 0 - 1:1 scaling, 1 - 2:1 scaling.
627 .\" 1:1 scaling is the default.
631 .\" Left button status; set if pressed.
633 .\" Middle button status; set if pressed.
635 .\" Right button status; set if pressed.
638 .\" .Bl -tag -width bit_6_0 -compact
642 .\" Resolution code: zero through three. Actual resolution for
643 .\" the resolution code varies from one device to another.
646 .\" The status report rate (reports/sec) at which the device will send
647 .\" movement report to the host computer.
649 These commands are not currently supported by the
653 .It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
654 The command returns the current state of buttons and
655 movement counts as described in
659 .Bl -tag -width /dev/npsm0 -compact
661 `non-blocking' device node
663 `blocking' device node
666 In order to install the
668 driver, you need to add
673 to your kernel configuration file, and put the following lines to
674 .Pa /boot/device.hints .
676 .Dl hint.atkbdc.0.at="isa"
677 .Dl hint.atkbdc.0.port="0x060"
678 .Dl hint.psm.0.at="atkbdc"
679 .Dl hint.psm.0.irq="12"
681 If you add the following statement to
682 .Pa /boot/device.hints ,
684 .Dl hint.psm.0.flags="0x2000"
686 you will add the optional code to stimulate the pointing device
687 after the `resume' event.
689 .Dl hint.psm.0.flags="0x24"
691 The above line will set the device resolution high (4)
692 and the acceleration factor to 2.
694 At debug level 0, little information is logged except for the following
695 line during boot process:
696 .Bd -literal -offset indent
702 the device ID code returned by the found pointing device.
707 At debug level 1 more information will be logged
708 while the driver probes the auxiliary port (mouse port).
709 Messages are logged with the LOG_KERN facility at the LOG_DEBUG level
712 .Bd -literal -offset indent
713 psm0: current command byte:xxxx
714 kbdio: TEST_AUX_PORT status:0000
715 kbdio: RESET_AUX return code:00fa
716 kbdio: RESET_AUX status:00aa
717 kbdio: RESET_AUX ID:0000
721 psm0: model AAAA, device ID X, N buttons
722 psm0: config:00000www, flags:0000uuuu, packet size:M
723 psm0: syncmask:xx, syncbits:yy
726 The first line shows the command byte value of the keyboard
727 controller just before the auxiliary port is probed.
728 It usually is 40, 45, 47 or 65, depending on how the motherboard BIOS
729 initialized the keyboard controller upon power-up.
731 The second line shows the result of the keyboard controller's
732 test on the auxiliary port interface, with zero indicating
733 no error; note that some controllers report no error even if
734 the port does not exist in the system, however.
736 The third through fifth lines show the reset status of the pointing device.
737 The functioning device should return the sequence of FA AA <ID>.
738 The ID code is described above.
740 The seventh line shows the current hardware settings.
742 .\" .Dv MOUSE_READSTATE
744 These bytes are formatted as follows:
746 .Bl -tag -width Byte_1 -compact
748 .Bl -tag -width bit_6 -compact
752 0 - stream mode, 1 - remote mode.
753 In the stream mode, the pointing device sends the device status
754 whenever its state changes.
755 In the remote mode, the host computer
756 must request the status to be sent.
759 driver puts the device in the stream mode.
761 Set if the pointing device is currently enabled.
764 0 - 1:1 scaling, 1 - 2:1 scaling.
765 1:1 scaling is the default.
769 Left button status; set if pressed.
771 Middle button status; set if pressed.
773 Right button status; set if pressed.
776 .Bl -tag -width bit_6_0 -compact
780 Resolution code: zero through three.
781 Actual resolution for
782 the resolution code varies from one device to another.
785 The status report rate (reports/sec) at which the device will send
786 movement report to the host computer.
789 Note that the pointing device will not be enabled until the
791 driver is opened by the user program.
793 The rest of the lines show the device ID code, the number of detected
794 buttons and internal variables.
796 At debug level 2, much more detailed information is logged.
807 .%T Synaptics TouchPad Interfacing Guide
808 .%U http://www.synaptics.com/
815 driver is based on the work done by quite a number of people, including
826 This manual page was written by
827 .An Kazutaka Yokota Aq yokota@FreeBSD.org .
829 Many pad devices behave as if the first (left) button were pressed if
830 the user `taps' the surface of the pad.
831 In contrast, some pad products, e.g.\& some versions of ALPS GlidePoint
832 and Interlink VersaPad, treat the tapping action
833 as fourth button events.
835 It is reported that ALPS GlidePoint, Synaptics Touchpad, and
836 Interlink VersaPad require
838 flag in order to recover from suspended state.
839 This flag is automatically set when one of these devices is detected by the
843 Some PS/2 mouse models from MouseSystems require to be put in the
844 high resolution mode to work properly.
845 Use the driver flag to
848 There is not a guaranteed way to re-synchronize with the first byte
849 of the packet once we are out of synchronization with the data
851 However, if you are using the \fIXFree86\fP server and experiencing
852 the problem, you may be able to make the X server synchronize with the mouse
853 by switching away to a virtual terminal and getting back to the X server,
854 unless the X server is accessing the mouse via
856 Clicking any button without moving the mouse may also work.
861 It was never functional anyway.
863 Enabling the extended support for Synaptics touchpads has been reported to
864 cause problems with responsivity on some (newer) models of Synaptics
865 hardware, particularly those with guest devices.