- Uniformly use .In for header file references.
[dragonfly.git] / share / man / man4 / man4.i386 / mse.4
CommitLineData
984263bc
MD
1.\" Copyright 1992 by the University of Guelph
2.\"
3.\" Permission to use, copy and modify this
4.\" software and its documentation for any purpose and without
5.\" fee is hereby granted, provided that the above copyright
6.\" notice appear in all copies and that both that copyright
7.\" notice and this permission notice appear in supporting
8.\" documentation.
9.\" University of Guelph makes no representations about the suitability of
10.\" this software for any purpose. It is provided "as is"
11.\" without express or implied warranty.
12.\"
13.\" $FreeBSD: src/share/man/man4/man4.i386/mse.4,v 1.10.2.4 2001/08/17 13:08:45 ru Exp $
44cb301e 14.\" $DragonFly: src/share/man/man4/man4.i386/mse.4,v 1.3 2006/05/26 19:39:40 swildner Exp $
984263bc
MD
15.\"
16.Dd December 3, 1997
17.Dt MSE 4 i386
18.Os
19.Sh NAME
20.Nm mse
21.Nd bus and InPort mice driver
22.Sh SYNOPSIS
23.\" .Cd "options MSE_XXX=N"
24.Cd "device mse0 at isa? port 0x23c irq 5"
25.Sh DESCRIPTION
26The
27.Nm
28driver provides support for the bus mouse and the InPort mouse, which
29are often collectively called ``bus'' mice, as these mice are sold with
30an interface card which needs to be installed in an expansion bus slot.
31The interface circuit may come on an integrated I/O card or as an option
32on video cards.
33.Pp
34The bus and InPort mice have two or three buttons,
35and a D-sub 9-pin male connector or a round DIN 9-pin
36male connector.
37.Pp
38The primary port address of the bus and InPort mouse interface cards
39is usually 0x23c.
40Some cards may also be set to use the secondary port
41address at 0x238.
42The interface cards require a single IRQ, which may be
432, 3, 4 or 5. Some cards may offer additional IRQs.
44The port number and the IRQ number are configured by jumpers on the cards
45or by software provided with the card.
46.Pp
47Frequency, or report rate, at which the device sends movement
48and button state reports to the host system, may also be configurable on
49some interface cards.
50It may be 15, 30, 60 or 120Hz.
51.Pp
52The difference between the two types of the mice is not in mouse devices
53(in fact they are exactly the same). But in the circuit on the interface
54cards.
55This means that the device from a bus mouse package can be
56connected to the interface card from an InPort mouse package, or vice
57versa, provided that their connectors match.
58.Ss Operation Levels
59The
60.Nm
61driver has two levels of operation.
62The current operation level can be set via an ioctl call.
63.Pp
64At the level zero the basic support is provided; the device driver will report
65horizontal and vertical movement of the attached device
66and state of up to three buttons in the format described below.
67It is a subset of the MouseSystems protocol.
68.Pp
69.Bl -tag -width Byte_1 -compact
70.It Byte 1
71.Bl -tag -width bit_7 -compact
72.It bit 7
73Always one.
74.It bit 6..3
75Always zero.
76.It bit 2
77Left button status; cleared if pressed, otherwise set.
78.It bit 1
79Middle button status; cleared if pressed, otherwise set.
80Always one,
81if the device does not have the middle button.
82.It bit 0
83Right button status; cleared if pressed, otherwise set.
84.El
85.It Byte 2
86Horizontal movement count in two's compliment; -128 through 127.
87.It Byte 3
88Vertical movement count in two's compliment; -128 through 127.
89.It Byte 4
90Always zero.
91.It Byte 5
92Always zero.
93.El
94.Pp
95This is the default level of operation and the driver is initially
96at this level when opened by the user program.
97.Pp
98At the operation level one (extended level), a data packet is encoded
99in the standard format
100.Dv MOUSE_PROTO_SYSMOUSE
101as defined in
102.Xr mouse 4 .
103.Ss Acceleration
104The
105.Nm
106driver can somewhat `accelerate' the movement of the pointing device.
107The faster you move the device, the further the pointer
108travels on the screen.
109The driver has an internal variable which governs the effect of
110the acceleration.
111Its value can be modified via the driver flag
112or via an ioctl call.
113.Ss Device Number
114The minor device number of the
115.Nm
116is made up of:
117.Bd -literal -offset indent
118minor = (`unit' << 1) | `non-blocking'
119.Ed
120.Pp
121where `unit' is the device number (usually 0) and the `non-blocking' bit
122is set to indicate ``don't block waiting for mouse input,
123return immediately''.
124The `non-blocking' bit should be set for \fIXFree86\fP,
125therefore the minor device number usually used for \fIXFree86\fP is 1.
126See
127.Sx FILES
128for device node names.
129.Sh DRIVER CONFIGURATION
130.\" .Ss Kernel Configuration Options
131.Ss Driver Flags
132The
133.Nm
134driver accepts the following driver flag.
135Set it in the
136kernel configuration file
137(see
138.Xr config 8 )
139or in the User Configuration Menu at
140the boot time
141(see
142.Xr boot 8 ) .
143.Pp
144.Bl -tag -width MOUSE
145.It bit 4..7 ACCELERATION
146This flag controls the amount of acceleration effect.
147The smaller the value of this flag is, more sensitive the movement becomes.
148The minimum value allowed, thus the value for the most sensitive setting,
149is one.
150Setting this flag to zero will completely disables the
151acceleration effect.
152.El
153.Sh IOCTLS
154There are a few
155.Xr ioctl 2
156commands for mouse drivers.
157These commands and related structures and constants are defined in
44cb301e 158.In machine/mouse.h .
984263bc
MD
159General description of the commands is given in
160.Xr mouse 4 .
161This section explains the features specific to the
162.Nm
163driver.
164.Pp
165.Bl -tag -width MOUSE -compact
166.It Dv MOUSE_GETLEVEL Ar int *level
167.It Dv MOUSE_SETLEVEL Ar int *level
168These commands manipulate the operation level of the
169.Nm
170driver.
171.Pp
172.It Dv MOUSE_GETHWINFO Ar mousehw_t *hw
173Returns the hardware information of the attached device in the following
174structure.
175Only the
176.Dv iftype
177field is guaranteed to be filled with the correct value by the current
178version of the
179.Nm
180driver.
181.Bd -literal
182typedef struct mousehw {
183 int buttons; /* number of buttons */
184 int iftype; /* I/F type */
185 int type; /* mouse/track ball/pad... */
186 int model; /* I/F dependent model ID */
187 int hwid; /* I/F dependent hardware ID */
188} mousehw_t;
189.Ed
190.Pp
191The
192.Dv buttons
193field holds the number of buttons on the device.
194.Pp
195The
196.Dv iftype
197is either
198.Dv MOUSE_IF_BUS
199or
200.Dv MOUSE_IF_INPORT .
201.Pp
202The
203.Dv type
204may be
205.Dv MOUSE_MOUSE ,
206.Dv MOUSE_TRACKBALL ,
207.Dv MOUSE_STICK ,
208.Dv MOUSE_PAD ,
209or
210.Dv MOUSE_UNKNOWN .
211.Pp
212The
213.Dv model
214is always
215.Dv MOUSE_MODEL_GENERIC
216at the operation level 0.
217It may be
218.Dv MOUSE_MODEL_GENERIC
219or one of
220.Dv MOUSE_MODEL_XXX
221constants at higher operation levels.
222.Pp
223The
224.Dv hwid
225is always 0.
226.Pp
227.It Dv MOUSE_GETMODE Ar mousemode_t *mode
228The command gets the current operation parameters of the mouse
229driver.
230.Bd -literal
231typedef struct mousemode {
232 int protocol; /* MOUSE_PROTO_XXX */
233 int rate; /* report rate (per sec), -1 if unknown */
234 int resolution; /* MOUSE_RES_XXX, -1 if unknown */
235 int accelfactor; /* acceleration factor */
236 int level; /* driver operation level */
237 int packetsize; /* the length of the data packet */
238 unsigned char syncmask[2]; /* sync. bits */
239} mousemode_t;
240.Ed
241.Pp
242The
243.Dv protocol
244is either
245.Dv MOUSE_PROTO_BUS
246or
247.Dv MOUSE_PROTO_INPORT
248at the operation level zero.
249.Dv MOUSE_PROTO_SYSMOUSE
250at the operation level one.
251.Pp
252The
253.Dv rate
254is the status report rate (reports/sec) at which the device will send
255movement report to the host computer.
256As there is no standard to detect the current setting,
257this field is always set to -1.
258.Pp
259The
260.Dv resolution
261is always set to -1.
262.Pp
263The
264.Dv accelfactor
265field holds a value to control acceleration feature
266(see
267.Sx Acceleration ) .
268It is zero or greater.
269If it is zero, acceleration is disabled.
270.Pp
271The
272.Dv packetsize
273field specifies the length of the data packet.
274It depends on the
275operation level.
276.Pp
277.Bl -tag -width level_0__ -compact
278.It Em level 0
2795 bytes
280.It Em level 1
2818 bytes
282.El
283.Pp
284The array
285.Dv syncmask
286holds a bit mask and pattern to detect the first byte of the
287data packet.
288.Dv syncmask[0]
289is the bit mask to be ANDed with a byte.
290If the result is equal to
291.Dv syncmask[1] ,
292the byte is likely to be the first byte of the data packet.
293Note that this detection method is not 100% reliable,
294thus, should be taken only as an advisory measure.
295.Pp
296Only
297.Dv level
298and
299.Dv accelfactor
300are modifiable by the
301.Dv MOUSE_SETMODE
302command.
303Changing the other field doesn't cause error, but has no effect.
304.Pp
305.It Dv MOUSE_SETMODE Ar mousemode_t *mode
306The command changes the current operation parameters of the mouse driver
307as specified in
308.Ar mode .
309Only
310.Dv level
311and
312.Dv accelfactor
313may be modifiable.
314Setting values in the other field does not generate
315error and has no effect.
316.\" .Pp
317.\" .It Dv MOUSE_GETVARS Ar mousevar_t *vars
318.\" .It Dv MOUSE_SETVARS Ar mousevar_t *vars
319.\" These commands are not supported by the
320.\" .Nm
321.\" driver.
322.Pp
323.It Dv MOUSE_READDATA Ar mousedata_t *data
324.It Dv MOUSE_READSTATE Ar mousedata_t *state
325These commands are not supported by the
326.Nm
327driver.
328.Pp
329.It Dv MOUSE_GETSTATUS Ar mousestatus_t *status
330The command returns the current state of buttons and
331movement counts as described in
332.Xr mouse 4 .
333.El
334.Sh FILES
335.Bl -tag -width /dev/nmse0 -compact
336.It Pa /dev/mse0
337`non-blocking' device node
338.It Pa /dev/nmse0
339`non-blocking' device node
340.El
341.Sh EXAMPLES
342.Dl "device mse0 at isa? port 0x23c irq 5"
343.Pp
344Add the
345.Nm
346driver at the primary port address with the IRQ 5.
347.Pp
348.Dl "device mse1 at isa? port 0x238 flags 0x30 irq 4"
349.Pp
350Define the
351.Nm
352driver at the secondary port address with the IRQ 4 and the acceleration
353factor of 3.
354.Sh CAVEAT
355Some bus mouse interface cards generate interrupts at the fixed report rate
356when enabled, whether or not the mouse state is changing.
357The others generate interrupts only when the state is changing.
358.Sh SEE ALSO
359.Xr ioctl 2 ,
360.Xr mouse 4 ,
361.Xr psm 4 ,
362.Xr sysmouse 4 ,
363.Xr moused 8
364.\".Sh HISTORY