xref: /onnv-gate/usr/src/uts/common/sys/vuid_event.h (revision 1274:980a7b904adc)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
23*1274Sqz150045  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef _SYS_VUID_EVENT_H
280Sstevel@tonic-gate #define	_SYS_VUID_EVENT_H
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #include <sys/types.h>
330Sstevel@tonic-gate #include <sys/types32.h>
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #ifdef	__cplusplus
360Sstevel@tonic-gate extern "C" {
370Sstevel@tonic-gate #endif
380Sstevel@tonic-gate 
390Sstevel@tonic-gate /*
400Sstevel@tonic-gate  * This file describes a virtual user input device (vuid) interface.  This
410Sstevel@tonic-gate  * is an interface between input devices and their clients.  The interface
420Sstevel@tonic-gate  * defines an idealized user input device that may not correspond to any
430Sstevel@tonic-gate  * existing physical collection of input devices.
440Sstevel@tonic-gate  *
450Sstevel@tonic-gate  * It is targeted to input devices that gather command data from humans,
460Sstevel@tonic-gate  * e.g., mice, keyboards, tablets, joysticks, light pens, knobs, sliders,
470Sstevel@tonic-gate  * buttons, ascii terminals, etc.  The vuid interface is specifically not
480Sstevel@tonic-gate  * designed to support input devices that produce voluminous amounts of
490Sstevel@tonic-gate  * data, e.g., input scanners, disk drives, voice packets.
500Sstevel@tonic-gate  *
510Sstevel@tonic-gate  * Here are some of the properties that are expected of a typical client
520Sstevel@tonic-gate  * of vuid:
530Sstevel@tonic-gate  *
540Sstevel@tonic-gate  *	The client has a richer user interface than can be supported by
550Sstevel@tonic-gate  *	a simple ascii terminal.
560Sstevel@tonic-gate  *
570Sstevel@tonic-gate  *	The client serializes multiple input devices being used
580Sstevel@tonic-gate  *	by the user into a single stream of events.
590Sstevel@tonic-gate  *
600Sstevel@tonic-gate  *	The client preserves the entire state of its input so that
610Sstevel@tonic-gate  *	it may query this state.
620Sstevel@tonic-gate  *
630Sstevel@tonic-gate  * Here are some features that vuid provides to its clients:
640Sstevel@tonic-gate  *
650Sstevel@tonic-gate  *	A client may extend the capabilities of the predefined vuid by
660Sstevel@tonic-gate  *	adding input devices.  A client wants to be able to do this in
670Sstevel@tonic-gate  *	a way that fits smoothly with its existing input paradigm.
680Sstevel@tonic-gate  *
690Sstevel@tonic-gate  *	A client can write its code to be input device independent.  A
700Sstevel@tonic-gate  *	client can replace the underlaying physical devices and not
710Sstevel@tonic-gate  *	have to be concerned.  In fact, the vuid interface doesn't
720Sstevel@tonic-gate  *	really care about physical devices.  One physical device can
730Sstevel@tonic-gate  *	masquerade a many logical devices and many physical devices can
740Sstevel@tonic-gate  *	look like a single logical device.
750Sstevel@tonic-gate  *
760Sstevel@tonic-gate  * This file defines the protocol that makes up the virtual user input
770Sstevel@tonic-gate  * device.  This includes:
780Sstevel@tonic-gate  *
790Sstevel@tonic-gate  *	The vuid station codes and there meanings.
800Sstevel@tonic-gate  *
810Sstevel@tonic-gate  *	The form by which changes to vuid stations, i.e., firm events,
820Sstevel@tonic-gate  *	are communicated to clients (typically via the read system
830Sstevel@tonic-gate  *	call).
840Sstevel@tonic-gate  *
850Sstevel@tonic-gate  *	The form by which clients send commands to input devices that
860Sstevel@tonic-gate  *	support the vuid (typically via an ioctl system call to send
870Sstevel@tonic-gate  *	vuid instead of a native byte stream).
880Sstevel@tonic-gate  *
890Sstevel@tonic-gate  * Explicitly, this file does not define:
900Sstevel@tonic-gate  *
910Sstevel@tonic-gate  *	How to store the state of the vuid
920Sstevel@tonic-gate  *	(see ../sunwindowdev/vuid_state.h).
930Sstevel@tonic-gate  *
940Sstevel@tonic-gate  *	How to dynamically allocate additional vuid segments in order
950Sstevel@tonic-gate  *	to extend the vuid (one could statically allocate additional
960Sstevel@tonic-gate  *	vuid segments by treating this file as the central registry
970Sstevel@tonic-gate  *	of vuid segments).
980Sstevel@tonic-gate  */
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate /*
1010Sstevel@tonic-gate  * VUID_SEG_SIZE is the size of a virtual user input "device" address space
1020Sstevel@tonic-gate  * segment.
1030Sstevel@tonic-gate  */
1040Sstevel@tonic-gate #define	VUID_SEG_SIZE	(256)
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate /*
1070Sstevel@tonic-gate  * This is the central registry of virtual user input devices.
1080Sstevel@tonic-gate  * To allocate a new vuid:
1090Sstevel@tonic-gate  *
1100Sstevel@tonic-gate  *	o Choose an unused portion of the address space.
1110Sstevel@tonic-gate  *	  Vuids from 0x00 to 0x7F are reserved for Sun implementers.
1120Sstevel@tonic-gate  *	  Vuids from 0x80 to 0xFF are reserved for Sun customers.
1130Sstevel@tonic-gate  *
1140Sstevel@tonic-gate  *	o Note the new device with a *_DEVID define.  Breifly describe
1150Sstevel@tonic-gate  *	  the purpose/usage of the device.  Point to the place where
1160Sstevel@tonic-gate  *	  more information can be found.
1170Sstevel@tonic-gate  *
1180Sstevel@tonic-gate  *	o Note the new device with a VUID_* entry in the Vuid_device
1190Sstevel@tonic-gate  *	  enumeration.
1200Sstevel@tonic-gate  *
1210Sstevel@tonic-gate  *	o List the specific event codes in another header file that is
1220Sstevel@tonic-gate  *	  specific to the new device (ASCII_DEVID, TOP_DEVID &
1230Sstevel@tonic-gate  *	  WORKSTATION_DEVID events are listing here for historical
1240Sstevel@tonic-gate  *	  reasons).
1250Sstevel@tonic-gate  */
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate #define	ASCII_DEVID		0x00
1280Sstevel@tonic-gate 	/* Ascii codes, which include META codes and 8-bit EUC codes */
1290Sstevel@tonic-gate 	/* (see below) */
1300Sstevel@tonic-gate #define	TOP_DEVID		0x01
1310Sstevel@tonic-gate 	/* Top codes, which is ASCII with the 9th bit on (see below) */
1320Sstevel@tonic-gate #define	ISO_DEVID		0x02
1330Sstevel@tonic-gate 	/* ISO characters 0x80 - 0xFF (backwards compatibility) */
1340Sstevel@tonic-gate /* ... Sun implementers add new device ids here ... */
1350Sstevel@tonic-gate #define	WHEEL_DEVID		0x78
1360Sstevel@tonic-gate #define	LIGHTPEN_DEVID		0x79
1370Sstevel@tonic-gate 	/* Lightpen events for	Lightpen */
1380Sstevel@tonic-gate #define	BUTTON_DEVID		0x7A
1390Sstevel@tonic-gate 	/* Button events from Sun button box */
1400Sstevel@tonic-gate #define	DIAL_DEVID		0x7B
1410Sstevel@tonic-gate 	/* Dial events from Sun dial box */
1420Sstevel@tonic-gate #define	SUNVIEW_DEVID		0x7C
1430Sstevel@tonic-gate 	/* Sunview Semantic events */
1440Sstevel@tonic-gate #define	PANEL_DEVID		0x7D
1450Sstevel@tonic-gate 	/* Panel subwindow package event codes passed around internal */
1460Sstevel@tonic-gate 	/* to the panel package (see <suntool/panel.h>) */
1470Sstevel@tonic-gate #define	SCROLL_DEVID		0x7E
1480Sstevel@tonic-gate 	/* Scrollbar package event codes passed to scrollbar clients on */
1490Sstevel@tonic-gate 	/* interesting scrollbar activity (see <suntool/scrollbar.h>) */
1500Sstevel@tonic-gate #define	WORKSTATION_DEVID	0x7F
1510Sstevel@tonic-gate 	/* Virtual keyboard and locator (mouse) related event codes */
1520Sstevel@tonic-gate 	/* that describe a basic "workstation" device collection (see below). */
1530Sstevel@tonic-gate 	/* This device is a bit of a hodge podge for historical reasons; */
1540Sstevel@tonic-gate 	/* the middle of the address space has SunWindows related events */
1550Sstevel@tonic-gate 	/* in it (see <sunwindow/win_input.h >), and the virtual keyboard */
1560Sstevel@tonic-gate 	/* and virtual locator are thrown together. */
1570Sstevel@tonic-gate /* ... Sun customers add new device ids here ... */
1580Sstevel@tonic-gate #define	LAST_DEVID		0xFF
1590Sstevel@tonic-gate 	/* No more device ids beyond LAST_DEVID */
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate typedef enum vuid_device {
1620Sstevel@tonic-gate 	VUID_ASCII = ASCII_DEVID,
1630Sstevel@tonic-gate 	VUID_TOP = TOP_DEVID,
1640Sstevel@tonic-gate 	VUID_ISO = ISO_DEVID,
1650Sstevel@tonic-gate 	VUID_WHEEL = WHEEL_DEVID,
1660Sstevel@tonic-gate 	VUID_LIGHTPEN = LIGHTPEN_DEVID,
1670Sstevel@tonic-gate 	VUID_DIAL = DIAL_DEVID,
1680Sstevel@tonic-gate 	VUID_SUNVIEW = SUNVIEW_DEVID,
1690Sstevel@tonic-gate 	VUID_PANEL = PANEL_DEVID,
1700Sstevel@tonic-gate 	VUID_SCROLL = SCROLL_DEVID,
1710Sstevel@tonic-gate 	VUID_WORKSTATION = WORKSTATION_DEVID,
1720Sstevel@tonic-gate 	VUID_LAST = LAST_DEVID
1730Sstevel@tonic-gate } Vuid_device;
1740Sstevel@tonic-gate 
1750Sstevel@tonic-gate #define	vuid_first(devid)	((devid) << 8)
1760Sstevel@tonic-gate #define	vuid_last(devid)	(((devid) << 8)+VUID_SEG_SIZE-1)
1770Sstevel@tonic-gate #define	vuid_in_range(devid, id) \
1780Sstevel@tonic-gate 	    ((id >= vuid_first(devid)) && (id <= vuid_last(devid)))
1790Sstevel@tonic-gate 
1800Sstevel@tonic-gate /*
1810Sstevel@tonic-gate  * EUC (Extended UNIX Code) device related definitions:
1820Sstevel@tonic-gate  */
1830Sstevel@tonic-gate #define	EUC_FIRST	(0)
1840Sstevel@tonic-gate #define	EUC_LAST	(255)
1850Sstevel@tonic-gate 
1860Sstevel@tonic-gate /*
1870Sstevel@tonic-gate  * Old ASCII definitions for backwards compatibility:
1880Sstevel@tonic-gate  */
1890Sstevel@tonic-gate #define	ASCII_FIRST	(0)
1900Sstevel@tonic-gate #define	ASCII_LAST	(127)
1910Sstevel@tonic-gate #define	META_FIRST	(128)
1920Sstevel@tonic-gate #define	META_LAST	(255)
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate /*
1950Sstevel@tonic-gate  * Top device related definitions:
1960Sstevel@tonic-gate  */
1970Sstevel@tonic-gate #define	TOP_FIRST	(256)
1980Sstevel@tonic-gate #define	TOP_LAST	(511)
1990Sstevel@tonic-gate 
2000Sstevel@tonic-gate /*
2010Sstevel@tonic-gate  * Old ISO definitions for backwards compatibility:
2020Sstevel@tonic-gate  */
2030Sstevel@tonic-gate #define	ISO_FIRST	(512)
2040Sstevel@tonic-gate #define	ISO_LAST	(767)
2050Sstevel@tonic-gate 
2060Sstevel@tonic-gate /*
2070Sstevel@tonic-gate  * Workstation device related definitions.  First are virtual keyboard
2080Sstevel@tonic-gate  * assignments.	 All events for the virtual keyboard have 0 (went up) or
2090Sstevel@tonic-gate  * 1 (went down) values.
2100Sstevel@tonic-gate  */
2110Sstevel@tonic-gate 
2120Sstevel@tonic-gate #define	VKEY_FIRST	vuid_first(WORKSTATION_DEVID)
2130Sstevel@tonic-gate #define	VKEY_UP		0
2140Sstevel@tonic-gate #define	VKEY_DOWN	1
2150Sstevel@tonic-gate 
2160Sstevel@tonic-gate #define	VKEY_KBD_CODES	(128)	/* The number of event codes in a subset of */
2170Sstevel@tonic-gate 				/* the workstation device's address space */
2180Sstevel@tonic-gate 				/* that belong to the virtual keyboard */
2190Sstevel@tonic-gate 
2200Sstevel@tonic-gate #define	VKEY_FIRSTPSEUDO	(VKEY_FIRST)			/* 32512 */
2210Sstevel@tonic-gate /*
2220Sstevel@tonic-gate  * VKEY_FIRSTPSEUDO thru VKEY_LASTPSEUDO are taken (for historical
2230Sstevel@tonic-gate  * reasons) by SunWindows related codes (see <sunwindow/win_input.h >).
2240Sstevel@tonic-gate  */
2250Sstevel@tonic-gate #define	VKEY_LASTPSEUDO		(VKEY_FIRSTPSEUDO+15)		/* 32527 */
2260Sstevel@tonic-gate 
2270Sstevel@tonic-gate #define	VKEY_FIRSTSHIFT		(VKEY_LASTPSEUDO+1)		/* 32528 */
2280Sstevel@tonic-gate #define	SHIFT_CAPSLOCK		(VKEY_FIRSTSHIFT+0)		/* 32528 */
2290Sstevel@tonic-gate #define	SHIFT_LOCK		(VKEY_FIRSTSHIFT+1)		/* 32529 */
2300Sstevel@tonic-gate #define	SHIFT_LEFT		(VKEY_FIRSTSHIFT+2)		/* 32530 */
2310Sstevel@tonic-gate #define	SHIFT_RIGHT		(VKEY_FIRSTSHIFT+3)		/* 32531 */
2320Sstevel@tonic-gate #define	SHIFT_LEFTCTRL		(VKEY_FIRSTSHIFT+4)		/* 32532 */
2330Sstevel@tonic-gate /* SHIFT_CTRL is for compatability with previous releases */	/* 32532 */
2340Sstevel@tonic-gate #define	SHIFT_CTRL		SHIFT_LEFTCTRL			/* 32532 */
2350Sstevel@tonic-gate #define	SHIFT_RIGHTCTRL		(VKEY_FIRSTSHIFT+5)		/* 32533 */
2360Sstevel@tonic-gate #define	SHIFT_META		(VKEY_FIRSTSHIFT+6)		/* 32534 */
2370Sstevel@tonic-gate #define	SHIFT_TOP		(VKEY_FIRSTSHIFT+7)		/* 32535 */
2380Sstevel@tonic-gate #define	SHIFT_CMD		(VKEY_FIRSTSHIFT+8)		/* 32536 */
2390Sstevel@tonic-gate #define	SHIFT_ALTG		(VKEY_FIRSTSHIFT+9)		/* 32537 */
2400Sstevel@tonic-gate #define	SHIFT_ALT		(VKEY_FIRSTSHIFT+10)		/* 32538 */
2410Sstevel@tonic-gate #define	SHIFT_NUMLOCK		(VKEY_FIRSTSHIFT+11)		/* 32539 */
2420Sstevel@tonic-gate #define	VKEY_LASTSHIFT		(VKEY_FIRSTSHIFT+15)		/* 32543 */
2430Sstevel@tonic-gate 
2440Sstevel@tonic-gate #define	VKEY_FIRSTFUNC		(VKEY_LASTSHIFT+1)		/* 32544 */
2450Sstevel@tonic-gate 
2460Sstevel@tonic-gate #define	BUT_FIRST		(VKEY_FIRSTFUNC)		/* 32544 */
2470Sstevel@tonic-gate #define	BUT(i)			((BUT_FIRST)+(i)-1)		/* 32544+i-1 */
2480Sstevel@tonic-gate #define	BUT_LAST		(BUT_FIRST+9)			/* 32553 */
2490Sstevel@tonic-gate 
2500Sstevel@tonic-gate #define	KEY_LEFTFIRST		((BUT_LAST)+1)			/* 32554 */
2510Sstevel@tonic-gate #define	KEY_LEFT(i)		((KEY_LEFTFIRST)+(i)-1)		/* 32554+i-1 */
2520Sstevel@tonic-gate #define	KEY_LEFTLAST		((KEY_LEFTFIRST)+15)		/* 32569 */
2530Sstevel@tonic-gate 
2540Sstevel@tonic-gate #define	KEY_RIGHTFIRST		((KEY_LEFTLAST)+1)		/* 32570 */
2550Sstevel@tonic-gate #define	KEY_RIGHT(i)		((KEY_RIGHTFIRST)+(i)-1)	/* 32570+i-1 */
2560Sstevel@tonic-gate #define	KEY_RIGHTLAST		((KEY_RIGHTFIRST)+15)		/* 32585 */
2570Sstevel@tonic-gate 
2580Sstevel@tonic-gate #define	KEY_TOPFIRST		((KEY_RIGHTLAST)+1)		/* 32586 */
2590Sstevel@tonic-gate #define	KEY_TOP(i)		((KEY_TOPFIRST)+(i)-1)		/* 32586+i-1 */
2600Sstevel@tonic-gate #define	KEY_TOPLAST		((KEY_TOPFIRST)+15)		/* 32601 */
2610Sstevel@tonic-gate 
2620Sstevel@tonic-gate #define	KEY_BOTTOMLEFT		((KEY_TOPLAST)+1)		/* 32602 */
2630Sstevel@tonic-gate #define	KEY_BOTTOMRIGHT		((KEY_BOTTOMLEFT)+1)		/* 32603 */
2640Sstevel@tonic-gate #define	KEY_BOTTOMFIRST		((KEY_TOPLAST)+1)		/* 32602 */
2650Sstevel@tonic-gate #define	KEY_BOTTOM(i)		((KEY_BOTTOMFIRST)+(i)-1)	/* 32602+i-1 */
2660Sstevel@tonic-gate #define	KEY_BOTTOMLAST		((KEY_BOTTOMFIRST)+15)		/* 32617 */
2670Sstevel@tonic-gate 
2680Sstevel@tonic-gate #define	VKEY_LASTFUNC		(VKEY_FIRSTFUNC+73)		/* 32617 */
2690Sstevel@tonic-gate 
2700Sstevel@tonic-gate #define	VKEY_FIRSTPAD		(VKEY_LASTFUNC+1)		/* 32618 */
2710Sstevel@tonic-gate 
2720Sstevel@tonic-gate #define	VKEY_PADEQUAL		(VKEY_FIRSTPAD+0)		/* 32618 */
2730Sstevel@tonic-gate #define	VKEY_PADSLASH		(VKEY_FIRSTPAD+1)		/* 32619 */
2740Sstevel@tonic-gate #define	VKEY_PADSTAR		(VKEY_FIRSTPAD+2)		/* 32620 */
2750Sstevel@tonic-gate #define	VKEY_PADMINUS		(VKEY_FIRSTPAD+3)		/* 32621 */
2760Sstevel@tonic-gate #define	VKEY_PADSEP		(VKEY_FIRSTPAD+4)		/* 32622 */
2770Sstevel@tonic-gate #define	VKEY_PAD7		(VKEY_FIRSTPAD+5)		/* 32623 */
2780Sstevel@tonic-gate #define	VKEY_PAD8		(VKEY_FIRSTPAD+6)		/* 32624 */
2790Sstevel@tonic-gate #define	VKEY_PAD9		(VKEY_FIRSTPAD+7)		/* 32625 */
2800Sstevel@tonic-gate #define	VKEY_PADPLUS		(VKEY_FIRSTPAD+8)		/* 32626 */
2810Sstevel@tonic-gate #define	VKEY_PAD4		(VKEY_FIRSTPAD+9)		/* 32627 */
2820Sstevel@tonic-gate #define	VKEY_PAD5		(VKEY_FIRSTPAD+10)		/* 32628 */
2830Sstevel@tonic-gate #define	VKEY_PAD6		(VKEY_FIRSTPAD+11)		/* 32629 */
2840Sstevel@tonic-gate #define	VKEY_PAD1		(VKEY_FIRSTPAD+12)		/* 32630 */
2850Sstevel@tonic-gate #define	VKEY_PAD2		(VKEY_FIRSTPAD+13)		/* 32631 */
2860Sstevel@tonic-gate #define	VKEY_PAD3		(VKEY_FIRSTPAD+14)		/* 32632 */
2870Sstevel@tonic-gate #define	VKEY_PAD0		(VKEY_FIRSTPAD+15)		/* 32633 */
2880Sstevel@tonic-gate #define	VKEY_PADDOT		(VKEY_FIRSTPAD+16)		/* 32634 */
2890Sstevel@tonic-gate #define	VKEY_PADENTER		(VKEY_FIRSTPAD+17)		/* 32635 */
2900Sstevel@tonic-gate 
2910Sstevel@tonic-gate #define	VKEY_LASTPAD		(VKEY_FIRSTPAD+17)		/* 32635 */
2920Sstevel@tonic-gate 
2930Sstevel@tonic-gate #define	VKEY_LAST		(VKEY_FIRST+VKEY_KBD_CODES-1)	/* 32639 */
2940Sstevel@tonic-gate 
2950Sstevel@tonic-gate /*
2960Sstevel@tonic-gate  * More workstation device definitions.	 These are virtual locator
2970Sstevel@tonic-gate  * related event code assignments.  Values for these events are int.
2980Sstevel@tonic-gate  * VLOC_BATCH's value is a uint_t that describes the number of events
2990Sstevel@tonic-gate  * that follow that should be treated as a batch.
3000Sstevel@tonic-gate  */
3010Sstevel@tonic-gate #define	MOUSE_DEVID	WORKSTATION_DEVID	/* Backward compatibility */
3020Sstevel@tonic-gate 
3030Sstevel@tonic-gate #define	VLOC_FIRST		(VKEY_LAST+1)			/* 32640 */
3040Sstevel@tonic-gate #define	LOC_FIRST_DELTA		(VLOC_FIRST+0)			/* 32640 */
3050Sstevel@tonic-gate #define	LOC_X_DELTA		(VLOC_FIRST+0)			/* 32640 */
3060Sstevel@tonic-gate #define	LOC_Y_DELTA		(VLOC_FIRST+1)			/* 32641 */
3070Sstevel@tonic-gate #define	LOC_LAST_DELTA		(VLOC_FIRST+1)			/* 32641 */
3080Sstevel@tonic-gate 
3090Sstevel@tonic-gate #define	LOC_FIRST_ABSOLUTE	(VLOC_FIRST+2)			/* 32642 */
3100Sstevel@tonic-gate #define	LOC_X_ABSOLUTE		(VLOC_FIRST+2)			/* 32642 */
3110Sstevel@tonic-gate #define	LOC_Y_ABSOLUTE		(VLOC_FIRST+3)			/* 32643 */
3120Sstevel@tonic-gate #define	LOC_LAST_ABSOLUTE	(VLOC_FIRST+3)			/* 32643 */
3130Sstevel@tonic-gate 
3140Sstevel@tonic-gate #define	VLOC_BATCH		(VLOC_FIRST+4)			/* 32644 */
3150Sstevel@tonic-gate #define	VLOC_LAST		(VLOC_BATCH+1)			/* 32645 */
3160Sstevel@tonic-gate 
3170Sstevel@tonic-gate #define	MOUSE_CAP_CHANGE_FIRST		(VLOC_LAST+1)		/* 32646 */
3180Sstevel@tonic-gate #define	MOUSE_CAP_CHANGE_NUM_BUT	(MOUSE_CAP_CHANGE_FIRST+0) /* 32646 */
3190Sstevel@tonic-gate #define	MOUSE_CAP_CHANGE_NUM_WHEEL	(MOUSE_CAP_CHANGE_FIRST+1) /* 32647 */
3200Sstevel@tonic-gate 
3210Sstevel@tonic-gate #define	MOUSE_TYPE_ABSOLUTE	(VLOC_LAST+3)			/* 32648 */
3220Sstevel@tonic-gate 
323*1274Sqz150045 #define	MOUSE_LAST		(VLOC_LAST+3)			/* 32648 */
324*1274Sqz150045 #define	KEYBOARD_LAYOUT_CHANGE	(MOUSE_LAST+1)			/* 32649 */
325*1274Sqz150045 
3260Sstevel@tonic-gate /*
3270Sstevel@tonic-gate  * Common names for certain input codes.  The buttons on the physical
3280Sstevel@tonic-gate  * mouse are thought to actually belong to the virtual keyboard.
3290Sstevel@tonic-gate  */
3300Sstevel@tonic-gate #define	MS_LEFT		BUT(1)					/* 32544 */
3310Sstevel@tonic-gate #define	MS_MIDDLE	BUT(2)					/* 32545 */
3320Sstevel@tonic-gate #define	MS_RIGHT	BUT(3)					/* 32546 */
3330Sstevel@tonic-gate 
3340Sstevel@tonic-gate /*
3350Sstevel@tonic-gate  * A firm_event structure is encoded in the byte stream of a device
3360Sstevel@tonic-gate  * when the device has been asked to format its byte stream so.
3370Sstevel@tonic-gate  * The time stamp is not defined to be meaningful except to compare
3380Sstevel@tonic-gate  * with other Firm_event time stamps.
3390Sstevel@tonic-gate  *
3400Sstevel@tonic-gate  * The pair field is critical for a state maintainence package
3410Sstevel@tonic-gate  * (such as vuid_state.h), one that is designed to not know anything
3420Sstevel@tonic-gate  * about the semantics of particular events, to maintain correct data
3430Sstevel@tonic-gate  * for corresponding absolute, delta and paired state variables.
3440Sstevel@tonic-gate  *
3450Sstevel@tonic-gate  * pair, when defined (as indicated by pair_type), is the associated
3460Sstevel@tonic-gate  * state variable that should be updated due to this events generation.
3470Sstevel@tonic-gate  * This is used to maintain a correspondence between an event that is a
3480Sstevel@tonic-gate  * delta and a state that is an absolute value (with a known delta event
3490Sstevel@tonic-gate  * defined) and visa versa, e.g., LOC_X_DELTA & LOC_X_ABSOLUTE.
3500Sstevel@tonic-gate  * pair is also used to indicate another state variable that
3510Sstevel@tonic-gate  * should be updated with the occurrence of this event, e.g., if id is
3520Sstevel@tonic-gate  * '^G' then pair could be 'g' or 'G' depending on the state of the shift
3530Sstevel@tonic-gate  * key.
3540Sstevel@tonic-gate  */
3550Sstevel@tonic-gate typedef struct firm_event {
3560Sstevel@tonic-gate 	ushort_t	id;	/* Event's unique id */
3570Sstevel@tonic-gate 	uchar_t		pair_type;	/* Event pair's type */
3580Sstevel@tonic-gate #define	FE_PAIR_NONE		0	/* pair is not defined */
3590Sstevel@tonic-gate #define	FE_PAIR_SET		1	/* pair is accompanying id to set */
3600Sstevel@tonic-gate 					/* to this events value */
3610Sstevel@tonic-gate #define	FE_PAIR_DELTA		2	/* pair is accompanying id that */
3620Sstevel@tonic-gate 					/* should be set to the delta of */
3630Sstevel@tonic-gate 					/* id's current value and the new */
3640Sstevel@tonic-gate 					/* value indicated by this event */
3650Sstevel@tonic-gate #define	FE_PAIR_ABSOLUTE	3	/* pair is accompanying id that */
3660Sstevel@tonic-gate 					/* should be set to the sum of its */
3670Sstevel@tonic-gate 					/* current value and the delta */
3680Sstevel@tonic-gate 					/* indicated by this event's value */
3690Sstevel@tonic-gate 	uchar_t		pair;	/* Event id's associated delta|absolute|pair */
3700Sstevel@tonic-gate 				/* offset within id's segment (minus id's */
3710Sstevel@tonic-gate 				/* address) */
3720Sstevel@tonic-gate 	int		value;	/* Event's value */
3730Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
3740Sstevel@tonic-gate 	struct timeval32 time;	/* Event's time stamp */
3750Sstevel@tonic-gate #else
3760Sstevel@tonic-gate 	struct timeval time;
3770Sstevel@tonic-gate #endif
3780Sstevel@tonic-gate } Firm_event;
3790Sstevel@tonic-gate #define	FIRM_EVENT_NULL ((Firm_event *)0)
3800Sstevel@tonic-gate #define	vuid_id_addr(id)		((id) & 0xFF00)
3810Sstevel@tonic-gate #define	vuid_id_offset(id)		((id) & 0xFF)
3820Sstevel@tonic-gate #define	vuid_boolean_value(value)	(((value) == 0) || ((value) == 1))
3830Sstevel@tonic-gate #define	vuid_int_value(value)		(!(vuid_boolean_value((value))))
3840Sstevel@tonic-gate 
3850Sstevel@tonic-gate /*
3860Sstevel@tonic-gate  * Ioctls to input devices that support vuid.
3870Sstevel@tonic-gate  */
3880Sstevel@tonic-gate 
3890Sstevel@tonic-gate /*
3900Sstevel@tonic-gate  * VUID*FORMAT ioctls are used to control which byte stream format that
3910Sstevel@tonic-gate  * a input device should use.  An errno of ENOTTY or EINVAL indicates that
3920Sstevel@tonic-gate  * a device can't speak Firm_events.
3930Sstevel@tonic-gate  */
3940Sstevel@tonic-gate #define	VUIOC		('v'<<8)
3950Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
3960Sstevel@tonic-gate #define	VUIDSFORMAT   (VUIOC|11) /* avoid conflict with VT_?????? */
3970Sstevel@tonic-gate #define	VUIDGFORMAT   (VUIOC|12) /* avoid conflict with VT_?????? */
3980Sstevel@tonic-gate #else
3990Sstevel@tonic-gate #define	VUIDSFORMAT   (VUIOC|1) /* Set input device byte stream format */
4000Sstevel@tonic-gate #define	VUIDGFORMAT   (VUIOC|2) /* Get input device byte stream format */
4010Sstevel@tonic-gate #endif
4020Sstevel@tonic-gate #define	VUID_NATIVE	0	/* Native byte stream format */
4030Sstevel@tonic-gate #define	VUID_FIRM_EVENT 1	/* struct firm_event byte stream format */
4040Sstevel@tonic-gate 
4050Sstevel@tonic-gate /*
4060Sstevel@tonic-gate  * VUID*ADDR ioctls are used to control which address a particular
4070Sstevel@tonic-gate  * virtual input device segment has.  This is used to have an instancing
4080Sstevel@tonic-gate  * capability, e.g., a second mouse.  An errno of ENOTTY indicates that
4090Sstevel@tonic-gate  * a device can't deal with these commands.  An errno of ENODEV indicates
4100Sstevel@tonic-gate  * that the requested virtual device has no events generated for it by
4110Sstevel@tonic-gate  * this physical device.
4120Sstevel@tonic-gate  *
4130Sstevel@tonic-gate  * VUIDSADDR sets the virtual input device segment address indicated by
4140Sstevel@tonic-gate  * default to next.
4150Sstevel@tonic-gate  *
4160Sstevel@tonic-gate  * VUIDGADDR gets the in force address of the virtual input device segment
4170Sstevel@tonic-gate  * indicated by default into current.
4180Sstevel@tonic-gate  */
4190Sstevel@tonic-gate typedef struct	vuid_addr_probe {
4200Sstevel@tonic-gate 	short	base;		/* default vuid device addr directed too */
4210Sstevel@tonic-gate 	union	{
4220Sstevel@tonic-gate 		short	next;	/* next addr for default when VUIDSADDR */
4230Sstevel@tonic-gate 		short	current; /* current addr of default when VUIDGADDR */
4240Sstevel@tonic-gate 	} data;
4250Sstevel@tonic-gate } Vuid_addr_probe;
4260Sstevel@tonic-gate 
4270Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
4280Sstevel@tonic-gate #define	VUIDSADDR   (VUIOC|13)	/* avoid conflict with VT_?????? */
4290Sstevel@tonic-gate #define	VUIDGADDR   (VUIOC|14)	/* avoid conflict with VT_?????? */
4300Sstevel@tonic-gate #else
4310Sstevel@tonic-gate #define	VUIDSADDR   (VUIOC|3)	/* Set vuid address */
4320Sstevel@tonic-gate #define	VUIDGADDR   (VUIOC|4)	/* Get vuid address */
4330Sstevel@tonic-gate #endif
4340Sstevel@tonic-gate 
4350Sstevel@tonic-gate #ifdef	__cplusplus
4360Sstevel@tonic-gate }
4370Sstevel@tonic-gate #endif
4380Sstevel@tonic-gate 
4390Sstevel@tonic-gate #endif	/* _SYS_VUID_EVENT_H */
440