xref: /onnv-gate/usr/src/uts/common/sys/vuid_event.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _SYS_VUID_EVENT_H
28*0Sstevel@tonic-gate #define	_SYS_VUID_EVENT_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <sys/types.h>
33*0Sstevel@tonic-gate #include <sys/types32.h>
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate #ifdef	__cplusplus
36*0Sstevel@tonic-gate extern "C" {
37*0Sstevel@tonic-gate #endif
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate /*
40*0Sstevel@tonic-gate  * This file describes a virtual user input device (vuid) interface.  This
41*0Sstevel@tonic-gate  * is an interface between input devices and their clients.  The interface
42*0Sstevel@tonic-gate  * defines an idealized user input device that may not correspond to any
43*0Sstevel@tonic-gate  * existing physical collection of input devices.
44*0Sstevel@tonic-gate  *
45*0Sstevel@tonic-gate  * It is targeted to input devices that gather command data from humans,
46*0Sstevel@tonic-gate  * e.g., mice, keyboards, tablets, joysticks, light pens, knobs, sliders,
47*0Sstevel@tonic-gate  * buttons, ascii terminals, etc.  The vuid interface is specifically not
48*0Sstevel@tonic-gate  * designed to support input devices that produce voluminous amounts of
49*0Sstevel@tonic-gate  * data, e.g., input scanners, disk drives, voice packets.
50*0Sstevel@tonic-gate  *
51*0Sstevel@tonic-gate  * Here are some of the properties that are expected of a typical client
52*0Sstevel@tonic-gate  * of vuid:
53*0Sstevel@tonic-gate  *
54*0Sstevel@tonic-gate  *	The client has a richer user interface than can be supported by
55*0Sstevel@tonic-gate  *	a simple ascii terminal.
56*0Sstevel@tonic-gate  *
57*0Sstevel@tonic-gate  *	The client serializes multiple input devices being used
58*0Sstevel@tonic-gate  *	by the user into a single stream of events.
59*0Sstevel@tonic-gate  *
60*0Sstevel@tonic-gate  *	The client preserves the entire state of its input so that
61*0Sstevel@tonic-gate  *	it may query this state.
62*0Sstevel@tonic-gate  *
63*0Sstevel@tonic-gate  * Here are some features that vuid provides to its clients:
64*0Sstevel@tonic-gate  *
65*0Sstevel@tonic-gate  *	A client may extend the capabilities of the predefined vuid by
66*0Sstevel@tonic-gate  *	adding input devices.  A client wants to be able to do this in
67*0Sstevel@tonic-gate  *	a way that fits smoothly with its existing input paradigm.
68*0Sstevel@tonic-gate  *
69*0Sstevel@tonic-gate  *	A client can write its code to be input device independent.  A
70*0Sstevel@tonic-gate  *	client can replace the underlaying physical devices and not
71*0Sstevel@tonic-gate  *	have to be concerned.  In fact, the vuid interface doesn't
72*0Sstevel@tonic-gate  *	really care about physical devices.  One physical device can
73*0Sstevel@tonic-gate  *	masquerade a many logical devices and many physical devices can
74*0Sstevel@tonic-gate  *	look like a single logical device.
75*0Sstevel@tonic-gate  *
76*0Sstevel@tonic-gate  * This file defines the protocol that makes up the virtual user input
77*0Sstevel@tonic-gate  * device.  This includes:
78*0Sstevel@tonic-gate  *
79*0Sstevel@tonic-gate  *	The vuid station codes and there meanings.
80*0Sstevel@tonic-gate  *
81*0Sstevel@tonic-gate  *	The form by which changes to vuid stations, i.e., firm events,
82*0Sstevel@tonic-gate  *	are communicated to clients (typically via the read system
83*0Sstevel@tonic-gate  *	call).
84*0Sstevel@tonic-gate  *
85*0Sstevel@tonic-gate  *	The form by which clients send commands to input devices that
86*0Sstevel@tonic-gate  *	support the vuid (typically via an ioctl system call to send
87*0Sstevel@tonic-gate  *	vuid instead of a native byte stream).
88*0Sstevel@tonic-gate  *
89*0Sstevel@tonic-gate  * Explicitly, this file does not define:
90*0Sstevel@tonic-gate  *
91*0Sstevel@tonic-gate  *	How to store the state of the vuid
92*0Sstevel@tonic-gate  *	(see ../sunwindowdev/vuid_state.h).
93*0Sstevel@tonic-gate  *
94*0Sstevel@tonic-gate  *	How to dynamically allocate additional vuid segments in order
95*0Sstevel@tonic-gate  *	to extend the vuid (one could statically allocate additional
96*0Sstevel@tonic-gate  *	vuid segments by treating this file as the central registry
97*0Sstevel@tonic-gate  *	of vuid segments).
98*0Sstevel@tonic-gate  */
99*0Sstevel@tonic-gate 
100*0Sstevel@tonic-gate /*
101*0Sstevel@tonic-gate  * VUID_SEG_SIZE is the size of a virtual user input "device" address space
102*0Sstevel@tonic-gate  * segment.
103*0Sstevel@tonic-gate  */
104*0Sstevel@tonic-gate #define	VUID_SEG_SIZE	(256)
105*0Sstevel@tonic-gate 
106*0Sstevel@tonic-gate /*
107*0Sstevel@tonic-gate  * This is the central registry of virtual user input devices.
108*0Sstevel@tonic-gate  * To allocate a new vuid:
109*0Sstevel@tonic-gate  *
110*0Sstevel@tonic-gate  *	o Choose an unused portion of the address space.
111*0Sstevel@tonic-gate  *	  Vuids from 0x00 to 0x7F are reserved for Sun implementers.
112*0Sstevel@tonic-gate  *	  Vuids from 0x80 to 0xFF are reserved for Sun customers.
113*0Sstevel@tonic-gate  *
114*0Sstevel@tonic-gate  *	o Note the new device with a *_DEVID define.  Breifly describe
115*0Sstevel@tonic-gate  *	  the purpose/usage of the device.  Point to the place where
116*0Sstevel@tonic-gate  *	  more information can be found.
117*0Sstevel@tonic-gate  *
118*0Sstevel@tonic-gate  *	o Note the new device with a VUID_* entry in the Vuid_device
119*0Sstevel@tonic-gate  *	  enumeration.
120*0Sstevel@tonic-gate  *
121*0Sstevel@tonic-gate  *	o List the specific event codes in another header file that is
122*0Sstevel@tonic-gate  *	  specific to the new device (ASCII_DEVID, TOP_DEVID &
123*0Sstevel@tonic-gate  *	  WORKSTATION_DEVID events are listing here for historical
124*0Sstevel@tonic-gate  *	  reasons).
125*0Sstevel@tonic-gate  */
126*0Sstevel@tonic-gate 
127*0Sstevel@tonic-gate #define	ASCII_DEVID		0x00
128*0Sstevel@tonic-gate 	/* Ascii codes, which include META codes and 8-bit EUC codes */
129*0Sstevel@tonic-gate 	/* (see below) */
130*0Sstevel@tonic-gate #define	TOP_DEVID		0x01
131*0Sstevel@tonic-gate 	/* Top codes, which is ASCII with the 9th bit on (see below) */
132*0Sstevel@tonic-gate #define	ISO_DEVID		0x02
133*0Sstevel@tonic-gate 	/* ISO characters 0x80 - 0xFF (backwards compatibility) */
134*0Sstevel@tonic-gate /* ... Sun implementers add new device ids here ... */
135*0Sstevel@tonic-gate #define	WHEEL_DEVID		0x78
136*0Sstevel@tonic-gate #define	LIGHTPEN_DEVID		0x79
137*0Sstevel@tonic-gate 	/* Lightpen events for	Lightpen */
138*0Sstevel@tonic-gate #define	BUTTON_DEVID		0x7A
139*0Sstevel@tonic-gate 	/* Button events from Sun button box */
140*0Sstevel@tonic-gate #define	DIAL_DEVID		0x7B
141*0Sstevel@tonic-gate 	/* Dial events from Sun dial box */
142*0Sstevel@tonic-gate #define	SUNVIEW_DEVID		0x7C
143*0Sstevel@tonic-gate 	/* Sunview Semantic events */
144*0Sstevel@tonic-gate #define	PANEL_DEVID		0x7D
145*0Sstevel@tonic-gate 	/* Panel subwindow package event codes passed around internal */
146*0Sstevel@tonic-gate 	/* to the panel package (see <suntool/panel.h>) */
147*0Sstevel@tonic-gate #define	SCROLL_DEVID		0x7E
148*0Sstevel@tonic-gate 	/* Scrollbar package event codes passed to scrollbar clients on */
149*0Sstevel@tonic-gate 	/* interesting scrollbar activity (see <suntool/scrollbar.h>) */
150*0Sstevel@tonic-gate #define	WORKSTATION_DEVID	0x7F
151*0Sstevel@tonic-gate 	/* Virtual keyboard and locator (mouse) related event codes */
152*0Sstevel@tonic-gate 	/* that describe a basic "workstation" device collection (see below). */
153*0Sstevel@tonic-gate 	/* This device is a bit of a hodge podge for historical reasons; */
154*0Sstevel@tonic-gate 	/* the middle of the address space has SunWindows related events */
155*0Sstevel@tonic-gate 	/* in it (see <sunwindow/win_input.h >), and the virtual keyboard */
156*0Sstevel@tonic-gate 	/* and virtual locator are thrown together. */
157*0Sstevel@tonic-gate /* ... Sun customers add new device ids here ... */
158*0Sstevel@tonic-gate #define	LAST_DEVID		0xFF
159*0Sstevel@tonic-gate 	/* No more device ids beyond LAST_DEVID */
160*0Sstevel@tonic-gate 
161*0Sstevel@tonic-gate typedef enum vuid_device {
162*0Sstevel@tonic-gate 	VUID_ASCII = ASCII_DEVID,
163*0Sstevel@tonic-gate 	VUID_TOP = TOP_DEVID,
164*0Sstevel@tonic-gate 	VUID_ISO = ISO_DEVID,
165*0Sstevel@tonic-gate 	VUID_WHEEL = WHEEL_DEVID,
166*0Sstevel@tonic-gate 	VUID_LIGHTPEN = LIGHTPEN_DEVID,
167*0Sstevel@tonic-gate 	VUID_DIAL = DIAL_DEVID,
168*0Sstevel@tonic-gate 	VUID_SUNVIEW = SUNVIEW_DEVID,
169*0Sstevel@tonic-gate 	VUID_PANEL = PANEL_DEVID,
170*0Sstevel@tonic-gate 	VUID_SCROLL = SCROLL_DEVID,
171*0Sstevel@tonic-gate 	VUID_WORKSTATION = WORKSTATION_DEVID,
172*0Sstevel@tonic-gate 	VUID_LAST = LAST_DEVID
173*0Sstevel@tonic-gate } Vuid_device;
174*0Sstevel@tonic-gate 
175*0Sstevel@tonic-gate #define	vuid_first(devid)	((devid) << 8)
176*0Sstevel@tonic-gate #define	vuid_last(devid)	(((devid) << 8)+VUID_SEG_SIZE-1)
177*0Sstevel@tonic-gate #define	vuid_in_range(devid, id) \
178*0Sstevel@tonic-gate 	    ((id >= vuid_first(devid)) && (id <= vuid_last(devid)))
179*0Sstevel@tonic-gate 
180*0Sstevel@tonic-gate /*
181*0Sstevel@tonic-gate  * EUC (Extended UNIX Code) device related definitions:
182*0Sstevel@tonic-gate  */
183*0Sstevel@tonic-gate #define	EUC_FIRST	(0)
184*0Sstevel@tonic-gate #define	EUC_LAST	(255)
185*0Sstevel@tonic-gate 
186*0Sstevel@tonic-gate /*
187*0Sstevel@tonic-gate  * Old ASCII definitions for backwards compatibility:
188*0Sstevel@tonic-gate  */
189*0Sstevel@tonic-gate #define	ASCII_FIRST	(0)
190*0Sstevel@tonic-gate #define	ASCII_LAST	(127)
191*0Sstevel@tonic-gate #define	META_FIRST	(128)
192*0Sstevel@tonic-gate #define	META_LAST	(255)
193*0Sstevel@tonic-gate 
194*0Sstevel@tonic-gate /*
195*0Sstevel@tonic-gate  * Top device related definitions:
196*0Sstevel@tonic-gate  */
197*0Sstevel@tonic-gate #define	TOP_FIRST	(256)
198*0Sstevel@tonic-gate #define	TOP_LAST	(511)
199*0Sstevel@tonic-gate 
200*0Sstevel@tonic-gate /*
201*0Sstevel@tonic-gate  * Old ISO definitions for backwards compatibility:
202*0Sstevel@tonic-gate  */
203*0Sstevel@tonic-gate #define	ISO_FIRST	(512)
204*0Sstevel@tonic-gate #define	ISO_LAST	(767)
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate /*
207*0Sstevel@tonic-gate  * Workstation device related definitions.  First are virtual keyboard
208*0Sstevel@tonic-gate  * assignments.	 All events for the virtual keyboard have 0 (went up) or
209*0Sstevel@tonic-gate  * 1 (went down) values.
210*0Sstevel@tonic-gate  */
211*0Sstevel@tonic-gate 
212*0Sstevel@tonic-gate #define	VKEY_FIRST	vuid_first(WORKSTATION_DEVID)
213*0Sstevel@tonic-gate #define	VKEY_UP		0
214*0Sstevel@tonic-gate #define	VKEY_DOWN	1
215*0Sstevel@tonic-gate 
216*0Sstevel@tonic-gate #define	VKEY_KBD_CODES	(128)	/* The number of event codes in a subset of */
217*0Sstevel@tonic-gate 				/* the workstation device's address space */
218*0Sstevel@tonic-gate 				/* that belong to the virtual keyboard */
219*0Sstevel@tonic-gate 
220*0Sstevel@tonic-gate #define	VKEY_FIRSTPSEUDO	(VKEY_FIRST)			/* 32512 */
221*0Sstevel@tonic-gate /*
222*0Sstevel@tonic-gate  * VKEY_FIRSTPSEUDO thru VKEY_LASTPSEUDO are taken (for historical
223*0Sstevel@tonic-gate  * reasons) by SunWindows related codes (see <sunwindow/win_input.h >).
224*0Sstevel@tonic-gate  */
225*0Sstevel@tonic-gate #define	VKEY_LASTPSEUDO		(VKEY_FIRSTPSEUDO+15)		/* 32527 */
226*0Sstevel@tonic-gate 
227*0Sstevel@tonic-gate #define	VKEY_FIRSTSHIFT		(VKEY_LASTPSEUDO+1)		/* 32528 */
228*0Sstevel@tonic-gate #define	SHIFT_CAPSLOCK		(VKEY_FIRSTSHIFT+0)		/* 32528 */
229*0Sstevel@tonic-gate #define	SHIFT_LOCK		(VKEY_FIRSTSHIFT+1)		/* 32529 */
230*0Sstevel@tonic-gate #define	SHIFT_LEFT		(VKEY_FIRSTSHIFT+2)		/* 32530 */
231*0Sstevel@tonic-gate #define	SHIFT_RIGHT		(VKEY_FIRSTSHIFT+3)		/* 32531 */
232*0Sstevel@tonic-gate #define	SHIFT_LEFTCTRL		(VKEY_FIRSTSHIFT+4)		/* 32532 */
233*0Sstevel@tonic-gate /* SHIFT_CTRL is for compatability with previous releases */	/* 32532 */
234*0Sstevel@tonic-gate #define	SHIFT_CTRL		SHIFT_LEFTCTRL			/* 32532 */
235*0Sstevel@tonic-gate #define	SHIFT_RIGHTCTRL		(VKEY_FIRSTSHIFT+5)		/* 32533 */
236*0Sstevel@tonic-gate #define	SHIFT_META		(VKEY_FIRSTSHIFT+6)		/* 32534 */
237*0Sstevel@tonic-gate #define	SHIFT_TOP		(VKEY_FIRSTSHIFT+7)		/* 32535 */
238*0Sstevel@tonic-gate #define	SHIFT_CMD		(VKEY_FIRSTSHIFT+8)		/* 32536 */
239*0Sstevel@tonic-gate #define	SHIFT_ALTG		(VKEY_FIRSTSHIFT+9)		/* 32537 */
240*0Sstevel@tonic-gate #define	SHIFT_ALT		(VKEY_FIRSTSHIFT+10)		/* 32538 */
241*0Sstevel@tonic-gate #define	SHIFT_NUMLOCK		(VKEY_FIRSTSHIFT+11)		/* 32539 */
242*0Sstevel@tonic-gate #define	VKEY_LASTSHIFT		(VKEY_FIRSTSHIFT+15)		/* 32543 */
243*0Sstevel@tonic-gate 
244*0Sstevel@tonic-gate #define	VKEY_FIRSTFUNC		(VKEY_LASTSHIFT+1)		/* 32544 */
245*0Sstevel@tonic-gate 
246*0Sstevel@tonic-gate #define	BUT_FIRST		(VKEY_FIRSTFUNC)		/* 32544 */
247*0Sstevel@tonic-gate #define	BUT(i)			((BUT_FIRST)+(i)-1)		/* 32544+i-1 */
248*0Sstevel@tonic-gate #define	BUT_LAST		(BUT_FIRST+9)			/* 32553 */
249*0Sstevel@tonic-gate 
250*0Sstevel@tonic-gate #define	KEY_LEFTFIRST		((BUT_LAST)+1)			/* 32554 */
251*0Sstevel@tonic-gate #define	KEY_LEFT(i)		((KEY_LEFTFIRST)+(i)-1)		/* 32554+i-1 */
252*0Sstevel@tonic-gate #define	KEY_LEFTLAST		((KEY_LEFTFIRST)+15)		/* 32569 */
253*0Sstevel@tonic-gate 
254*0Sstevel@tonic-gate #define	KEY_RIGHTFIRST		((KEY_LEFTLAST)+1)		/* 32570 */
255*0Sstevel@tonic-gate #define	KEY_RIGHT(i)		((KEY_RIGHTFIRST)+(i)-1)	/* 32570+i-1 */
256*0Sstevel@tonic-gate #define	KEY_RIGHTLAST		((KEY_RIGHTFIRST)+15)		/* 32585 */
257*0Sstevel@tonic-gate 
258*0Sstevel@tonic-gate #define	KEY_TOPFIRST		((KEY_RIGHTLAST)+1)		/* 32586 */
259*0Sstevel@tonic-gate #define	KEY_TOP(i)		((KEY_TOPFIRST)+(i)-1)		/* 32586+i-1 */
260*0Sstevel@tonic-gate #define	KEY_TOPLAST		((KEY_TOPFIRST)+15)		/* 32601 */
261*0Sstevel@tonic-gate 
262*0Sstevel@tonic-gate #define	KEY_BOTTOMLEFT		((KEY_TOPLAST)+1)		/* 32602 */
263*0Sstevel@tonic-gate #define	KEY_BOTTOMRIGHT		((KEY_BOTTOMLEFT)+1)		/* 32603 */
264*0Sstevel@tonic-gate #define	KEY_BOTTOMFIRST		((KEY_TOPLAST)+1)		/* 32602 */
265*0Sstevel@tonic-gate #define	KEY_BOTTOM(i)		((KEY_BOTTOMFIRST)+(i)-1)	/* 32602+i-1 */
266*0Sstevel@tonic-gate #define	KEY_BOTTOMLAST		((KEY_BOTTOMFIRST)+15)		/* 32617 */
267*0Sstevel@tonic-gate 
268*0Sstevel@tonic-gate #define	VKEY_LASTFUNC		(VKEY_FIRSTFUNC+73)		/* 32617 */
269*0Sstevel@tonic-gate 
270*0Sstevel@tonic-gate #define	VKEY_FIRSTPAD		(VKEY_LASTFUNC+1)		/* 32618 */
271*0Sstevel@tonic-gate 
272*0Sstevel@tonic-gate #define	VKEY_PADEQUAL		(VKEY_FIRSTPAD+0)		/* 32618 */
273*0Sstevel@tonic-gate #define	VKEY_PADSLASH		(VKEY_FIRSTPAD+1)		/* 32619 */
274*0Sstevel@tonic-gate #define	VKEY_PADSTAR		(VKEY_FIRSTPAD+2)		/* 32620 */
275*0Sstevel@tonic-gate #define	VKEY_PADMINUS		(VKEY_FIRSTPAD+3)		/* 32621 */
276*0Sstevel@tonic-gate #define	VKEY_PADSEP		(VKEY_FIRSTPAD+4)		/* 32622 */
277*0Sstevel@tonic-gate #define	VKEY_PAD7		(VKEY_FIRSTPAD+5)		/* 32623 */
278*0Sstevel@tonic-gate #define	VKEY_PAD8		(VKEY_FIRSTPAD+6)		/* 32624 */
279*0Sstevel@tonic-gate #define	VKEY_PAD9		(VKEY_FIRSTPAD+7)		/* 32625 */
280*0Sstevel@tonic-gate #define	VKEY_PADPLUS		(VKEY_FIRSTPAD+8)		/* 32626 */
281*0Sstevel@tonic-gate #define	VKEY_PAD4		(VKEY_FIRSTPAD+9)		/* 32627 */
282*0Sstevel@tonic-gate #define	VKEY_PAD5		(VKEY_FIRSTPAD+10)		/* 32628 */
283*0Sstevel@tonic-gate #define	VKEY_PAD6		(VKEY_FIRSTPAD+11)		/* 32629 */
284*0Sstevel@tonic-gate #define	VKEY_PAD1		(VKEY_FIRSTPAD+12)		/* 32630 */
285*0Sstevel@tonic-gate #define	VKEY_PAD2		(VKEY_FIRSTPAD+13)		/* 32631 */
286*0Sstevel@tonic-gate #define	VKEY_PAD3		(VKEY_FIRSTPAD+14)		/* 32632 */
287*0Sstevel@tonic-gate #define	VKEY_PAD0		(VKEY_FIRSTPAD+15)		/* 32633 */
288*0Sstevel@tonic-gate #define	VKEY_PADDOT		(VKEY_FIRSTPAD+16)		/* 32634 */
289*0Sstevel@tonic-gate #define	VKEY_PADENTER		(VKEY_FIRSTPAD+17)		/* 32635 */
290*0Sstevel@tonic-gate 
291*0Sstevel@tonic-gate #define	VKEY_LASTPAD		(VKEY_FIRSTPAD+17)		/* 32635 */
292*0Sstevel@tonic-gate 
293*0Sstevel@tonic-gate #define	VKEY_LAST		(VKEY_FIRST+VKEY_KBD_CODES-1)	/* 32639 */
294*0Sstevel@tonic-gate 
295*0Sstevel@tonic-gate /*
296*0Sstevel@tonic-gate  * More workstation device definitions.	 These are virtual locator
297*0Sstevel@tonic-gate  * related event code assignments.  Values for these events are int.
298*0Sstevel@tonic-gate  * VLOC_BATCH's value is a uint_t that describes the number of events
299*0Sstevel@tonic-gate  * that follow that should be treated as a batch.
300*0Sstevel@tonic-gate  */
301*0Sstevel@tonic-gate #define	MOUSE_DEVID	WORKSTATION_DEVID	/* Backward compatibility */
302*0Sstevel@tonic-gate 
303*0Sstevel@tonic-gate #define	VLOC_FIRST		(VKEY_LAST+1)			/* 32640 */
304*0Sstevel@tonic-gate #define	LOC_FIRST_DELTA		(VLOC_FIRST+0)			/* 32640 */
305*0Sstevel@tonic-gate #define	LOC_X_DELTA		(VLOC_FIRST+0)			/* 32640 */
306*0Sstevel@tonic-gate #define	LOC_Y_DELTA		(VLOC_FIRST+1)			/* 32641 */
307*0Sstevel@tonic-gate #define	LOC_LAST_DELTA		(VLOC_FIRST+1)			/* 32641 */
308*0Sstevel@tonic-gate 
309*0Sstevel@tonic-gate #define	LOC_FIRST_ABSOLUTE	(VLOC_FIRST+2)			/* 32642 */
310*0Sstevel@tonic-gate #define	LOC_X_ABSOLUTE		(VLOC_FIRST+2)			/* 32642 */
311*0Sstevel@tonic-gate #define	LOC_Y_ABSOLUTE		(VLOC_FIRST+3)			/* 32643 */
312*0Sstevel@tonic-gate #define	LOC_LAST_ABSOLUTE	(VLOC_FIRST+3)			/* 32643 */
313*0Sstevel@tonic-gate 
314*0Sstevel@tonic-gate #define	VLOC_BATCH		(VLOC_FIRST+4)			/* 32644 */
315*0Sstevel@tonic-gate #define	VLOC_LAST		(VLOC_BATCH+1)			/* 32645 */
316*0Sstevel@tonic-gate 
317*0Sstevel@tonic-gate #define	MOUSE_CAP_CHANGE_FIRST		(VLOC_LAST+1)		/* 32646 */
318*0Sstevel@tonic-gate #define	MOUSE_CAP_CHANGE_NUM_BUT	(MOUSE_CAP_CHANGE_FIRST+0) /* 32646 */
319*0Sstevel@tonic-gate #define	MOUSE_CAP_CHANGE_NUM_WHEEL	(MOUSE_CAP_CHANGE_FIRST+1) /* 32647 */
320*0Sstevel@tonic-gate 
321*0Sstevel@tonic-gate #define	MOUSE_TYPE_ABSOLUTE	(VLOC_LAST+3)			/* 32648 */
322*0Sstevel@tonic-gate 
323*0Sstevel@tonic-gate /*
324*0Sstevel@tonic-gate  * Common names for certain input codes.  The buttons on the physical
325*0Sstevel@tonic-gate  * mouse are thought to actually belong to the virtual keyboard.
326*0Sstevel@tonic-gate  */
327*0Sstevel@tonic-gate #define	MS_LEFT		BUT(1)					/* 32544 */
328*0Sstevel@tonic-gate #define	MS_MIDDLE	BUT(2)					/* 32545 */
329*0Sstevel@tonic-gate #define	MS_RIGHT	BUT(3)					/* 32546 */
330*0Sstevel@tonic-gate 
331*0Sstevel@tonic-gate /*
332*0Sstevel@tonic-gate  * A firm_event structure is encoded in the byte stream of a device
333*0Sstevel@tonic-gate  * when the device has been asked to format its byte stream so.
334*0Sstevel@tonic-gate  * The time stamp is not defined to be meaningful except to compare
335*0Sstevel@tonic-gate  * with other Firm_event time stamps.
336*0Sstevel@tonic-gate  *
337*0Sstevel@tonic-gate  * The pair field is critical for a state maintainence package
338*0Sstevel@tonic-gate  * (such as vuid_state.h), one that is designed to not know anything
339*0Sstevel@tonic-gate  * about the semantics of particular events, to maintain correct data
340*0Sstevel@tonic-gate  * for corresponding absolute, delta and paired state variables.
341*0Sstevel@tonic-gate  *
342*0Sstevel@tonic-gate  * pair, when defined (as indicated by pair_type), is the associated
343*0Sstevel@tonic-gate  * state variable that should be updated due to this events generation.
344*0Sstevel@tonic-gate  * This is used to maintain a correspondence between an event that is a
345*0Sstevel@tonic-gate  * delta and a state that is an absolute value (with a known delta event
346*0Sstevel@tonic-gate  * defined) and visa versa, e.g., LOC_X_DELTA & LOC_X_ABSOLUTE.
347*0Sstevel@tonic-gate  * pair is also used to indicate another state variable that
348*0Sstevel@tonic-gate  * should be updated with the occurrence of this event, e.g., if id is
349*0Sstevel@tonic-gate  * '^G' then pair could be 'g' or 'G' depending on the state of the shift
350*0Sstevel@tonic-gate  * key.
351*0Sstevel@tonic-gate  */
352*0Sstevel@tonic-gate typedef struct firm_event {
353*0Sstevel@tonic-gate 	ushort_t	id;	/* Event's unique id */
354*0Sstevel@tonic-gate 	uchar_t		pair_type;	/* Event pair's type */
355*0Sstevel@tonic-gate #define	FE_PAIR_NONE		0	/* pair is not defined */
356*0Sstevel@tonic-gate #define	FE_PAIR_SET		1	/* pair is accompanying id to set */
357*0Sstevel@tonic-gate 					/* to this events value */
358*0Sstevel@tonic-gate #define	FE_PAIR_DELTA		2	/* pair is accompanying id that */
359*0Sstevel@tonic-gate 					/* should be set to the delta of */
360*0Sstevel@tonic-gate 					/* id's current value and the new */
361*0Sstevel@tonic-gate 					/* value indicated by this event */
362*0Sstevel@tonic-gate #define	FE_PAIR_ABSOLUTE	3	/* pair is accompanying id that */
363*0Sstevel@tonic-gate 					/* should be set to the sum of its */
364*0Sstevel@tonic-gate 					/* current value and the delta */
365*0Sstevel@tonic-gate 					/* indicated by this event's value */
366*0Sstevel@tonic-gate 	uchar_t		pair;	/* Event id's associated delta|absolute|pair */
367*0Sstevel@tonic-gate 				/* offset within id's segment (minus id's */
368*0Sstevel@tonic-gate 				/* address) */
369*0Sstevel@tonic-gate 	int		value;	/* Event's value */
370*0Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
371*0Sstevel@tonic-gate 	struct timeval32 time;	/* Event's time stamp */
372*0Sstevel@tonic-gate #else
373*0Sstevel@tonic-gate 	struct timeval time;
374*0Sstevel@tonic-gate #endif
375*0Sstevel@tonic-gate } Firm_event;
376*0Sstevel@tonic-gate #define	FIRM_EVENT_NULL ((Firm_event *)0)
377*0Sstevel@tonic-gate #define	vuid_id_addr(id)		((id) & 0xFF00)
378*0Sstevel@tonic-gate #define	vuid_id_offset(id)		((id) & 0xFF)
379*0Sstevel@tonic-gate #define	vuid_boolean_value(value)	(((value) == 0) || ((value) == 1))
380*0Sstevel@tonic-gate #define	vuid_int_value(value)		(!(vuid_boolean_value((value))))
381*0Sstevel@tonic-gate 
382*0Sstevel@tonic-gate /*
383*0Sstevel@tonic-gate  * Ioctls to input devices that support vuid.
384*0Sstevel@tonic-gate  */
385*0Sstevel@tonic-gate 
386*0Sstevel@tonic-gate /*
387*0Sstevel@tonic-gate  * VUID*FORMAT ioctls are used to control which byte stream format that
388*0Sstevel@tonic-gate  * a input device should use.  An errno of ENOTTY or EINVAL indicates that
389*0Sstevel@tonic-gate  * a device can't speak Firm_events.
390*0Sstevel@tonic-gate  */
391*0Sstevel@tonic-gate #define	VUIOC		('v'<<8)
392*0Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
393*0Sstevel@tonic-gate #define	VUIDSFORMAT   (VUIOC|11) /* avoid conflict with VT_?????? */
394*0Sstevel@tonic-gate #define	VUIDGFORMAT   (VUIOC|12) /* avoid conflict with VT_?????? */
395*0Sstevel@tonic-gate #else
396*0Sstevel@tonic-gate #define	VUIDSFORMAT   (VUIOC|1) /* Set input device byte stream format */
397*0Sstevel@tonic-gate #define	VUIDGFORMAT   (VUIOC|2) /* Get input device byte stream format */
398*0Sstevel@tonic-gate #endif
399*0Sstevel@tonic-gate #define	VUID_NATIVE	0	/* Native byte stream format */
400*0Sstevel@tonic-gate #define	VUID_FIRM_EVENT 1	/* struct firm_event byte stream format */
401*0Sstevel@tonic-gate 
402*0Sstevel@tonic-gate /*
403*0Sstevel@tonic-gate  * VUID*ADDR ioctls are used to control which address a particular
404*0Sstevel@tonic-gate  * virtual input device segment has.  This is used to have an instancing
405*0Sstevel@tonic-gate  * capability, e.g., a second mouse.  An errno of ENOTTY indicates that
406*0Sstevel@tonic-gate  * a device can't deal with these commands.  An errno of ENODEV indicates
407*0Sstevel@tonic-gate  * that the requested virtual device has no events generated for it by
408*0Sstevel@tonic-gate  * this physical device.
409*0Sstevel@tonic-gate  *
410*0Sstevel@tonic-gate  * VUIDSADDR sets the virtual input device segment address indicated by
411*0Sstevel@tonic-gate  * default to next.
412*0Sstevel@tonic-gate  *
413*0Sstevel@tonic-gate  * VUIDGADDR gets the in force address of the virtual input device segment
414*0Sstevel@tonic-gate  * indicated by default into current.
415*0Sstevel@tonic-gate  */
416*0Sstevel@tonic-gate typedef struct	vuid_addr_probe {
417*0Sstevel@tonic-gate 	short	base;		/* default vuid device addr directed too */
418*0Sstevel@tonic-gate 	union	{
419*0Sstevel@tonic-gate 		short	next;	/* next addr for default when VUIDSADDR */
420*0Sstevel@tonic-gate 		short	current; /* current addr of default when VUIDGADDR */
421*0Sstevel@tonic-gate 	} data;
422*0Sstevel@tonic-gate } Vuid_addr_probe;
423*0Sstevel@tonic-gate 
424*0Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
425*0Sstevel@tonic-gate #define	VUIDSADDR   (VUIOC|13)	/* avoid conflict with VT_?????? */
426*0Sstevel@tonic-gate #define	VUIDGADDR   (VUIOC|14)	/* avoid conflict with VT_?????? */
427*0Sstevel@tonic-gate #else
428*0Sstevel@tonic-gate #define	VUIDSADDR   (VUIOC|3)	/* Set vuid address */
429*0Sstevel@tonic-gate #define	VUIDGADDR   (VUIOC|4)	/* Get vuid address */
430*0Sstevel@tonic-gate #endif
431*0Sstevel@tonic-gate 
432*0Sstevel@tonic-gate #ifdef	__cplusplus
433*0Sstevel@tonic-gate }
434*0Sstevel@tonic-gate #endif
435*0Sstevel@tonic-gate 
436*0Sstevel@tonic-gate #endif	/* _SYS_VUID_EVENT_H */
437