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