psm.4 (31114) | psm.4 (31606) |
---|---|
1.\" $Id: psm.4,v 1.8 1997/10/19 10:45:18 yokota Exp $ | |
2.\" | 1.\" |
3.Dd January 13, 1997 | 2.\" Copyright (c) 1997 3.\" Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 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. 15.\" 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. 26.\" 27.\" $Id: psm.4,v 1.7 1997/02/22 13:25:39 peter Exp $ 28.\" 29.Dd December 3, 1997 |
4.Dt PSM 4 i386 5.Os FreeBSD 6.Sh NAME 7.Nm psm 8.Nd 9PS/2 mouse style pointing device driver 10.Sh SYNOPSIS | 30.Dt PSM 4 i386 31.Os FreeBSD 32.Sh NAME 33.Nm psm 34.Nd 35PS/2 mouse style pointing device driver 36.Sh SYNOPSIS |
11.Cd "options PSM_CHECKSYNC" 12.\".Cd "options PSM_EMULATION" 13.Cd "options" \&"PSM_ACCEL=N\&" | |
14.Cd "options" \&"PSM_HOOKAPM\&" 15.Cd "options" \&"PSM_RESETAFTERSUSPEND\&" 16.Cd "options" \&"KBD_RESETDELAY=N\&" 17.Cd "options" \&"KBD_MAXWAIT=N\&" 18.Cd "options" \&"PSM_DEBUG=N\&" 19.Cd "options" \&"KBDIO_DEBUG=N\&" 20.Cd "device psm0 at isa? port" \&"IO_KBD\&" conflicts tty irq 12 vector psmintr 21.Sh DESCRIPTION 22The 23.Nm 24driver provides support for the PS/2 mouse style pointing device. | 37.Cd "options" \&"PSM_HOOKAPM\&" 38.Cd "options" \&"PSM_RESETAFTERSUSPEND\&" 39.Cd "options" \&"KBD_RESETDELAY=N\&" 40.Cd "options" \&"KBD_MAXWAIT=N\&" 41.Cd "options" \&"PSM_DEBUG=N\&" 42.Cd "options" \&"KBDIO_DEBUG=N\&" 43.Cd "device psm0 at isa? port" \&"IO_KBD\&" conflicts tty irq 12 vector psmintr 44.Sh DESCRIPTION 45The 46.Nm 47driver provides support for the PS/2 mouse style pointing device. |
25 | 48Currently there can be only one 49.Nm 50device node in the system. |
26.Em port \&"IO_KBD\&" 27and 28.Em conflicts 29are required, 30as the PS/2 mouse port is located | 51.Em port \&"IO_KBD\&" 52and 53.Em conflicts 54are required, 55as the PS/2 mouse port is located |
31at the auxiliary port of the keyboard controller, thus, the | 56at the auxiliary port of the keyboard controller; the |
32.Nm 33driver has to share the same I/O ports with the keyboard driver. 34Note also that there is currently no provision of changing the 35.Em irq 36number. 37.Pp | 57.Nm 58driver has to share the same I/O ports with the keyboard driver. 59Note also that there is currently no provision of changing the 60.Em irq 61number. 62.Pp |
38A series of data packets is read from the | 63Basic PS/2 style pointing device has two or three buttons. 64Some devices may have a roller or a wheel and/or additional buttons. 65.Ss Device Resolution 66The PS/2 style pointing device usually has several grades of resolution, 67that is, sensitivity of movement. They are typically 25, 50, 100 and 200 68pulse per inch. Some devices may have finer resolution. 69The current resolution can be changed at runtime. The |
39.Nm | 70.Nm |
40driver. A data packet from the PS/2 mouse style pointing device 41is three bytes long: | 71driver allows the user to initially set the resolution 72via the driver flag 73.Pq see Sx DRIVER CONFIGURATION 74or change it later via the 75.Xr ioctl 2 76command 77.Dv MOUSE_SETMODE 78.Pq see Sx IOCTLS . 79.Ss Report Rate 80Frequency, or report rate, at which the device sends movement 81and button state reports to the host system is also configurable. 82The PS/2 style pointing device typically supports 10, 20, 40, 60, 80, 100 83and 200 reports per second. 8460 or 100 appears to be the default value for many devices. 85Note that when there is no movement and no button has changed its state, 86the device won't send anything to the host system. 87The report rate can be changed via an ioctl call. 88.Ss Operation Levels 89The 90.Nm 91driver has three levels of operation. 92The current operation level can be set via an ioctl call. |
42.Pp | 93.Pp |
94At the level zero the basic support is provided; the device driver will report 95horizontal and vertical movement of the attached device 96and state of up to three buttons. 97The movement and status are encoded in a series of fixed-length data packets 98.Pq see Sx Data Packet Format . 99This is the default level of operation and the driver is initially 100at this level when opened by the user program. 101.Pp 102The operation level one, the `extended' level, supports a roller (or wheel), 103if any, and up to 11 buttons. 104The movement of the roller is reported as movement along the Z axis. 1058 byte data packets are sent to the user program at this level. 106.Pp 107At the operation level two, data from the pointing device is passed to the 108user program as is. 109Modern PS/2 type pointing devices often use proprietary data format. 110Therefore, the user program is expected to have 111intimate knowledge about the format from a particular device when operating 112the driver at this level. 113This level is called `native' level. 114.Ss Data Packet Format 115Data packets read from the 116.Nm 117driver are formatted differently at each operation level. 118.Pp 119A data packet from the PS/2 mouse style pointing device 120is three bytes long at the operation level zero: 121.Pp |
|
43.Bl -tag -width Byte_1 -compact 44.It Byte 1 45.Bl -tag -width bit_7 -compact 46.It bit 7 47One indicates overflow in the vertical movement count. 48.It bit 6 49One indicates overflow in the horizontal movement count. 50.It bit 5 51Set if the vertical movement count is negative. 52.It bit 4 53Set if the horizontal movement count is negative. 54.It bit 3 | 122.Bl -tag -width Byte_1 -compact 123.It Byte 1 124.Bl -tag -width bit_7 -compact 125.It bit 7 126One indicates overflow in the vertical movement count. 127.It bit 6 128One indicates overflow in the horizontal movement count. 129.It bit 5 130Set if the vertical movement count is negative. 131.It bit 4 132Set if the horizontal movement count is negative. 133.It bit 3 |
55The ALPS GlidePoint clears this bit when the user `taps' the surface of 56the pad, otherwise the bit is set. 57Most, if not all, other devices always sets this bit. | 134Always one. 135.\" The ALPS GlidePoint clears this bit when the user `taps' the surface of 136.\" the pad, otherwise the bit is set. 137.\" Most, if not all, other devices always set this bit. |
58.It bit 2 59Middle button status; set if pressed. For devices without the middle | 138.It bit 2 139Middle button status; set if pressed. For devices without the middle |
60button, this bit seems to be always zero. | 140button, this bit is always zero. |
61.It bit 1 62Right button status; set if pressed. 63.It bit 0 64Left button status; set if pressed. 65.El 66.It Byte 2 67Horizontal movement count in two's compliment; 68-256 through 255. 69Note that the sign bit is in the first byte. 70.It Byte 3 71Vertical movement count in two's compliment; 72-256 through 255. 73Note that the sign bit is in the first byte. 74.El 75.Pp | 141.It bit 1 142Right button status; set if pressed. 143.It bit 0 144Left button status; set if pressed. 145.El 146.It Byte 2 147Horizontal movement count in two's compliment; 148-256 through 255. 149Note that the sign bit is in the first byte. 150.It Byte 3 151Vertical movement count in two's compliment; 152-256 through 255. 153Note that the sign bit is in the first byte. 154.El 155.Pp |
156At the level one, a data packet is encoded 157in the standard format 158.Dv MOUSE_PROTO_SYSMOUSE 159as defined in 160.Xr mouse 4 . 161.Pp 162At the level two, native level, there is no standard on the size and format 163of the data packet. 164.Ss Acceleration 165The 166.Nm 167driver can somewhat `accelerate' the movement of the pointing device. 168The faster you move the device, the further the pointer 169travels on the screen. 170The driver has an internal variable which governs the effect of 171the acceleration. Its value can be modified via the driver flag 172or via an ioctl call. 173.Ss Device Number |
|
76The minor device number of the 77.Nm 78is made up of: 79.Bd -literal -offset indent 80minor = (`unit' << 1) | `non-blocking' 81.Ed 82.Pp 83where `unit' is the device number (usually 0) and the `non-blocking' bit 84is set to indicate ``don't block waiting for mouse input, 85return immediately''. 86The `non-blocking' bit should be set for \fIXFree86\fP, 87therefore the minor device number usually used for \fIXFree86\fP is 1. 88See 89.Sx FILES 90for device node names. | 174The minor device number of the 175.Nm 176is made up of: 177.Bd -literal -offset indent 178minor = (`unit' << 1) | `non-blocking' 179.Ed 180.Pp 181where `unit' is the device number (usually 0) and the `non-blocking' bit 182is set to indicate ``don't block waiting for mouse input, 183return immediately''. 184The `non-blocking' bit should be set for \fIXFree86\fP, 185therefore the minor device number usually used for \fIXFree86\fP is 1. 186See 187.Sx FILES 188for device node names. |
91.Sh KERNEL CONFIGURATION 92There are following options to control the | 189.Sh DRIVER CONFIGURATION 190.Ss Kernel Configuration Options 191There are following kernel configuration options to control the |
93.Nm 94driver. | 192.Nm 193driver. |
194They may be set in the kernel configuration file 195.Pq see Xr config 8 . |
|
95.Bl -tag -width MOUSE | 196.Bl -tag -width MOUSE |
96.It Em PSM_CHECKSYNC 97If this option is defined, the driver tries to detect the first byte of 98the three-byte data packet, by checking the bit pattern of that byte. 99This may be useful if you often experience wierd mouse movement 100cased by unsynchronization between the application program and the mouse. 101However, the 102.Em PSM_CHECKSYNC 103code may not always work; some systems, mostly notebooks, set the bit 104pattern differently from the others. 105Note also that the `tapping' feature of the ALPS GlidePoint will be 106lost when this option is used. 107.\".It Em PSM_EMULATION 108.\"The 109.\".Nm 110.\"driver can emulate the Microsoft Serial Mouse's three-byte 111.\"data packet and the Mouse Systems Corp's five-byte data packet 112.\"when data is read by user programs, if so specified by the 113.\".Fn ioctl 114.\"command 115.\".Dv MOUSE_SETMODE . 116.\"To enable the emulation feature, define this option. 117.It Em PSM_ACCEL=N 118The 119.Nm 120driver can somewhat `accelerate' the movement of the pointing device. 121That is, the faster you move the device, the further the pointer 122travels on the screen. This option controls the amount of acceleration. 123The smaller 124.Fa N 125is, more sensitive the movement becomes. 126The minimum value allowed, thus the value for the most sensitive setting, 127is 1. Setting this option to zero will completely disables the 128acceleration effect. The default value is 0 (acceleration disabled). 129The acceleration effect can also be controlled via the 130.Fn ioctl 131command 132.Dv MOUSE_SETMODE . | |
133.It Em PSM_HOOKAPM 134The built-in PS/2 pointing device of some laptop computers is somehow 135not operable immediately after the system `resumes' from 136the power saving mode, 137though it will eventually become available. 138There are reports that 139stimulating the device by performing I/O will help 140waking up the device quickly. This option will add a piece of code --- 29 unchanged lines hidden (view full) --- 170.Fa Y . 171.It Em PSM_DEBUG=N, KBDIO_DEBUG=N 172Sets the debug level to 173.Fa N . 174The default debug level is zero. See 175.Sx DIAGNOSTICS 176for debug logging. 177.El | 197.It Em PSM_HOOKAPM 198The built-in PS/2 pointing device of some laptop computers is somehow 199not operable immediately after the system `resumes' from 200the power saving mode, 201though it will eventually become available. 202There are reports that 203stimulating the device by performing I/O will help 204waking up the device quickly. This option will add a piece of code --- 29 unchanged lines hidden (view full) --- 234.Fa Y . 235.It Em PSM_DEBUG=N, KBDIO_DEBUG=N 236Sets the debug level to 237.Fa N . 238The default debug level is zero. See 239.Sx DIAGNOSTICS 240for debug logging. 241.El |
178.Sh IOCTL 179There are only few ioctls for the | 242.Ss Driver Flags 243The |
180.Nm | 244.Nm |
181driver. These are defined in 182.Ao Pa machine/mouse.h Ac . | 245driver accepts the following driver flags. Set them in the 246kernel configuration file or in the User Configuration Menu at 247the boot time 248.Pq see Xr boot 8 . 249.Pp |
183.Bl -tag -width MOUSE | 250.Bl -tag -width MOUSE |
184.It Dv MOUSEIOCREAD 185The 186.Dv MOUSEIOCREAD 187command did NOT work before and does NOT work now. It is obsolete. 188Use the 189.Dv MOUSE_GETSTATE 190command instead. 191.It Dv MOUSE_GETSTATE 192The command returns the current mouse state in the following structure 193and remove the state information from the internal queue. 194.Bd -literal 195typedef struct mousestatus { 196 int button; /* button status */ 197 int obutton; /* previous button status */ 198 int dx; /* x movement */ 199 int dy; /* y movement */ 200} mousestatus_t; 201.Ed | 251.It bit 0..3 RESOLUTION 252This flag specifies the resolution of the pointing device. 253It must be zero through four. The greater the value 254is, the finer resolution the device will select. 255Actual resolution selected by this field varies according to the model 256of the device. Typical resolutions are: |
202.Pp | 257.Pp |
258.Bl -tag -width 0_(medium_high)__ -compact 259.It Em 1 (low) 26025 pulse per inch (ppi) 261.It Em 2 (medium low) 26250 ppi 263.It Em 3 (medium high) 264100 ppi 265.It Em 4 (high) 266200 ppi 267.El 268.Pp 269Leaving this flag zero will selects the default resolution for the 270device (whatever it is). 271.It bit 4..7 ACCELERATION 272This flag controls the amount of acceleration effect. 273The smaller the value of this flag is, more sensitive the movement becomes. 274The minimum value allowed, thus the value for the most sensitive setting, 275is one. Setting this flag to zero will completely disables the 276acceleration effect. 277.It bit 8 NOCHECKSYNC |
|
203The | 278The |
204.Dv button 205and the 206.Dv obutton 207fields hold the current and the previous state of the mouse buttons. 208When a button is pressed, the corresponding bit is set. 209These bits are defined as 210.Dv MOUSE_BUTTON1DOWN 211through 212.Dv MOUSE_BUTTON8DOWN . 213The first three buttons are left, middle and right buttons. | 279.Nm 280driver tries to detect the first byte of the data packet by checking 281the bit pattern of that byte. Although this method should work with most 282PS/2 pointing devices, it may interfere with some devices which are not 283so compatible with known devices. 284If you think your pointing device is not functioning as expected, 285see if disabling synchronization check will help by setting this flag. 286.El 287.Sh IOCTLS 288There are a few 289.Xr ioctl 2 290commands for mouse drivers. 291These commands and related structures and constants are defined in 292.Ao Pa machine/mouse.h Ac . 293General description of the commands is given in 294.Xr mouse 4 . 295This section explains the features specific to the 296.Nm 297driver. |
214.Pp | 298.Pp |
215Note that this command and 216.Fn read 217operation on the | 299.Bl -tag -width MOUSE -compact 300.It Dv MOUSE_GETLEVEL Ar int *level 301.It Dv MOUSE_SETLEVEL Ar int *level 302These commands manipulate the operation level of the |
218.Nm | 303.Nm |
219driver uses the same internal queue. Therefore, interleaving the 220.Dv MOUSE_GETSTATE 221command and 222.Fn read 223operation is not recommended. 224.It Dv MOUSE_GETHWINFO 225Returns the hardware information in the following structure. | 304driver. 305.Pp 306.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw 307Returns the hardware information of the attached device in the following 308structure. |
226.Bd -literal 227typedef struct mousehw { 228 int buttons; /* number of buttons */ 229 int iftype; /* I/F type */ 230 int type; /* mouse/track ball/pad... */ | 309.Bd -literal 310typedef struct mousehw { 311 int buttons; /* number of buttons */ 312 int iftype; /* I/F type */ 313 int type; /* mouse/track ball/pad... */ |
314 int model; /* I/F dependent model ID */ |
|
231 int hwid; /* I/F dependent hardware ID */ 232} mousehw_t; 233.Ed 234.Pp 235The | 315 int hwid; /* I/F dependent hardware ID */ 316} mousehw_t; 317.Ed 318.Pp 319The |
236.Dv iftype 237is 238.Dv MOUSE_IF_PS2 239for the | 320.Dv buttons 321field holds the number of buttons on the device. 322The |
240.Nm | 323.Nm |
241driver. The | 324driver currently can detect the 3 button mouse from Logitech and report 325accordingly. 326The 3 button mouse from the other manufacturer may or may not be 327reported correctly. However, it will not affect the operation of 328the driver. 329.Pp 330The 331.Dv iftype 332is always 333.Dv MOUSE_IF_PS2 . 334.Pp 335The |
242.Dv type 243tells the device type: 244.Dv MOUSE_MOUSE , 245.Dv MOUSE_TRACKBALL , 246.Dv MOUSE_STICK , 247.Dv MOUSE_PAD , 248or 249.Dv MOUSE_UNKNOWN . 250The user should not heavily rely on this field, as the | 336.Dv type 337tells the device type: 338.Dv MOUSE_MOUSE , 339.Dv MOUSE_TRACKBALL , 340.Dv MOUSE_STICK , 341.Dv MOUSE_PAD , 342or 343.Dv MOUSE_UNKNOWN . 344The user should not heavily rely on this field, as the |
251.Nm | |
252driver may not always, in fact it is very rarely able to, identify 253the device type. | 345driver may not always, in fact it is very rarely able to, identify 346the device type. |
347.Pp |
|
254The | 348The |
349.Dv model 350is always 351.Dv MOUSE_MODEL_GENERIC 352at the operation level 0. 353It may be 354.Dv MOUSE_MODEL_GENERIC 355or one of 356.Dv MOUSE_MODEL_XXX 357constants at higher operation levels. 358Again the 359.Nm 360driver may or may not set an appropriate value in this field. 361.Pp 362The |
|
255.Dv hwid | 363.Dv hwid |
256is the ID value returned by the pointing device. | 364is the ID value returned by the device. |
257Known IDs include: | 365Known IDs include: |
366.Pp |
|
258.Bl -tag -width 0__ -compact 259.It Em 0 260Mouse (Microsoft, Logitech and many other manufacturers) 261.It Em 2 262Microsoft Ballpoint mouse | 367.Bl -tag -width 0__ -compact 368.It Em 0 369Mouse (Microsoft, Logitech and many other manufacturers) 370.It Em 2 371Microsoft Ballpoint mouse |
372.It Em 3 373Microsoft IntelliMouse |
|
263.El | 374.El |
264.It Dv MOUSE_GETMODE, MOUSE_SETMODE 265The commands get and set the operation mode of the 266.Nm | 375.Pp 376.It Dv MOUSE_GETMODE Ar mousemode_t *mode 377The command gets the current operation parameters of the mouse |
267driver. 268.Bd -literal 269typedef struct mousemode { 270 int protocol; /* MOUSE_PROTO_XXX */ 271 int rate; /* report rate (per sec), -1 if unknown */ | 378driver. 379.Bd -literal 380typedef struct mousemode { 381 int protocol; /* MOUSE_PROTO_XXX */ 382 int rate; /* report rate (per sec), -1 if unknown */ |
272 int resolution; /* 1:low, 2:medium low, 3:medium high 273 * 4:high, 0: default, -1 if unknown 274 */ 275 int accelfactor; /* acceleration factor (must be 1 or greater) */ | 383 int resolution; /* MOUSE_RES_XXX, -1 if unknown */ 384 int accelfactor; /* acceleration factor */ 385 int level; /* driver operation level */ 386 int packetsize; /* the length of the data packet */ 387 unsigned char syncmask[2]; /* sync. bits */ |
276} mousemode_t; 277.Ed 278.Pp 279The 280.Dv protocol | 388} mousemode_t; 389.Ed 390.Pp 391The 392.Dv protocol |
281selects the format with which the device status is returned by 282.Fn read . 283The default is 284.Dv MOUSE_PROTO_PS2 , 285that is, the data byte from the pointing device is read by user 286programs as is. 287No other value is allowed at the moment. 288.\"Other possible values are: 289.\".Dv MOUSE_PROTO_MSS 290.\"and 291.\".Dv MOUSE_PROTO_MSC , 292.\"which specifies Microsoft Serial Mouse three-byte format and 293.\"Mouse Systems Corp.'s five-byte format respectively. 294.\"Note that the protocol cannot be set to anything other than 295.\".Dv MOUSE_PROTO_PS2 296.\"unless the 297.\".Em PSM_EMULATION 298.\"option is specified in the kernel configuration file. | 393is 394.Dv MOUSE_PROTO_PS2 395at the operation level zero and two. 396.Dv MOUSE_PROTO_SYSMOUSE 397at the operation level one. |
299.Pp 300The 301.Dv rate 302is the status report rate (reports/sec) at which the device will send 303movement report to the host computer. | 398.Pp 399The 400.Dv rate 401is the status report rate (reports/sec) at which the device will send 402movement report to the host computer. |
403Typical supported values are 10, 20, 40, 60, 80, 100 and 200. 404Some mice may accept other arbitrary values too. |
|
304.Pp 305The 306.Dv resolution | 405.Pp 406The 407.Dv resolution |
307of the pointing device must be zero through four. The higher the value 308is, the finer resolution the mouse will select. Zero selects the 309default resolution. | 408of the pointing device must be one of 409.Dv MOUSE_RES_XXX 410constants or a positive value. The greater the value 411is, the finer resolution the mouse will select. 412Actual resolution selected by the 413.Dv MOUSE_RES_XXX 414constant varies according to the model of mouse. Typical resolutions are: |
310.Pp | 415.Pp |
416.Bl -tag -width MOUSE_RES_MEDIUMHIGH__ -compact 417.It Dv MOUSE_RES_LOW 41825 ppi 419.It Dv MOUSE_RES_MEDIUMLOW 42050 ppi 421.It Dv MOUSE_RES_MEDIUMHIGH 422100 ppi 423.It Dv MOUSE_RES_HIGH 424200 ppi 425.El 426.Pp |
|
311The 312.Dv accelfactor | 427The 428.Dv accelfactor |
313holds a value to control acceleration feature (see description on 314.Em PSM_ACCEL 315above). It must be zero or greater. 316If it is zero, acceleration is disabled. | 429field holds a value to control acceleration feature 430.Pq see Sx Acceleration . 431It must be zero or greater. If it is zero, acceleration is disabled. 432.Pp 433The 434.Dv packetsize 435field specifies the length of the data packet. It depends on the 436operation level and the model of the pointing device. 437.Pp 438.Bl -tag -width level_0__ -compact 439.It Em level 0 4403 bytes 441.It Em level 1 4428 bytes 443.It Em level 2 444Depends on the model of the device |
317.El | 445.El |
446.Pp 447The array 448.Dv syncmask 449holds a bit mask and pattern to detect the first byte of the 450data packet. 451.Dv syncmask[0] 452is the bit mask to be ANDed with a byte. If the result is equal to 453.Dv syncmask[1] , 454the byte is likely to be the first byte of the data packet. 455Note that this detection method is not 100% reliable, 456thus, should be taken only as an advisory measure. 457.Pp 458.It Dv MOUSE_SETMODE Ar mousemode_t *mode 459The command changes the current operation parameters of the mouse driver 460as specified in 461.Ar mode . 462Only 463.Dv rate , 464.Dv resolution , 465.Dv level 466and 467.Dv accelfactor 468may be modifiable. Setting values in the other field does not generate 469error and has no effect. 470.Pp 471If you do not want to change the current setting of a field, put -1 472there. 473You may also put zero in 474.Dv resolution 475and 476.Dv rate , 477and the default value for the fields will be selected. 478.\" .Pp 479.\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars 480.\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars 481.\" These commands are not supported by the 482.\" .Nm 483.\" driver. 484.Pp 485.It Dv MOUSE_READDATA Ar mousedata_t *data 486.\" The command reads the raw data from the device. 487.\" .Bd -literal 488.\" typedef struct mousedata { 489.\" int len; /* # of data in the buffer */ 490.\" int buf[16]; /* data buffer */ 491.\" } mousedata_t; 492.\" .Ed 493.\" .Pp 494.\" Upon returning to the user program, the driver will place the number 495.\" of valid data bytes in the buffer in the 496.\" .Dv len 497.\" field. 498.\" .Pp 499.It Dv MOUSE_READSTATE Ar mousedata_t *state 500.\" The command reads the hardware settings from the device. 501.\" Upon returning to the user program, the driver will place the number 502.\" of valid data bytes in the buffer in the 503.\" .Dv len 504.\" field. It is usually 3 bytes. 505.\" The buffer is formatted as follows: 506.\" .Pp 507.\" .Bl -tag -width Byte_1 -compact 508.\" .It Byte 1 509.\" .Bl -tag -width bit_6 -compact 510.\" .It bit 7 511.\" Reserved. 512.\" .It bit 6 513.\" 0 - stream mode, 1 - remote mode. 514.\" In the stream mode, the pointing device sends the device status 515.\" whenever its state changes. In the remote mode, the host computer 516.\" must request the status to be sent. 517.\" The 518.\" .Nm 519.\" driver puts the device in the stream mode. 520.\" .It bit 5 521.\" Set if the pointing device is currently enabled. Otherwise zero. 522.\" .It bit 4 523.\" 0 - 1:1 scaling, 1 - 2:1 scaling. 524.\" 1:1 scaling is the default. 525.\" .It bit 3 526.\" Reserved. 527.\" .It bit 2 528.\" Left button status; set if pressed. 529.\" .It bit 1 530.\" Middle button status; set if pressed. 531.\" .It bit 0 532.\" Right button status; set if pressed. 533.\" .El 534.\" .It Byte 2 535.\" .Bl -tag -width bit_6_0 -compact 536.\" .It bit 7 537.\" Reserved. 538.\" .It bit 6..0 539.\" Resolution code: zero through three. Actual resolution for 540.\" the resolution code varies from one device to another. 541.\" .El 542.\" .It Byte 3 543.\" The status report rate (reports/sec) at which the device will send 544.\" movement report to the host computer. 545.\" .El 546These commands are not currently supported by the 547.Nm 548driver. 549.Pp 550.It Dv MOUSE_GETSTATE Ar mousestatus_t *status 551The command returns the current state of buttons and 552movement counts as described in 553.Xr mouse 4 . 554.El 555.Sh FILES 556.Bl -tag -width /dev/npsm0 -compact 557.It Pa /dev/psm0 558`non-blocking' device node in the system without 559.Em devfs , 560`blocking' under 561.Em devfs . 562.It Pa /dev/npsm0 563`non-blocking' device node under 564.Em devfs . 565.El 566.Sh EXAMPLE 567.Dl "options" \&"PSM_HOOKAPM\&" 568.Dl "device psm0 at isa? port" \&"IO_KBD\&" conflicts tty irq 12 vector psmintr 569.Pp 570Add the 571.Nm 572driver to the kernel with the optional code to stimulate the pointing device 573after the `resume' event. 574.Pp 575.Dl "device psm0 at isa? port" \&"IO_KBD\&" conflicts tty flags 0x024 irq 12 576.Dl vector psmintr 577.Pp 578Set the device resolution high (4) and the acceleration factor to 2. |
|
318.Sh DIAGNOSTICS 319.Pp 320At debug level 0, little information is logged except for the following 321line during boot process: 322.Bd -literal -offset indent 323psm0: device ID X 324.Ed 325.Pp 326where 327.Fa X 328the device ID code returned by the found pointing device. 329See 330.Dv MOUSE_GETINFO 331for known IDs. 332.Pp 333At debug level 1 more information will be logged 334while the driver probes the auxiliary port (mouse port). | 579.Sh DIAGNOSTICS 580.Pp 581At debug level 0, little information is logged except for the following 582line during boot process: 583.Bd -literal -offset indent 584psm0: device ID X 585.Ed 586.Pp 587where 588.Fa X 589the device ID code returned by the found pointing device. 590See 591.Dv MOUSE_GETINFO 592for known IDs. 593.Pp 594At debug level 1 more information will be logged 595while the driver probes the auxiliary port (mouse port). |
335Messages are logged with the LOG_KERN facility at the LOG_DEBUG level. 336(See 337.Xr syslogd 8 . ) | 596Messages are logged with the LOG_KERN facility at the LOG_DEBUG level 597.Pq see Xr syslogd 8 . |
338.Bd -literal -offset indent 339psm0: current command byte:xxxx | 598.Bd -literal -offset indent 599psm0: current command byte:xxxx |
340kbdio: new command byte:yyyy (set_controller...) | |
341kbdio: TEST_AUX_PORT status:0000 342kbdio: RESET_AUX return code:00fa 343kbdio: RESET_AUX status:00aa 344kbdio: RESET_AUX ID:0000 | 600kbdio: TEST_AUX_PORT status:0000 601kbdio: RESET_AUX return code:00fa 602kbdio: RESET_AUX status:00aa 603kbdio: RESET_AUX ID:0000 |
345psm0: status after reset 00 02 64 346psm: device ID: X 347psm: status xx yy zz (get_mouse_buttons) 348psm0: status 00 02 64 349kbdio: new command byte:zzzz (set_controller...) | 604[...] 605psm: status 00 02 64 |
350psm0 at 0x60-0x64 irq 12 on motherboard | 606psm0 at 0x60-0x64 irq 12 on motherboard |
351psm0: device ID X, N buttons | 607psm0: model AAAA, device ID X, N buttons 608psm0: config:00000www, flags:0000uuuu, packet size:M 609psm0: syncmask:xx, syncbits:yy |
352.Ed 353.Pp 354The first line shows the command byte value of the keyboard 355controller just before the auxiliary port is probed. 356It usually is 4D, 45, 47 or 65, depending on how the motherboard BIOS 357initialized the keyboard controller upon power-up. 358.Pp | 610.Ed 611.Pp 612The first line shows the command byte value of the keyboard 613controller just before the auxiliary port is probed. 614It usually is 4D, 45, 47 or 65, depending on how the motherboard BIOS 615initialized the keyboard controller upon power-up. 616.Pp |
359The third line shows the result of the keyboard controller's | 617The second line shows the result of the keyboard controller's |
360test on the auxiliary port interface, with zero indicating 361no error; note that some controllers report no error even if 362the port does not exist in the system, however. 363.Pp | 618test on the auxiliary port interface, with zero indicating 619no error; note that some controllers report no error even if 620the port does not exist in the system, however. 621.Pp |
364The forth to sixth lines show the reset status of the pointing device. | 622The third through fifth lines show the reset status of the pointing device. |
365The functioning device should return the sequence of FA AA <ID>. 366The ID code is described above. 367.Pp | 623The functioning device should return the sequence of FA AA <ID>. 624The ID code is described above. 625.Pp |
368The tenth line shows the current hardware settings; it consists 369of three bytes: | 626The seventh line shows the current hardware settings. 627.\" See 628.\" .Dv MOUSE_READSTATE 629.\" for definitions. 630These bytes are formatted as follows: |
370.Pp 371.Bl -tag -width Byte_1 -compact 372.It Byte 1 373.Bl -tag -width bit_6 -compact 374.It bit 7 375Reserved. 376.It bit 6 3770 - stream mode, 1 - remote mode. 378In the stream mode, the pointing device sends the device status 379whenever its state changes. In the remote mode, the host computer 380must request the status to be sent. | 631.Pp 632.Bl -tag -width Byte_1 -compact 633.It Byte 1 634.Bl -tag -width bit_6 -compact 635.It bit 7 636Reserved. 637.It bit 6 6380 - stream mode, 1 - remote mode. 639In the stream mode, the pointing device sends the device status 640whenever its state changes. In the remote mode, the host computer 641must request the status to be sent. |
642The 643.Nm 644driver puts the device in the stream mode. |
|
381.It bit 5 382Set if the pointing device is currently enabled. Otherwise zero. 383.It bit 4 3840 - 1:1 scaling, 1 - 2:1 scaling. | 645.It bit 5 646Set if the pointing device is currently enabled. Otherwise zero. 647.It bit 4 6480 - 1:1 scaling, 1 - 2:1 scaling. |
6491:1 scaling is the default. |
|
385.It bit 3 386Reserved. 387.It bit 2 388Left button status; set if pressed. 389.It bit 1 390Middle button status; set if pressed. 391.It bit 0 392Right button status; set if pressed. 393.El 394.It Byte 2 395.Bl -tag -width bit_6_0 -compact 396.It bit 7 397Reserved. | 650.It bit 3 651Reserved. 652.It bit 2 653Left button status; set if pressed. 654.It bit 1 655Middle button status; set if pressed. 656.It bit 0 657Right button status; set if pressed. 658.El 659.It Byte 2 660.Bl -tag -width bit_6_0 -compact 661.It bit 7 662Reserved. |
398.It bit 6-0 399Resolution code: zero through three. The higher the number is, 400the finer resolution the device has. Actual resolution for | 663.It bit 6..0 664Resolution code: zero through three. Actual resolution for |
401the resolution code varies from one device to another. | 665the resolution code varies from one device to another. |
402The typical values are: 403.Bl -tag -width 100 -compact 404.It 0 40525 pulse per inch (ppi) 406.It 1 40750 ppi 408.It 2 409100 ppi 410.It 3 411200 ppi | |
412.El | 666.El |
413.El | |
414.It Byte 3 415The status report rate (reports/sec) at which the device will send 416movement report to the host computer. 417.El 418.Pp 419Note that the pointing device will not be enabled until the 420.Nm | 667.It Byte 3 668The status report rate (reports/sec) at which the device will send 669movement report to the host computer. 670.El 671.Pp 672Note that the pointing device will not be enabled until the 673.Nm |
421driver is opened by the user programs. | 674driver is opened by the user program. |
422.Pp | 675.Pp |
423The last line shows the device ID code and the number of detected 424buttons. Currently the 425.Nm 426driver can detect the 3 button mouse from Logitech and report 427accordingly. 428The 3 button mouse from the other manufacturer may or may not be 429reported correctly. However, it will not affect the operation of 430the driver. | 676The rest of the lines show the device ID code, the number of detected 677buttons and internal variables. |
431.Pp 432At debug level 2, much more detailed information is logged. | 678.Pp 679At debug level 2, much more detailed information is logged. |
433.Sh FILES 434.Bl -tag -width /dev/npsm0 -compact 435.It Pa /dev/psm0 436`non-blocking' device node in the system without 437.Em devfs , 438`blocking' under 439.Em devfs . 440.It Pa /dev/npsm0 441`non-blocking' device node under 442.Em devfs . 443.El | |
444.Sh CAVEATS | 680.Sh CAVEATS |
681Many pad devices behave as if the first (left) button were pressed if 682the user `taps' the surface of the pad. 683In contrast, some ALPS GlidePoint pad models treat the tapping action 684as fourth button events. 685.Pp 686Some PS/2 mouse models from MouseSystems require to be put in the 687high resolution mode to work properly. Use the driver flag to 688set resolution. 689.Pp |
|
445There is not a guaranteed way to re-synchronize with the first byte 446of the packet once we are out of synchronization with the data 447stream. However, if you are using the \fIXFree86\fP server and experiencing 448the problem, you may be able to make the X server synchronize with the mouse 449by switching away to a virtual terminal and getting back to the X server, 450unless the X server is accessing the mouse via 451.Xr moused 1 . | 690There is not a guaranteed way to re-synchronize with the first byte 691of the packet once we are out of synchronization with the data 692stream. However, if you are using the \fIXFree86\fP server and experiencing 693the problem, you may be able to make the X server synchronize with the mouse 694by switching away to a virtual terminal and getting back to the X server, 695unless the X server is accessing the mouse via 696.Xr moused 1 . |
452If you have specified the 453.Em PSM_CHECKSYNC 454option, clicking any button without moving the mouse may also work. | 697Clicking any button without moving the mouse may also work. |
455.Sh BUGS | 698.Sh BUGS |
456The 457.Fn ioctl 458command | 699The ioctl command |
459.Dv MOUSEIOCREAD | 700.Dv MOUSEIOCREAD |
460(see 461.Sx IOCTL 462above) was never functional and will not be. The command name 463still remains for compatibility reasons but may be removed in the future. | 701has been removed. It was never functional anyway. |
464.Sh SEE ALSO | 702.Sh SEE ALSO |
465.Xr moused 1 , | 703.Xr ioctl 2 , |
466.Xr syslog 3 , | 704.Xr syslog 3 , |
705.Xr mouse 4 , |
|
467.Xr mse 4 , | 706.Xr mse 4 , |
707.Xr sysmouse 4 , 708.Xr moused 8 , |
|
468.Xr syslogd 8 | 709.Xr syslogd 8 |
469.\" .Sh HISTORY 470.\" .Sh AUTHOR | 710.\".Sh HISTORY 711.Sh AUTHOR 712The 713.Nm 714driver is based on the work done by quite a number of people, including 715.An Eric Forsberg , 716.An Sandi Donno , 717.An Rick Macklem , 718.An Andrew Herbert , 719.An Charles Hannum , 720.An Shoji Yuen 721and 722.An Kazutaka YOKOTA 723to name the few. 724.Pp 725This manual page was written by 726.An Kazutaka YOKOTA Aq yokota@FreeBSD.org . |