vuid_event.h revision 7db6e34e0974b29ab599ed5dbc95a2f71810f321
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_VUID_EVENT_H
#define _SYS_VUID_EVENT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file describes a virtual user input device (vuid) interface. This
* is an interface between input devices and their clients. The interface
* defines an idealized user input device that may not correspond to any
* existing physical collection of input devices.
*
* It is targeted to input devices that gather command data from humans,
* e.g., mice, keyboards, tablets, joysticks, light pens, knobs, sliders,
* buttons, ascii terminals, etc. The vuid interface is specifically not
* designed to support input devices that produce voluminous amounts of
* data, e.g., input scanners, disk drives, voice packets.
*
* Here are some of the properties that are expected of a typical client
* of vuid:
*
* The client has a richer user interface than can be supported by
* a simple ascii terminal.
*
* The client serializes multiple input devices being used
* by the user into a single stream of events.
*
* The client preserves the entire state of its input so that
* it may query this state.
*
* Here are some features that vuid provides to its clients:
*
* A client may extend the capabilities of the predefined vuid by
* adding input devices. A client wants to be able to do this in
* a way that fits smoothly with its existing input paradigm.
*
* A client can write its code to be input device independent. A
* client can replace the underlaying physical devices and not
* have to be concerned. In fact, the vuid interface doesn't
* really care about physical devices. One physical device can
* masquerade a many logical devices and many physical devices can
* look like a single logical device.
*
* This file defines the protocol that makes up the virtual user input
* device. This includes:
*
* The vuid station codes and there meanings.
*
* The form by which changes to vuid stations, i.e., firm events,
* are communicated to clients (typically via the read system
* call).
*
* The form by which clients send commands to input devices that
* support the vuid (typically via an ioctl system call to send
* vuid instead of a native byte stream).
*
* Explicitly, this file does not define:
*
* How to store the state of the vuid
* (see ../sunwindowdev/vuid_state.h).
*
* How to dynamically allocate additional vuid segments in order
* to extend the vuid (one could statically allocate additional
* vuid segments by treating this file as the central registry
* of vuid segments).
*/
/*
* VUID_SEG_SIZE is the size of a virtual user input "device" address space
* segment.
*/
#define VUID_SEG_SIZE (256)
/*
* This is the central registry of virtual user input devices.
* To allocate a new vuid:
*
* o Choose an unused portion of the address space.
* Vuids from 0x00 to 0x7F are reserved for Sun implementers.
* Vuids from 0x80 to 0xFF are reserved for Sun customers.
*
* o Note the new device with a *_DEVID define. Breifly describe
* more information can be found.
*
* o Note the new device with a VUID_* entry in the Vuid_device
* enumeration.
*
* o List the specific event codes in another header file that is
* specific to the new device (ASCII_DEVID, TOP_DEVID &
* WORKSTATION_DEVID events are listing here for historical
* reasons).
*/
#define ASCII_DEVID 0x00
/* Ascii codes, which include META codes and 8-bit EUC codes */
/* (see below) */
#define TOP_DEVID 0x01
/* Top codes, which is ASCII with the 9th bit on (see below) */
#define ISO_DEVID 0x02
/* ISO characters 0x80 - 0xFF (backwards compatibility) */
/* ... Sun implementers add new device ids here ... */
#define WHEEL_DEVID 0x78
#define LIGHTPEN_DEVID 0x79
/* Lightpen events for Lightpen */
#define BUTTON_DEVID 0x7A
/* Button events from Sun button box */
#define DIAL_DEVID 0x7B
/* Dial events from Sun dial box */
#define SUNVIEW_DEVID 0x7C
/* Sunview Semantic events */
#define PANEL_DEVID 0x7D
/* Panel subwindow package event codes passed around internal */
#define SCROLL_DEVID 0x7E
/* Scrollbar package event codes passed to scrollbar clients on */
/* interesting scrollbar activity (see <suntool/scrollbar.h>) */
#define WORKSTATION_DEVID 0x7F
/* Virtual keyboard and locator (mouse) related event codes */
/* that describe a basic "workstation" device collection (see below). */
/* This device is a bit of a hodge podge for historical reasons; */
/* the middle of the address space has SunWindows related events */
/* in it (see <sunwindow/win_input.h >), and the virtual keyboard */
/* and virtual locator are thrown together. */
/* ... Sun customers add new device ids here ... */
#define LAST_DEVID 0xFF
/* No more device ids beyond LAST_DEVID */
typedef enum vuid_device {
} Vuid_device;
/*
* EUC (Extended UNIX Code) device related definitions:
*/
#define EUC_FIRST (0)
#define EUC_LAST (255)
/*
* Old ASCII definitions for backwards compatibility:
*/
#define ASCII_FIRST (0)
#define ASCII_LAST (127)
#define META_FIRST (128)
#define META_LAST (255)
/*
* Top device related definitions:
*/
#define TOP_FIRST (256)
#define TOP_LAST (511)
/*
* Old ISO definitions for backwards compatibility:
*/
#define ISO_FIRST (512)
#define ISO_LAST (767)
/*
* Workstation device related definitions. First are virtual keyboard
* assignments. All events for the virtual keyboard have 0 (went up) or
* 1 (went down) values.
*/
#define VKEY_UP 0
#define VKEY_DOWN 1
/* the workstation device's address space */
/* that belong to the virtual keyboard */
/*
* VKEY_FIRSTPSEUDO thru VKEY_LASTPSEUDO are taken (for historical
* reasons) by SunWindows related codes (see <sunwindow/win_input.h >).
*/
/* SHIFT_CTRL is for compatability with previous releases */ /* 32532 */
/*
* More workstation device definitions. These are virtual locator
* related event code assignments. Values for these events are int.
* VLOC_BATCH's value is a uint_t that describes the number of events
* that follow that should be treated as a batch.
*/
/*
* Common names for certain input codes. The buttons on the physical
* mouse are thought to actually belong to the virtual keyboard.
*/
/*
* A firm_event structure is encoded in the byte stream of a device
* when the device has been asked to format its byte stream so.
* The time stamp is not defined to be meaningful except to compare
* with other Firm_event time stamps.
*
* The pair field is critical for a state maintainence package
* (such as vuid_state.h), one that is designed to not know anything
* about the semantics of particular events, to maintain correct data
* for corresponding absolute, delta and paired state variables.
*
* pair, when defined (as indicated by pair_type), is the associated
* state variable that should be updated due to this events generation.
* This is used to maintain a correspondence between an event that is a
* delta and a state that is an absolute value (with a known delta event
* defined) and visa versa, e.g., LOC_X_DELTA & LOC_X_ABSOLUTE.
* pair is also used to indicate another state variable that
* should be updated with the occurrence of this event, e.g., if id is
* '^G' then pair could be 'g' or 'G' depending on the state of the shift
* key.
*/
typedef struct firm_event {
#define FE_PAIR_NONE 0 /* pair is not defined */
/* to this events value */
/* should be set to the delta of */
/* id's current value and the new */
/* value indicated by this event */
/* should be set to the sum of its */
/* current value and the delta */
/* indicated by this event's value */
/* offset within id's segment (minus id's */
/* address) */
int value; /* Event's value */
#else
#endif
} Firm_event;
#define FIRM_EVENT_NULL ((Firm_event *)0)
/*
* Ioctls to input devices that support vuid.
*/
/*
* VUID*FORMAT ioctls are used to control which byte stream format that
* a input device should use. An errno of ENOTTY or EINVAL indicates that
* a device can't speak Firm_events.
*/
#if defined(__i386) || defined(__i386_COMPAT)
#else
#endif
#define VUID_NATIVE 0 /* Native byte stream format */
/*
* VUID*ADDR ioctls are used to control which address a particular
* virtual input device segment has. This is used to have an instancing
* capability, e.g., a second mouse. An errno of ENOTTY indicates that
* a device can't deal with these commands. An errno of ENODEV indicates
* that the requested virtual device has no events generated for it by
* this physical device.
*
* VUIDSADDR sets the virtual input device segment address indicated by
* default to next.
*
* VUIDGADDR gets the in force address of the virtual input device segment
* indicated by default into current.
*/
typedef struct vuid_addr_probe {
short base; /* default vuid device addr directed too */
union {
short next; /* next addr for default when VUIDSADDR */
short current; /* current addr of default when VUIDGADDR */
} data;
#if defined(__i386) || defined(__i386_COMPAT)
#else
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_VUID_EVENT_H */