/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_USB_HIDVAR_H
#define _SYS_USB_HIDVAR_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* HID : This header file contains the internal structures
* and variable definitions used in hid driver.
*/
/*
* HID USB device state management :
*
* ONLINE-----1--->SUSPENDED----2---->ONLINE
* |
* +-----3--->DISCONNECTED----4----->ONLINE
* |
* +-----7--->POWERED DOWN----8----->POWER CHANGE---9--->ONLINE
* |
* +---3--->DISCONNECTED
*
* POWERED DOWN----1--->SUSPENDED------2----->POWERED DOWN
* | | ^
* | 5 |
* | | 6
* | v |
* +---------3----->DISCONNECTED-------4----->POWERED DOWN
*
* 1 = CPR SUSPEND
* 2 = CPR RESUME (with original device)
* 3 = Device Unplug
* 4 = Original Device Plugged in
* 5 = CPR RESUME (with device disconnected or with a wrong device)
* 6 = CPR SUSPEND on a disconnected device
* 7 = Device idles for time T & transitions to low power state
* 8 = Remote wakeup by device OR Application kicking off IO to device
* This results in a Transistion state till PM calls the power
* entry point to raise the power level of the device
* 9 = Device entry point called to raise power level of the device
*
*/
/* Boot Interface Subclass for HID devices */
/* Boot protocol values for keyboard and mouse */
#define NONE_PROTOCOL 0
/*
* If the hid descriptor is not valid, the following values are
* used.
*/
/*
* Flags for the default pipe.
*/
/*
* Hid interrupt pipe states. Interrupt pipe
* can be in only one of these states :
*
* open--1-->data_transferring--1-->open
* |
* |----2---->closed
*
* 1 = interrupt pipe callback
* 2 = hid_close
*/
/* HID mctl processing return codes */
/* Data is being sent up */
/* HID Protocol Requests */
/* Hid PM scheme */
typedef enum {
typedef struct hid_power {
/* this is the bit mask of the power states that device has */
/* wakeup and power transistion capabilites of an interface */
/* flag to indicate if driver is about to raise power level */
/* current power level the device is in */
/* mblk indicating that the device has powered up */
} hid_power_t;
typedef struct hid_state {
int hid_attach_flags;
/* device state flag */
int hid_dev_state;
/* outstanding requests on the default pipe */
int hid_default_pipe_req;
/* hid driver is attached to this interface */
int hid_interfaceno;
/* Pipe policy for the interrupt pipe is saved here */
/*
* This field is only used if the device provides polled input
* This is state information for the usba layer.
*/
/*
* This is the buffer that the raw characters are stored in.
* for polled mode.
*/
/* handle for outputting messages */
/* which one of the above 2 streams gets the input */
} hid_state_t;
/* warlock directives, stable data */
/*
* The hid_polled_console_info field is a handle from usba. The
* handle is used when the kernel is in the single thread mode
* so the field is tagged with this note.
*/
/*
* structure for argument for callback routine for async
* data transfer through default pipe.
*/
typedef struct hid_default_pipe_argument {
/* Pointer to the write queue from which the message comes from */
/* Message to be sent up to the stream */
/* Pointer to the original mblk_t received from hid_wput() */
/* Request that caused this callback to happen */
/*
* An instance of this structure is created per command down to the
* device. The control callback is not executed until the call is
* made into usba, so there is no danger of a callback happening when
* the fields of the structure are being set.
*/
/*
* An instance of this structure is created per command down to the
* device. The callback is not executed until the call is
* made into usba, so there is no danger of a callback happening when
* the fields of the structure are being set.
*/
/* Value for hid_[internal|external]_flag */
/* hid_close will wait 60 secons for callbacks to be over */
/* define a timeout for draining requests on the default control pipe */
/* To support PM on SUN mice of later revisions */
/*
* Debug message Masks
*/
/*
* Define states local to hid driver
*/
/* define for retrying control requests */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_USB_HIDVAR_H */