xref: /titanic_41/usr/src/uts/common/sys/vuid_event.h (revision 7db6e34e0974b29ab599ed5dbc95a2f71810f321)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*7db6e34eSqz150045  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _SYS_VUID_EVENT_H
287c478bd9Sstevel@tonic-gate #define	_SYS_VUID_EVENT_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/types.h>
337c478bd9Sstevel@tonic-gate #include <sys/types32.h>
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
407c478bd9Sstevel@tonic-gate  * This file describes a virtual user input device (vuid) interface.  This
417c478bd9Sstevel@tonic-gate  * is an interface between input devices and their clients.  The interface
427c478bd9Sstevel@tonic-gate  * defines an idealized user input device that may not correspond to any
437c478bd9Sstevel@tonic-gate  * existing physical collection of input devices.
447c478bd9Sstevel@tonic-gate  *
457c478bd9Sstevel@tonic-gate  * It is targeted to input devices that gather command data from humans,
467c478bd9Sstevel@tonic-gate  * e.g., mice, keyboards, tablets, joysticks, light pens, knobs, sliders,
477c478bd9Sstevel@tonic-gate  * buttons, ascii terminals, etc.  The vuid interface is specifically not
487c478bd9Sstevel@tonic-gate  * designed to support input devices that produce voluminous amounts of
497c478bd9Sstevel@tonic-gate  * data, e.g., input scanners, disk drives, voice packets.
507c478bd9Sstevel@tonic-gate  *
517c478bd9Sstevel@tonic-gate  * Here are some of the properties that are expected of a typical client
527c478bd9Sstevel@tonic-gate  * of vuid:
537c478bd9Sstevel@tonic-gate  *
547c478bd9Sstevel@tonic-gate  *	The client has a richer user interface than can be supported by
557c478bd9Sstevel@tonic-gate  *	a simple ascii terminal.
567c478bd9Sstevel@tonic-gate  *
577c478bd9Sstevel@tonic-gate  *	The client serializes multiple input devices being used
587c478bd9Sstevel@tonic-gate  *	by the user into a single stream of events.
597c478bd9Sstevel@tonic-gate  *
607c478bd9Sstevel@tonic-gate  *	The client preserves the entire state of its input so that
617c478bd9Sstevel@tonic-gate  *	it may query this state.
627c478bd9Sstevel@tonic-gate  *
637c478bd9Sstevel@tonic-gate  * Here are some features that vuid provides to its clients:
647c478bd9Sstevel@tonic-gate  *
657c478bd9Sstevel@tonic-gate  *	A client may extend the capabilities of the predefined vuid by
667c478bd9Sstevel@tonic-gate  *	adding input devices.  A client wants to be able to do this in
677c478bd9Sstevel@tonic-gate  *	a way that fits smoothly with its existing input paradigm.
687c478bd9Sstevel@tonic-gate  *
697c478bd9Sstevel@tonic-gate  *	A client can write its code to be input device independent.  A
707c478bd9Sstevel@tonic-gate  *	client can replace the underlaying physical devices and not
717c478bd9Sstevel@tonic-gate  *	have to be concerned.  In fact, the vuid interface doesn't
727c478bd9Sstevel@tonic-gate  *	really care about physical devices.  One physical device can
737c478bd9Sstevel@tonic-gate  *	masquerade a many logical devices and many physical devices can
747c478bd9Sstevel@tonic-gate  *	look like a single logical device.
757c478bd9Sstevel@tonic-gate  *
767c478bd9Sstevel@tonic-gate  * This file defines the protocol that makes up the virtual user input
777c478bd9Sstevel@tonic-gate  * device.  This includes:
787c478bd9Sstevel@tonic-gate  *
797c478bd9Sstevel@tonic-gate  *	The vuid station codes and there meanings.
807c478bd9Sstevel@tonic-gate  *
817c478bd9Sstevel@tonic-gate  *	The form by which changes to vuid stations, i.e., firm events,
827c478bd9Sstevel@tonic-gate  *	are communicated to clients (typically via the read system
837c478bd9Sstevel@tonic-gate  *	call).
847c478bd9Sstevel@tonic-gate  *
857c478bd9Sstevel@tonic-gate  *	The form by which clients send commands to input devices that
867c478bd9Sstevel@tonic-gate  *	support the vuid (typically via an ioctl system call to send
877c478bd9Sstevel@tonic-gate  *	vuid instead of a native byte stream).
887c478bd9Sstevel@tonic-gate  *
897c478bd9Sstevel@tonic-gate  * Explicitly, this file does not define:
907c478bd9Sstevel@tonic-gate  *
917c478bd9Sstevel@tonic-gate  *	How to store the state of the vuid
927c478bd9Sstevel@tonic-gate  *	(see ../sunwindowdev/vuid_state.h).
937c478bd9Sstevel@tonic-gate  *
947c478bd9Sstevel@tonic-gate  *	How to dynamically allocate additional vuid segments in order
957c478bd9Sstevel@tonic-gate  *	to extend the vuid (one could statically allocate additional
967c478bd9Sstevel@tonic-gate  *	vuid segments by treating this file as the central registry
977c478bd9Sstevel@tonic-gate  *	of vuid segments).
987c478bd9Sstevel@tonic-gate  */
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * VUID_SEG_SIZE is the size of a virtual user input "device" address space
1027c478bd9Sstevel@tonic-gate  * segment.
1037c478bd9Sstevel@tonic-gate  */
1047c478bd9Sstevel@tonic-gate #define	VUID_SEG_SIZE	(256)
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate /*
1077c478bd9Sstevel@tonic-gate  * This is the central registry of virtual user input devices.
1087c478bd9Sstevel@tonic-gate  * To allocate a new vuid:
1097c478bd9Sstevel@tonic-gate  *
1107c478bd9Sstevel@tonic-gate  *	o Choose an unused portion of the address space.
1117c478bd9Sstevel@tonic-gate  *	  Vuids from 0x00 to 0x7F are reserved for Sun implementers.
1127c478bd9Sstevel@tonic-gate  *	  Vuids from 0x80 to 0xFF are reserved for Sun customers.
1137c478bd9Sstevel@tonic-gate  *
1147c478bd9Sstevel@tonic-gate  *	o Note the new device with a *_DEVID define.  Breifly describe
1157c478bd9Sstevel@tonic-gate  *	  the purpose/usage of the device.  Point to the place where
1167c478bd9Sstevel@tonic-gate  *	  more information can be found.
1177c478bd9Sstevel@tonic-gate  *
1187c478bd9Sstevel@tonic-gate  *	o Note the new device with a VUID_* entry in the Vuid_device
1197c478bd9Sstevel@tonic-gate  *	  enumeration.
1207c478bd9Sstevel@tonic-gate  *
1217c478bd9Sstevel@tonic-gate  *	o List the specific event codes in another header file that is
1227c478bd9Sstevel@tonic-gate  *	  specific to the new device (ASCII_DEVID, TOP_DEVID &
1237c478bd9Sstevel@tonic-gate  *	  WORKSTATION_DEVID events are listing here for historical
1247c478bd9Sstevel@tonic-gate  *	  reasons).
1257c478bd9Sstevel@tonic-gate  */
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #define	ASCII_DEVID		0x00
1287c478bd9Sstevel@tonic-gate 	/* Ascii codes, which include META codes and 8-bit EUC codes */
1297c478bd9Sstevel@tonic-gate 	/* (see below) */
1307c478bd9Sstevel@tonic-gate #define	TOP_DEVID		0x01
1317c478bd9Sstevel@tonic-gate 	/* Top codes, which is ASCII with the 9th bit on (see below) */
1327c478bd9Sstevel@tonic-gate #define	ISO_DEVID		0x02
1337c478bd9Sstevel@tonic-gate 	/* ISO characters 0x80 - 0xFF (backwards compatibility) */
1347c478bd9Sstevel@tonic-gate /* ... Sun implementers add new device ids here ... */
1357c478bd9Sstevel@tonic-gate #define	WHEEL_DEVID		0x78
1367c478bd9Sstevel@tonic-gate #define	LIGHTPEN_DEVID		0x79
1377c478bd9Sstevel@tonic-gate 	/* Lightpen events for	Lightpen */
1387c478bd9Sstevel@tonic-gate #define	BUTTON_DEVID		0x7A
1397c478bd9Sstevel@tonic-gate 	/* Button events from Sun button box */
1407c478bd9Sstevel@tonic-gate #define	DIAL_DEVID		0x7B
1417c478bd9Sstevel@tonic-gate 	/* Dial events from Sun dial box */
1427c478bd9Sstevel@tonic-gate #define	SUNVIEW_DEVID		0x7C
1437c478bd9Sstevel@tonic-gate 	/* Sunview Semantic events */
1447c478bd9Sstevel@tonic-gate #define	PANEL_DEVID		0x7D
1457c478bd9Sstevel@tonic-gate 	/* Panel subwindow package event codes passed around internal */
1467c478bd9Sstevel@tonic-gate 	/* to the panel package (see <suntool/panel.h>) */
1477c478bd9Sstevel@tonic-gate #define	SCROLL_DEVID		0x7E
1487c478bd9Sstevel@tonic-gate 	/* Scrollbar package event codes passed to scrollbar clients on */
1497c478bd9Sstevel@tonic-gate 	/* interesting scrollbar activity (see <suntool/scrollbar.h>) */
1507c478bd9Sstevel@tonic-gate #define	WORKSTATION_DEVID	0x7F
1517c478bd9Sstevel@tonic-gate 	/* Virtual keyboard and locator (mouse) related event codes */
1527c478bd9Sstevel@tonic-gate 	/* that describe a basic "workstation" device collection (see below). */
1537c478bd9Sstevel@tonic-gate 	/* This device is a bit of a hodge podge for historical reasons; */
1547c478bd9Sstevel@tonic-gate 	/* the middle of the address space has SunWindows related events */
1557c478bd9Sstevel@tonic-gate 	/* in it (see <sunwindow/win_input.h >), and the virtual keyboard */
1567c478bd9Sstevel@tonic-gate 	/* and virtual locator are thrown together. */
1577c478bd9Sstevel@tonic-gate /* ... Sun customers add new device ids here ... */
1587c478bd9Sstevel@tonic-gate #define	LAST_DEVID		0xFF
1597c478bd9Sstevel@tonic-gate 	/* No more device ids beyond LAST_DEVID */
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate typedef enum vuid_device {
1627c478bd9Sstevel@tonic-gate 	VUID_ASCII = ASCII_DEVID,
1637c478bd9Sstevel@tonic-gate 	VUID_TOP = TOP_DEVID,
1647c478bd9Sstevel@tonic-gate 	VUID_ISO = ISO_DEVID,
1657c478bd9Sstevel@tonic-gate 	VUID_WHEEL = WHEEL_DEVID,
1667c478bd9Sstevel@tonic-gate 	VUID_LIGHTPEN = LIGHTPEN_DEVID,
1677c478bd9Sstevel@tonic-gate 	VUID_DIAL = DIAL_DEVID,
1687c478bd9Sstevel@tonic-gate 	VUID_SUNVIEW = SUNVIEW_DEVID,
1697c478bd9Sstevel@tonic-gate 	VUID_PANEL = PANEL_DEVID,
1707c478bd9Sstevel@tonic-gate 	VUID_SCROLL = SCROLL_DEVID,
1717c478bd9Sstevel@tonic-gate 	VUID_WORKSTATION = WORKSTATION_DEVID,
1727c478bd9Sstevel@tonic-gate 	VUID_LAST = LAST_DEVID
1737c478bd9Sstevel@tonic-gate } Vuid_device;
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate #define	vuid_first(devid)	((devid) << 8)
1767c478bd9Sstevel@tonic-gate #define	vuid_last(devid)	(((devid) << 8)+VUID_SEG_SIZE-1)
1777c478bd9Sstevel@tonic-gate #define	vuid_in_range(devid, id) \
1787c478bd9Sstevel@tonic-gate 	    ((id >= vuid_first(devid)) && (id <= vuid_last(devid)))
1797c478bd9Sstevel@tonic-gate 
1807c478bd9Sstevel@tonic-gate /*
1817c478bd9Sstevel@tonic-gate  * EUC (Extended UNIX Code) device related definitions:
1827c478bd9Sstevel@tonic-gate  */
1837c478bd9Sstevel@tonic-gate #define	EUC_FIRST	(0)
1847c478bd9Sstevel@tonic-gate #define	EUC_LAST	(255)
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate  * Old ASCII definitions for backwards compatibility:
1887c478bd9Sstevel@tonic-gate  */
1897c478bd9Sstevel@tonic-gate #define	ASCII_FIRST	(0)
1907c478bd9Sstevel@tonic-gate #define	ASCII_LAST	(127)
1917c478bd9Sstevel@tonic-gate #define	META_FIRST	(128)
1927c478bd9Sstevel@tonic-gate #define	META_LAST	(255)
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate /*
1957c478bd9Sstevel@tonic-gate  * Top device related definitions:
1967c478bd9Sstevel@tonic-gate  */
1977c478bd9Sstevel@tonic-gate #define	TOP_FIRST	(256)
1987c478bd9Sstevel@tonic-gate #define	TOP_LAST	(511)
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate /*
2017c478bd9Sstevel@tonic-gate  * Old ISO definitions for backwards compatibility:
2027c478bd9Sstevel@tonic-gate  */
2037c478bd9Sstevel@tonic-gate #define	ISO_FIRST	(512)
2047c478bd9Sstevel@tonic-gate #define	ISO_LAST	(767)
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate /*
2077c478bd9Sstevel@tonic-gate  * Workstation device related definitions.  First are virtual keyboard
2087c478bd9Sstevel@tonic-gate  * assignments.	 All events for the virtual keyboard have 0 (went up) or
2097c478bd9Sstevel@tonic-gate  * 1 (went down) values.
2107c478bd9Sstevel@tonic-gate  */
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate #define	VKEY_FIRST	vuid_first(WORKSTATION_DEVID)
2137c478bd9Sstevel@tonic-gate #define	VKEY_UP		0
2147c478bd9Sstevel@tonic-gate #define	VKEY_DOWN	1
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate #define	VKEY_KBD_CODES	(128)	/* The number of event codes in a subset of */
2177c478bd9Sstevel@tonic-gate 				/* the workstation device's address space */
2187c478bd9Sstevel@tonic-gate 				/* that belong to the virtual keyboard */
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate #define	VKEY_FIRSTPSEUDO	(VKEY_FIRST)			/* 32512 */
2217c478bd9Sstevel@tonic-gate /*
2227c478bd9Sstevel@tonic-gate  * VKEY_FIRSTPSEUDO thru VKEY_LASTPSEUDO are taken (for historical
2237c478bd9Sstevel@tonic-gate  * reasons) by SunWindows related codes (see <sunwindow/win_input.h >).
2247c478bd9Sstevel@tonic-gate  */
2257c478bd9Sstevel@tonic-gate #define	VKEY_LASTPSEUDO		(VKEY_FIRSTPSEUDO+15)		/* 32527 */
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate #define	VKEY_FIRSTSHIFT		(VKEY_LASTPSEUDO+1)		/* 32528 */
2287c478bd9Sstevel@tonic-gate #define	SHIFT_CAPSLOCK		(VKEY_FIRSTSHIFT+0)		/* 32528 */
2297c478bd9Sstevel@tonic-gate #define	SHIFT_LOCK		(VKEY_FIRSTSHIFT+1)		/* 32529 */
2307c478bd9Sstevel@tonic-gate #define	SHIFT_LEFT		(VKEY_FIRSTSHIFT+2)		/* 32530 */
2317c478bd9Sstevel@tonic-gate #define	SHIFT_RIGHT		(VKEY_FIRSTSHIFT+3)		/* 32531 */
2327c478bd9Sstevel@tonic-gate #define	SHIFT_LEFTCTRL		(VKEY_FIRSTSHIFT+4)		/* 32532 */
2337c478bd9Sstevel@tonic-gate /* SHIFT_CTRL is for compatability with previous releases */	/* 32532 */
2347c478bd9Sstevel@tonic-gate #define	SHIFT_CTRL		SHIFT_LEFTCTRL			/* 32532 */
2357c478bd9Sstevel@tonic-gate #define	SHIFT_RIGHTCTRL		(VKEY_FIRSTSHIFT+5)		/* 32533 */
2367c478bd9Sstevel@tonic-gate #define	SHIFT_META		(VKEY_FIRSTSHIFT+6)		/* 32534 */
2377c478bd9Sstevel@tonic-gate #define	SHIFT_TOP		(VKEY_FIRSTSHIFT+7)		/* 32535 */
2387c478bd9Sstevel@tonic-gate #define	SHIFT_CMD		(VKEY_FIRSTSHIFT+8)		/* 32536 */
2397c478bd9Sstevel@tonic-gate #define	SHIFT_ALTG		(VKEY_FIRSTSHIFT+9)		/* 32537 */
2407c478bd9Sstevel@tonic-gate #define	SHIFT_ALT		(VKEY_FIRSTSHIFT+10)		/* 32538 */
2417c478bd9Sstevel@tonic-gate #define	SHIFT_NUMLOCK		(VKEY_FIRSTSHIFT+11)		/* 32539 */
2427c478bd9Sstevel@tonic-gate #define	VKEY_LASTSHIFT		(VKEY_FIRSTSHIFT+15)		/* 32543 */
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate #define	VKEY_FIRSTFUNC		(VKEY_LASTSHIFT+1)		/* 32544 */
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate #define	BUT_FIRST		(VKEY_FIRSTFUNC)		/* 32544 */
2477c478bd9Sstevel@tonic-gate #define	BUT(i)			((BUT_FIRST)+(i)-1)		/* 32544+i-1 */
2487c478bd9Sstevel@tonic-gate #define	BUT_LAST		(BUT_FIRST+9)			/* 32553 */
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate #define	KEY_LEFTFIRST		((BUT_LAST)+1)			/* 32554 */
2517c478bd9Sstevel@tonic-gate #define	KEY_LEFT(i)		((KEY_LEFTFIRST)+(i)-1)		/* 32554+i-1 */
2527c478bd9Sstevel@tonic-gate #define	KEY_LEFTLAST		((KEY_LEFTFIRST)+15)		/* 32569 */
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate #define	KEY_RIGHTFIRST		((KEY_LEFTLAST)+1)		/* 32570 */
2557c478bd9Sstevel@tonic-gate #define	KEY_RIGHT(i)		((KEY_RIGHTFIRST)+(i)-1)	/* 32570+i-1 */
2567c478bd9Sstevel@tonic-gate #define	KEY_RIGHTLAST		((KEY_RIGHTFIRST)+15)		/* 32585 */
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate #define	KEY_TOPFIRST		((KEY_RIGHTLAST)+1)		/* 32586 */
2597c478bd9Sstevel@tonic-gate #define	KEY_TOP(i)		((KEY_TOPFIRST)+(i)-1)		/* 32586+i-1 */
2607c478bd9Sstevel@tonic-gate #define	KEY_TOPLAST		((KEY_TOPFIRST)+15)		/* 32601 */
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate #define	KEY_BOTTOMLEFT		((KEY_TOPLAST)+1)		/* 32602 */
2637c478bd9Sstevel@tonic-gate #define	KEY_BOTTOMRIGHT		((KEY_BOTTOMLEFT)+1)		/* 32603 */
2647c478bd9Sstevel@tonic-gate #define	KEY_BOTTOMFIRST		((KEY_TOPLAST)+1)		/* 32602 */
2657c478bd9Sstevel@tonic-gate #define	KEY_BOTTOM(i)		((KEY_BOTTOMFIRST)+(i)-1)	/* 32602+i-1 */
2667c478bd9Sstevel@tonic-gate #define	KEY_BOTTOMLAST		((KEY_BOTTOMFIRST)+15)		/* 32617 */
2677c478bd9Sstevel@tonic-gate 
2687c478bd9Sstevel@tonic-gate #define	VKEY_LASTFUNC		(VKEY_FIRSTFUNC+73)		/* 32617 */
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate #define	VKEY_FIRSTPAD		(VKEY_LASTFUNC+1)		/* 32618 */
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate #define	VKEY_PADEQUAL		(VKEY_FIRSTPAD+0)		/* 32618 */
2737c478bd9Sstevel@tonic-gate #define	VKEY_PADSLASH		(VKEY_FIRSTPAD+1)		/* 32619 */
2747c478bd9Sstevel@tonic-gate #define	VKEY_PADSTAR		(VKEY_FIRSTPAD+2)		/* 32620 */
2757c478bd9Sstevel@tonic-gate #define	VKEY_PADMINUS		(VKEY_FIRSTPAD+3)		/* 32621 */
2767c478bd9Sstevel@tonic-gate #define	VKEY_PADSEP		(VKEY_FIRSTPAD+4)		/* 32622 */
2777c478bd9Sstevel@tonic-gate #define	VKEY_PAD7		(VKEY_FIRSTPAD+5)		/* 32623 */
2787c478bd9Sstevel@tonic-gate #define	VKEY_PAD8		(VKEY_FIRSTPAD+6)		/* 32624 */
2797c478bd9Sstevel@tonic-gate #define	VKEY_PAD9		(VKEY_FIRSTPAD+7)		/* 32625 */
2807c478bd9Sstevel@tonic-gate #define	VKEY_PADPLUS		(VKEY_FIRSTPAD+8)		/* 32626 */
2817c478bd9Sstevel@tonic-gate #define	VKEY_PAD4		(VKEY_FIRSTPAD+9)		/* 32627 */
2827c478bd9Sstevel@tonic-gate #define	VKEY_PAD5		(VKEY_FIRSTPAD+10)		/* 32628 */
2837c478bd9Sstevel@tonic-gate #define	VKEY_PAD6		(VKEY_FIRSTPAD+11)		/* 32629 */
2847c478bd9Sstevel@tonic-gate #define	VKEY_PAD1		(VKEY_FIRSTPAD+12)		/* 32630 */
2857c478bd9Sstevel@tonic-gate #define	VKEY_PAD2		(VKEY_FIRSTPAD+13)		/* 32631 */
2867c478bd9Sstevel@tonic-gate #define	VKEY_PAD3		(VKEY_FIRSTPAD+14)		/* 32632 */
2877c478bd9Sstevel@tonic-gate #define	VKEY_PAD0		(VKEY_FIRSTPAD+15)		/* 32633 */
2887c478bd9Sstevel@tonic-gate #define	VKEY_PADDOT		(VKEY_FIRSTPAD+16)		/* 32634 */
2897c478bd9Sstevel@tonic-gate #define	VKEY_PADENTER		(VKEY_FIRSTPAD+17)		/* 32635 */
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate #define	VKEY_LASTPAD		(VKEY_FIRSTPAD+17)		/* 32635 */
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate #define	VKEY_LAST		(VKEY_FIRST+VKEY_KBD_CODES-1)	/* 32639 */
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate /*
2967c478bd9Sstevel@tonic-gate  * More workstation device definitions.	 These are virtual locator
2977c478bd9Sstevel@tonic-gate  * related event code assignments.  Values for these events are int.
2987c478bd9Sstevel@tonic-gate  * VLOC_BATCH's value is a uint_t that describes the number of events
2997c478bd9Sstevel@tonic-gate  * that follow that should be treated as a batch.
3007c478bd9Sstevel@tonic-gate  */
3017c478bd9Sstevel@tonic-gate #define	MOUSE_DEVID	WORKSTATION_DEVID	/* Backward compatibility */
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate #define	VLOC_FIRST		(VKEY_LAST+1)			/* 32640 */
3047c478bd9Sstevel@tonic-gate #define	LOC_FIRST_DELTA		(VLOC_FIRST+0)			/* 32640 */
3057c478bd9Sstevel@tonic-gate #define	LOC_X_DELTA		(VLOC_FIRST+0)			/* 32640 */
3067c478bd9Sstevel@tonic-gate #define	LOC_Y_DELTA		(VLOC_FIRST+1)			/* 32641 */
3077c478bd9Sstevel@tonic-gate #define	LOC_LAST_DELTA		(VLOC_FIRST+1)			/* 32641 */
3087c478bd9Sstevel@tonic-gate 
3097c478bd9Sstevel@tonic-gate #define	LOC_FIRST_ABSOLUTE	(VLOC_FIRST+2)			/* 32642 */
3107c478bd9Sstevel@tonic-gate #define	LOC_X_ABSOLUTE		(VLOC_FIRST+2)			/* 32642 */
3117c478bd9Sstevel@tonic-gate #define	LOC_Y_ABSOLUTE		(VLOC_FIRST+3)			/* 32643 */
3127c478bd9Sstevel@tonic-gate #define	LOC_LAST_ABSOLUTE	(VLOC_FIRST+3)			/* 32643 */
3137c478bd9Sstevel@tonic-gate 
3147c478bd9Sstevel@tonic-gate #define	VLOC_BATCH		(VLOC_FIRST+4)			/* 32644 */
3157c478bd9Sstevel@tonic-gate #define	VLOC_LAST		(VLOC_BATCH+1)			/* 32645 */
3167c478bd9Sstevel@tonic-gate 
3177c478bd9Sstevel@tonic-gate #define	MOUSE_CAP_CHANGE_FIRST		(VLOC_LAST+1)		/* 32646 */
3187c478bd9Sstevel@tonic-gate #define	MOUSE_CAP_CHANGE_NUM_BUT	(MOUSE_CAP_CHANGE_FIRST+0) /* 32646 */
3197c478bd9Sstevel@tonic-gate #define	MOUSE_CAP_CHANGE_NUM_WHEEL	(MOUSE_CAP_CHANGE_FIRST+1) /* 32647 */
3207c478bd9Sstevel@tonic-gate 
3217c478bd9Sstevel@tonic-gate #define	MOUSE_TYPE_ABSOLUTE	(VLOC_LAST+3)			/* 32648 */
3227c478bd9Sstevel@tonic-gate 
323*7db6e34eSqz150045 #define	MOUSE_LAST		(VLOC_LAST+3)			/* 32648 */
324*7db6e34eSqz150045 #define	KEYBOARD_LAYOUT_CHANGE	(MOUSE_LAST+1)			/* 32649 */
325*7db6e34eSqz150045 
3267c478bd9Sstevel@tonic-gate /*
3277c478bd9Sstevel@tonic-gate  * Common names for certain input codes.  The buttons on the physical
3287c478bd9Sstevel@tonic-gate  * mouse are thought to actually belong to the virtual keyboard.
3297c478bd9Sstevel@tonic-gate  */
3307c478bd9Sstevel@tonic-gate #define	MS_LEFT		BUT(1)					/* 32544 */
3317c478bd9Sstevel@tonic-gate #define	MS_MIDDLE	BUT(2)					/* 32545 */
3327c478bd9Sstevel@tonic-gate #define	MS_RIGHT	BUT(3)					/* 32546 */
3337c478bd9Sstevel@tonic-gate 
3347c478bd9Sstevel@tonic-gate /*
3357c478bd9Sstevel@tonic-gate  * A firm_event structure is encoded in the byte stream of a device
3367c478bd9Sstevel@tonic-gate  * when the device has been asked to format its byte stream so.
3377c478bd9Sstevel@tonic-gate  * The time stamp is not defined to be meaningful except to compare
3387c478bd9Sstevel@tonic-gate  * with other Firm_event time stamps.
3397c478bd9Sstevel@tonic-gate  *
3407c478bd9Sstevel@tonic-gate  * The pair field is critical for a state maintainence package
3417c478bd9Sstevel@tonic-gate  * (such as vuid_state.h), one that is designed to not know anything
3427c478bd9Sstevel@tonic-gate  * about the semantics of particular events, to maintain correct data
3437c478bd9Sstevel@tonic-gate  * for corresponding absolute, delta and paired state variables.
3447c478bd9Sstevel@tonic-gate  *
3457c478bd9Sstevel@tonic-gate  * pair, when defined (as indicated by pair_type), is the associated
3467c478bd9Sstevel@tonic-gate  * state variable that should be updated due to this events generation.
3477c478bd9Sstevel@tonic-gate  * This is used to maintain a correspondence between an event that is a
3487c478bd9Sstevel@tonic-gate  * delta and a state that is an absolute value (with a known delta event
3497c478bd9Sstevel@tonic-gate  * defined) and visa versa, e.g., LOC_X_DELTA & LOC_X_ABSOLUTE.
3507c478bd9Sstevel@tonic-gate  * pair is also used to indicate another state variable that
3517c478bd9Sstevel@tonic-gate  * should be updated with the occurrence of this event, e.g., if id is
3527c478bd9Sstevel@tonic-gate  * '^G' then pair could be 'g' or 'G' depending on the state of the shift
3537c478bd9Sstevel@tonic-gate  * key.
3547c478bd9Sstevel@tonic-gate  */
3557c478bd9Sstevel@tonic-gate typedef struct firm_event {
3567c478bd9Sstevel@tonic-gate 	ushort_t	id;	/* Event's unique id */
3577c478bd9Sstevel@tonic-gate 	uchar_t		pair_type;	/* Event pair's type */
3587c478bd9Sstevel@tonic-gate #define	FE_PAIR_NONE		0	/* pair is not defined */
3597c478bd9Sstevel@tonic-gate #define	FE_PAIR_SET		1	/* pair is accompanying id to set */
3607c478bd9Sstevel@tonic-gate 					/* to this events value */
3617c478bd9Sstevel@tonic-gate #define	FE_PAIR_DELTA		2	/* pair is accompanying id that */
3627c478bd9Sstevel@tonic-gate 					/* should be set to the delta of */
3637c478bd9Sstevel@tonic-gate 					/* id's current value and the new */
3647c478bd9Sstevel@tonic-gate 					/* value indicated by this event */
3657c478bd9Sstevel@tonic-gate #define	FE_PAIR_ABSOLUTE	3	/* pair is accompanying id that */
3667c478bd9Sstevel@tonic-gate 					/* should be set to the sum of its */
3677c478bd9Sstevel@tonic-gate 					/* current value and the delta */
3687c478bd9Sstevel@tonic-gate 					/* indicated by this event's value */
3697c478bd9Sstevel@tonic-gate 	uchar_t		pair;	/* Event id's associated delta|absolute|pair */
3707c478bd9Sstevel@tonic-gate 				/* offset within id's segment (minus id's */
3717c478bd9Sstevel@tonic-gate 				/* address) */
3727c478bd9Sstevel@tonic-gate 	int		value;	/* Event's value */
3737c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx)
3747c478bd9Sstevel@tonic-gate 	struct timeval32 time;	/* Event's time stamp */
3757c478bd9Sstevel@tonic-gate #else
3767c478bd9Sstevel@tonic-gate 	struct timeval time;
3777c478bd9Sstevel@tonic-gate #endif
3787c478bd9Sstevel@tonic-gate } Firm_event;
3797c478bd9Sstevel@tonic-gate #define	FIRM_EVENT_NULL ((Firm_event *)0)
3807c478bd9Sstevel@tonic-gate #define	vuid_id_addr(id)		((id) & 0xFF00)
3817c478bd9Sstevel@tonic-gate #define	vuid_id_offset(id)		((id) & 0xFF)
3827c478bd9Sstevel@tonic-gate #define	vuid_boolean_value(value)	(((value) == 0) || ((value) == 1))
3837c478bd9Sstevel@tonic-gate #define	vuid_int_value(value)		(!(vuid_boolean_value((value))))
3847c478bd9Sstevel@tonic-gate 
3857c478bd9Sstevel@tonic-gate /*
3867c478bd9Sstevel@tonic-gate  * Ioctls to input devices that support vuid.
3877c478bd9Sstevel@tonic-gate  */
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate /*
3907c478bd9Sstevel@tonic-gate  * VUID*FORMAT ioctls are used to control which byte stream format that
3917c478bd9Sstevel@tonic-gate  * a input device should use.  An errno of ENOTTY or EINVAL indicates that
3927c478bd9Sstevel@tonic-gate  * a device can't speak Firm_events.
3937c478bd9Sstevel@tonic-gate  */
3947c478bd9Sstevel@tonic-gate #define	VUIOC		('v'<<8)
3957c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
3967c478bd9Sstevel@tonic-gate #define	VUIDSFORMAT   (VUIOC|11) /* avoid conflict with VT_?????? */
3977c478bd9Sstevel@tonic-gate #define	VUIDGFORMAT   (VUIOC|12) /* avoid conflict with VT_?????? */
3987c478bd9Sstevel@tonic-gate #else
3997c478bd9Sstevel@tonic-gate #define	VUIDSFORMAT   (VUIOC|1) /* Set input device byte stream format */
4007c478bd9Sstevel@tonic-gate #define	VUIDGFORMAT   (VUIOC|2) /* Get input device byte stream format */
4017c478bd9Sstevel@tonic-gate #endif
4027c478bd9Sstevel@tonic-gate #define	VUID_NATIVE	0	/* Native byte stream format */
4037c478bd9Sstevel@tonic-gate #define	VUID_FIRM_EVENT 1	/* struct firm_event byte stream format */
4047c478bd9Sstevel@tonic-gate 
4057c478bd9Sstevel@tonic-gate /*
4067c478bd9Sstevel@tonic-gate  * VUID*ADDR ioctls are used to control which address a particular
4077c478bd9Sstevel@tonic-gate  * virtual input device segment has.  This is used to have an instancing
4087c478bd9Sstevel@tonic-gate  * capability, e.g., a second mouse.  An errno of ENOTTY indicates that
4097c478bd9Sstevel@tonic-gate  * a device can't deal with these commands.  An errno of ENODEV indicates
4107c478bd9Sstevel@tonic-gate  * that the requested virtual device has no events generated for it by
4117c478bd9Sstevel@tonic-gate  * this physical device.
4127c478bd9Sstevel@tonic-gate  *
4137c478bd9Sstevel@tonic-gate  * VUIDSADDR sets the virtual input device segment address indicated by
4147c478bd9Sstevel@tonic-gate  * default to next.
4157c478bd9Sstevel@tonic-gate  *
4167c478bd9Sstevel@tonic-gate  * VUIDGADDR gets the in force address of the virtual input device segment
4177c478bd9Sstevel@tonic-gate  * indicated by default into current.
4187c478bd9Sstevel@tonic-gate  */
4197c478bd9Sstevel@tonic-gate typedef struct	vuid_addr_probe {
4207c478bd9Sstevel@tonic-gate 	short	base;		/* default vuid device addr directed too */
4217c478bd9Sstevel@tonic-gate 	union	{
4227c478bd9Sstevel@tonic-gate 		short	next;	/* next addr for default when VUIDSADDR */
4237c478bd9Sstevel@tonic-gate 		short	current; /* current addr of default when VUIDGADDR */
4247c478bd9Sstevel@tonic-gate 	} data;
4257c478bd9Sstevel@tonic-gate } Vuid_addr_probe;
4267c478bd9Sstevel@tonic-gate 
4277c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__i386_COMPAT)
4287c478bd9Sstevel@tonic-gate #define	VUIDSADDR   (VUIOC|13)	/* avoid conflict with VT_?????? */
4297c478bd9Sstevel@tonic-gate #define	VUIDGADDR   (VUIOC|14)	/* avoid conflict with VT_?????? */
4307c478bd9Sstevel@tonic-gate #else
4317c478bd9Sstevel@tonic-gate #define	VUIDSADDR   (VUIOC|3)	/* Set vuid address */
4327c478bd9Sstevel@tonic-gate #define	VUIDGADDR   (VUIOC|4)	/* Get vuid address */
4337c478bd9Sstevel@tonic-gate #endif
4347c478bd9Sstevel@tonic-gate 
4357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4367c478bd9Sstevel@tonic-gate }
4377c478bd9Sstevel@tonic-gate #endif
4387c478bd9Sstevel@tonic-gate 
4397c478bd9Sstevel@tonic-gate #endif	/* _SYS_VUID_EVENT_H */
440