1 /*-
2 * Copyright (c) 1992, 1993 Erik Forsberg.
3 * Copyright (c) 1996, 1997 Kazutaka YOKOTA
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.
11 *
12 * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
16 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
18 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
19 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * $FreeBSD: src/sys/i386/include/mouse.h,v 1.1.12.4 1999/09/05 08:11:53 peter Exp $
24 */
25
26 #ifndef _MACHINE_MOUSE_H_
27 #define _MACHINE_MOUSE_H_
28
29 #include <sys/types.h>
30 #include <sys/ioccom.h>
31
32 /* ioctls */
33 #define MOUSE_GETSTATUS _IOR('M', 0, mousestatus_t)
34 #define MOUSE_GETHWINFO _IOR('M', 1, mousehw_t)
35 #define MOUSE_GETMODE _IOR('M', 2, mousemode_t)
36 #define MOUSE_SETMODE _IOW('M', 3, mousemode_t)
37 #define MOUSE_GETLEVEL _IOR('M', 4, int)
38 #define MOUSE_SETLEVEL _IOW('M', 5, int)
39 #define MOUSE_GETVARS _IOR('M', 6, mousevar_t)
40 #define MOUSE_SETVARS _IOW('M', 7, mousevar_t)
41 #define MOUSE_READSTATE _IOWR('M', 8, mousedata_t)
42 #define MOUSE_READDATA _IOWR('M', 9, mousedata_t)
43
44 #if notyet
45 #define MOUSE_SETRESOLUTION _IOW('M', 10, int)
46 #define MOUSE_SETSCALING _IOW('M', 11, int)
47 #define MOUSE_SETRATE _IOW('M', 12, int)
48 #define MOUSE_GETHWID _IOR('M', 13, int)
49 #endif
50
51 /* mouse status block */
52 typedef struct mousestatus {
53 int flags; /* state change flags */
54 int button; /* button status */
55 int obutton; /* previous button status */
56 int dx; /* x movement */
57 int dy; /* y movement */
58 int dz; /* z movement */
59 } mousestatus_t;
60
61 /* button */
62 #define MOUSE_BUTTON1DOWN 0x0001 /* left */
63 #define MOUSE_BUTTON2DOWN 0x0002 /* middle */
64 #define MOUSE_BUTTON3DOWN 0x0004 /* right */
65 #define MOUSE_BUTTON4DOWN 0x0008
66 #define MOUSE_BUTTON5DOWN 0x0010
67 #define MOUSE_BUTTON6DOWN 0x0020
68 #define MOUSE_BUTTON7DOWN 0x0040
69 #define MOUSE_BUTTON8DOWN 0x0080
70 #define MOUSE_MAXBUTTON 31
71 #define MOUSE_STDBUTTONS 0x0007 /* buttons 1-3 */
72 #define MOUSE_EXTBUTTONS 0x7ffffff8 /* the others (28 of them!) */
73 #define MOUSE_BUTTONS (MOUSE_STDBUTTONS | MOUSE_EXTBUTTONS)
74
75 /* flags */
76 #define MOUSE_STDBUTTONSCHANGED MOUSE_STDBUTTONS
77 #define MOUSE_EXTBUTTONSCHANGED MOUSE_EXTBUTTONS
78 #define MOUSE_BUTTONSCHANGED MOUSE_BUTTONS
79 #define MOUSE_POSCHANGED 0x80000000
80
81 typedef struct mousehw {
82 int buttons; /* -1 if unknown */
83 int iftype; /* MOUSE_IF_XXX */
84 int type; /* mouse/track ball/pad... */
85 int model; /* I/F dependent model ID: MOUSE_MODEL_XXX */
86 int hwid; /* I/F dependent hardware ID
87 * for the PS/2 mouse, it will be PSM_XXX_ID
88 */
89 } mousehw_t;
90
91 /* iftype */
92 #define MOUSE_IF_UNKNOWN (-1)
93 #define MOUSE_IF_SERIAL 0
94 #define MOUSE_IF_BUS 1
95 #define MOUSE_IF_INPORT 2
96 #define MOUSE_IF_PS2 3
97 #define MOUSE_IF_SYSMOUSE 4
98
99 /* type */
100 #define MOUSE_UNKNOWN (-1) /* should be treated as a mouse */
101 #define MOUSE_MOUSE 0
102 #define MOUSE_TRACKBALL 1
103 #define MOUSE_STICK 2
104 #define MOUSE_PAD 3
105
106 /* model */
107 #define MOUSE_MODEL_UNKNOWN (-1)
108 #define MOUSE_MODEL_GENERIC 0
109 #define MOUSE_MODEL_GLIDEPOINT 1
110 #define MOUSE_MODEL_NETSCROLL 2
111 #define MOUSE_MODEL_NET 3
112 #define MOUSE_MODEL_INTELLI 4
113 #define MOUSE_MODEL_THINK 5
114 #define MOUSE_MODEL_EASYSCROLL 6
115 #define MOUSE_MODEL_MOUSEMANPLUS 7
116
117 typedef struct mousemode {
118 int protocol; /* MOUSE_PROTO_XXX */
119 int rate; /* report rate (per sec), -1 if unknown */
120 int resolution; /* MOUSE_RES_XXX, -1 if unknown */
121 int accelfactor; /* accelation factor (must be 1 or greater) */
122 int level; /* driver operation level */
123 int packetsize; /* the length of the data packet */
124 unsigned char syncmask[2]; /* sync. data bits in the header byte */
125 } mousemode_t;
126
127 /* protocol */
128 #define MOUSE_PROTO_UNKNOWN (-1)
129 #define MOUSE_PROTO_MS 0 /* Microsoft Serial, 3 bytes */
130 #define MOUSE_PROTO_MSC 1 /* Mouse Systems, 5 bytes */
131 #define MOUSE_PROTO_LOGI 2 /* Logitech, 3 bytes */
132 #define MOUSE_PROTO_MM 3 /* MM series, 3 bytes */
133 #define MOUSE_PROTO_LOGIMOUSEMAN 4 /* Logitech MouseMan 3/4 bytes */
134 #define MOUSE_PROTO_BUS 5 /* MS/Logitech bus mouse */
135 #define MOUSE_PROTO_INPORT 6 /* MS/ATI InPort mouse */
136 #define MOUSE_PROTO_PS2 7 /* PS/2 mouse, 3 bytes */
137 #define MOUSE_PROTO_HITTAB 8 /* Hitachi Tablet 3 bytes */
138 #define MOUSE_PROTO_GLIDEPOINT 9 /* ALPS GlidePoint, 3/4 bytes */
139 #define MOUSE_PROTO_INTELLI 10 /* MS IntelliMouse, 4 bytes */
140 #define MOUSE_PROTO_THINK 11 /* Kensignton Thinking Mouse, 3/4 bytes */
141 #define MOUSE_PROTO_SYSMOUSE 12 /* /dev/sysmouse */
142
143 #define MOUSE_RES_UNKNOWN (-1)
144 #define MOUSE_RES_DEFAULT 0
145 #define MOUSE_RES_LOW (-2)
146 #define MOUSE_RES_MEDIUMLOW (-3)
147 #define MOUSE_RES_MEDIUMHIGH (-4)
148 #define MOUSE_RES_HIGH (-5)
149
150 typedef struct mousedata {
151 int len; /* # of data in the buffer */
152 int buf[16]; /* data buffer */
153 } mousedata_t;
154
155 #if (defined(MOUSE_GETVARS))
156
157 typedef struct mousevar {
158 int var[16];
159 } mousevar_t;
160
161 /* magic numbers in var[0] */
162 #define MOUSE_VARS_PS2_SIG 0x00325350 /* 'PS2' */
163 #define MOUSE_VARS_BUS_SIG 0x00535542 /* 'BUS' */
164 #define MOUSE_VARS_INPORT_SIG 0x00504e49 /* 'INP' */
165
166 #endif /* MOUSE_GETVARS */
167
168 /* Microsoft Serial mouse data packet */
169 #define MOUSE_MSS_PACKETSIZE 3
170 #define MOUSE_MSS_SYNCMASK 0x40
171 #define MOUSE_MSS_SYNC 0x40
172 #define MOUSE_MSS_BUTTONS 0x30
173 #define MOUSE_MSS_BUTTON1DOWN 0x20 /* left */
174 #define MOUSE_MSS_BUTTON2DOWN 0x00 /* no middle button */
175 #define MOUSE_MSS_BUTTON3DOWN 0x10 /* right */
176
177 /* Logitech MouseMan data packet (M+ protocol) */
178 #define MOUSE_LMAN_BUTTON2DOWN 0x20 /* middle button, the 4th byte */
179
180 /* ALPS GlidePoint extention (variant of M+ protocol) */
181 #define MOUSE_ALPS_BUTTON2DOWN 0x20 /* middle button, the 4th byte */
182 #define MOUSE_ALPS_TAP 0x10 /* `tapping' action, the 4th byte */
183
184 /* Kinsington Thinking Mouse extention (variant of M+ protocol) */
185 #define MOUSE_THINK_BUTTON2DOWN 0x20 /* lower-left button, the 4th byte */
186 #define MOUSE_THINK_BUTTON4DOWN 0x10 /* lower-right button, the 4th byte */
187
188 /* MS IntelliMouse (variant of MS Serial) */
189 #define MOUSE_INTELLI_PACKETSIZE 4
190 #define MOUSE_INTELLI_BUTTON2DOWN 0x10 /* middle button the 4th byte */
191
192 /* Mouse Systems Corp. mouse data packet */
193 #define MOUSE_MSC_PACKETSIZE 5
194 #define MOUSE_MSC_SYNCMASK 0xf8
195 #define MOUSE_MSC_SYNC 0x80
196 #define MOUSE_MSC_BUTTONS 0x07
197 #define MOUSE_MSC_BUTTON1UP 0x04 /* left */
198 #define MOUSE_MSC_BUTTON2UP 0x02 /* middle */
199 #define MOUSE_MSC_BUTTON3UP 0x01 /* right */
200
201 /* MM series mouse data packet */
202 #define MOUSE_MM_PACKETSIZE 3
203 #define MOUSE_MM_SYNCMASK 0xe0
204 #define MOUSE_MM_SYNC 0x80
205 #define MOUSE_MM_BUTTONS 0x07
206 #define MOUSE_MM_BUTTON1DOWN 0x04 /* left */
207 #define MOUSE_MM_BUTTON2DOWN 0x02 /* middle */
208 #define MOUSE_MM_BUTTON3DOWN 0x01 /* right */
209 #define MOUSE_MM_XPOSITIVE 0x10
210 #define MOUSE_MM_YPOSITIVE 0x08
211
212 /* PS/2 mouse data packet */
213 #define MOUSE_PS2_PACKETSIZE 3
214 #define MOUSE_PS2_SYNCMASK 0xc8
215 #define MOUSE_PS2_SYNC 0x08
216 #define MOUSE_PS2_BUTTONS 0x07 /* 0x03 for 2 button mouse */
217 #define MOUSE_PS2_BUTTON1DOWN 0x01 /* left */
218 #define MOUSE_PS2_BUTTON2DOWN 0x04 /* middle */
219 #define MOUSE_PS2_BUTTON3DOWN 0x02 /* right */
220 #define MOUSE_PS2_TAP MOUSE_PS2_SYNC /* GlidePoint (PS/2) `tapping'
221 * Yes! this is the same bit
222 * as SYNC!
223 */
224 #define MOUSE_PS2PLUS_BUTTON4DOWN 0x10 /* 4th button on MouseMan+ */
225
226 #define MOUSE_PS2_XNEG 0x10
227 #define MOUSE_PS2_YNEG 0x20
228 #define MOUSE_PS2_XOVERFLOW 0x40
229 #define MOUSE_PS2_YOVERFLOW 0x80
230 #define MOUSE_PS2PLUS_ZNEG 0x08 /* MouseMan+ negative wheel movement */
231
232 /* sysmouse extended data packet */
233 /*
234 * /dev/sysmouse sends data in two formats, depending on the protocol
235 * level. At the level 0, format is exactly the same as MousSystems'
236 * five byte packet. At the level 1, the first five bytes are the same
237 * as at the level 0. There are additional three bytes which shows
238 * `dz' and the states of additional buttons. `dz' is expressed as the
239 * sum of the byte 5 and 6 which contain signed seven bit values.
240 * The states of the button 4 though 10 are in the bit 0 though 6 in
241 * the byte 7 respectively: 1 indicates the button is up.
242 */
243 #define MOUSE_SYS_PACKETSIZE 8
244 #define MOUSE_SYS_SYNCMASK 0xf8
245 #define MOUSE_SYS_SYNC 0x80
246 #define MOUSE_SYS_BUTTON1UP 0x04 /* left, 1st byte */
247 #define MOUSE_SYS_BUTTON2UP 0x02 /* middle, 1st byte */
248 #define MOUSE_SYS_BUTTON3UP 0x01 /* right, 1st byte */
249 #define MOUSE_SYS_BUTTON4UP 0x0001 /* 7th byte */
250 #define MOUSE_SYS_BUTTON5UP 0x0002
251 #define MOUSE_SYS_BUTTON6UP 0x0004
252 #define MOUSE_SYS_BUTTON7UP 0x0008
253 #define MOUSE_SYS_BUTTON8UP 0x0010
254 #define MOUSE_SYS_BUTTON9UP 0x0020
255 #define MOUSE_SYS_BUTTON10UP 0x0040
256 #define MOUSE_SYS_MAXBUTTON 10
257 #define MOUSE_SYS_STDBUTTONS 0x07
258 #define MOUSE_SYS_EXTBUTTONS 0x7f /* the others */
259
260 #endif /* _MACHINE_MOUSE_H_ */
Cache object: b47c64fb9f40d5296f56494a28a45974
|