xref: /illumos-gate/usr/src/uts/common/sys/usb/clients/hid/hidvar.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_HIDVAR_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_USB_HIDVAR_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usbai_private.h>
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate /*
39*7c478bd9Sstevel@tonic-gate  * HID : This header file contains the internal structures
40*7c478bd9Sstevel@tonic-gate  * and variable definitions used in hid driver.
41*7c478bd9Sstevel@tonic-gate  */
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate /*
44*7c478bd9Sstevel@tonic-gate  * HID USB device state management :
45*7c478bd9Sstevel@tonic-gate  *
46*7c478bd9Sstevel@tonic-gate  *	ONLINE-----1--->SUSPENDED----2---->ONLINE
47*7c478bd9Sstevel@tonic-gate  *	  |
48*7c478bd9Sstevel@tonic-gate  *	  +-----3--->DISCONNECTED----4----->ONLINE
49*7c478bd9Sstevel@tonic-gate  *	  |
50*7c478bd9Sstevel@tonic-gate  *	  +-----7--->POWERED DOWN----8----->POWER CHANGE---9--->ONLINE
51*7c478bd9Sstevel@tonic-gate  *						|
52*7c478bd9Sstevel@tonic-gate  *						+---3--->DISCONNECTED
53*7c478bd9Sstevel@tonic-gate  *
54*7c478bd9Sstevel@tonic-gate  *	POWERED DOWN----1--->SUSPENDED------2----->POWERED DOWN
55*7c478bd9Sstevel@tonic-gate  *	  |		      |     ^
56*7c478bd9Sstevel@tonic-gate  *	  |		      5     |
57*7c478bd9Sstevel@tonic-gate  *	  |		      |     6
58*7c478bd9Sstevel@tonic-gate  *	  |		      v     |
59*7c478bd9Sstevel@tonic-gate  *	  +---------3----->DISCONNECTED-------4----->POWERED DOWN
60*7c478bd9Sstevel@tonic-gate  *
61*7c478bd9Sstevel@tonic-gate  *	1 = CPR SUSPEND
62*7c478bd9Sstevel@tonic-gate  *	2 = CPR RESUME (with original device)
63*7c478bd9Sstevel@tonic-gate  *	3 = Device Unplug
64*7c478bd9Sstevel@tonic-gate  *	4 = Original Device Plugged in
65*7c478bd9Sstevel@tonic-gate  *	5 = CPR RESUME (with device disconnected or with a wrong device)
66*7c478bd9Sstevel@tonic-gate  *	6 = CPR SUSPEND on a disconnected device
67*7c478bd9Sstevel@tonic-gate  *	7 = Device idles for time T & transitions to low power state
68*7c478bd9Sstevel@tonic-gate  *	8 = Remote wakeup by device OR Application kicking off IO to device
69*7c478bd9Sstevel@tonic-gate  *          This results in a Transistion state till PM calls the power
70*7c478bd9Sstevel@tonic-gate  *	    entry point to raise the power level of the device
71*7c478bd9Sstevel@tonic-gate  *	9 = Device entry point called to raise power level of the device
72*7c478bd9Sstevel@tonic-gate  *
73*7c478bd9Sstevel@tonic-gate  */
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate /* Boot protocol values for keyboard and mouse */
77*7c478bd9Sstevel@tonic-gate #define	KEYBOARD_PROTOCOL	0x01		/* legacy keyboard */
78*7c478bd9Sstevel@tonic-gate #define	MOUSE_PROTOCOL		0x02		/* legacy mouse */
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate /*
81*7c478bd9Sstevel@tonic-gate  * If the hid descriptor is not valid, the following values are
82*7c478bd9Sstevel@tonic-gate  * used.
83*7c478bd9Sstevel@tonic-gate  */
84*7c478bd9Sstevel@tonic-gate #define	USBKPSZ 		8	/* keyboard packet size */
85*7c478bd9Sstevel@tonic-gate #define	USBMSSZ 		3	/* mouse packet size */
86*7c478bd9Sstevel@tonic-gate #define	USB_KB_HID_DESCR_LENGTH 0x3f 	/* keyboard Report descr length */
87*7c478bd9Sstevel@tonic-gate #define	USB_MS_HID_DESCR_LENGTH 0x32 	/* mouse Report descr length */
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate /*
90*7c478bd9Sstevel@tonic-gate  * Flags for the default pipe.
91*7c478bd9Sstevel@tonic-gate  */
92*7c478bd9Sstevel@tonic-gate #define	HID_DEFAULT_PIPE_BUSY	0x01
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate /*
95*7c478bd9Sstevel@tonic-gate  * Hid interrupt pipe states. Interrupt pipe
96*7c478bd9Sstevel@tonic-gate  * can be in only one of these states :
97*7c478bd9Sstevel@tonic-gate  *
98*7c478bd9Sstevel@tonic-gate  *	open--1-->data_transferring--1-->open
99*7c478bd9Sstevel@tonic-gate  *	 |
100*7c478bd9Sstevel@tonic-gate  *	 |----2---->closed
101*7c478bd9Sstevel@tonic-gate  *
102*7c478bd9Sstevel@tonic-gate  *	1 = interrupt pipe callback
103*7c478bd9Sstevel@tonic-gate  *	2 = hid_close
104*7c478bd9Sstevel@tonic-gate  */
105*7c478bd9Sstevel@tonic-gate #define	HID_INTERRUPT_PIPE_CLOSED 0x00 /* Int. pipe is closed */
106*7c478bd9Sstevel@tonic-gate #define	HID_INTERRUPT_PIPE_OPEN	0x01 /* Int. pipe is opened */
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate /* HID mctl processing return codes */
109*7c478bd9Sstevel@tonic-gate #define	HID_SUCCESS	0	/* mctl processed successfully */
110*7c478bd9Sstevel@tonic-gate #define	HID_INPROGRESS	1	/* mctl queued/deferred for execution */
111*7c478bd9Sstevel@tonic-gate #define	HID_ENQUEUE	2	/* mctl queued/deferred for execution */
112*7c478bd9Sstevel@tonic-gate #define	HID_FAILURE	-1	/* mctl processing failed */
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate /* Data is being sent up */
115*7c478bd9Sstevel@tonic-gate #define	HID_INTERRUPT_PIPE_DATA_TRANSFERRING	0x03
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate /* Attach/detach states */
118*7c478bd9Sstevel@tonic-gate #define	HID_LOCK_INIT		0x01	/* Initial attach state */
119*7c478bd9Sstevel@tonic-gate #define	HID_MINOR_NODES		0x02 	/* Set after minor node is created */
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate /* HID Protocol Requests */
122*7c478bd9Sstevel@tonic-gate #define	SET_IDLE 		0x0a 	/* bRequest value to set idle request */
123*7c478bd9Sstevel@tonic-gate #define	DURATION 		(0<<8) 	/* no. of repeat reports (HID 7.2.4) */
124*7c478bd9Sstevel@tonic-gate #define	SET_PROTOCOL 		0x0b 	/* bRequest value for boot protocol */
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate /* Hid PM scheme */
127*7c478bd9Sstevel@tonic-gate typedef enum {
128*7c478bd9Sstevel@tonic-gate 	HID_PM_ACTIVITY,	/* device is power managed by idleness */
129*7c478bd9Sstevel@tonic-gate 	HID_PM_OPEN_CLOSE,	/* device is busy on open, idle on close */
130*7c478bd9Sstevel@tonic-gate 	HID_PM_APPLICATION	/* device is power managed by application */
131*7c478bd9Sstevel@tonic-gate } hid_pm_scheme_t;
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate typedef struct hid_power {
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate 	void			*hid_state;	/* points back to hid_state */
136*7c478bd9Sstevel@tonic-gate 
137*7c478bd9Sstevel@tonic-gate 	int			hid_pm_busy;	/* device busy accounting */
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate 	hid_pm_scheme_t		hid_pm_strategy;	/* device PM */
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate 	uint8_t			hid_wakeup_enabled;
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate 	/* this is the bit mask of the power states that device has */
144*7c478bd9Sstevel@tonic-gate 	uint8_t			hid_pwr_states;
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate 	/* wakeup and power transistion capabilites of an interface */
147*7c478bd9Sstevel@tonic-gate 	uint8_t			hid_pm_capabilities;
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate 	/* flag to indicate if driver is about to raise power level */
150*7c478bd9Sstevel@tonic-gate 	boolean_t		hid_raise_power;
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate 	/* current power level the device is in */
153*7c478bd9Sstevel@tonic-gate 	uint8_t			hid_current_power;
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate 	/* mblk indicating that the device has powered up */
156*7c478bd9Sstevel@tonic-gate 	mblk_t			*hid_pm_pwrup;
157*7c478bd9Sstevel@tonic-gate } hid_power_t;
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_power_t::hid_state))
160*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_power_t::hid_pm_strategy))
161*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_power_t::hid_wakeup_enabled))
162*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_power_t::hid_pwr_states))
163*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_power_t::hid_pm_capabilities))
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate typedef struct hid_state {
166*7c478bd9Sstevel@tonic-gate 	dev_info_t		*hid_dip;	/* per-device info handle */
167*7c478bd9Sstevel@tonic-gate 	kmutex_t		hid_mutex;	/* for general locking */
168*7c478bd9Sstevel@tonic-gate 	int			hid_instance;	/* instance number */
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate 	minor_t			hid_minor;
171*7c478bd9Sstevel@tonic-gate 	boolean_t		hid_km;		/* for virtual keyboard/mouse */
172*7c478bd9Sstevel@tonic-gate 
173*7c478bd9Sstevel@tonic-gate 	/* Attach/detach flags */
174*7c478bd9Sstevel@tonic-gate 	int			hid_attach_flags;
175*7c478bd9Sstevel@tonic-gate 
176*7c478bd9Sstevel@tonic-gate 	/* device state flag */
177*7c478bd9Sstevel@tonic-gate 	int			hid_dev_state;
178*7c478bd9Sstevel@tonic-gate 
179*7c478bd9Sstevel@tonic-gate 	/* outstanding requests on the default pipe */
180*7c478bd9Sstevel@tonic-gate 	int			hid_default_pipe_req;
181*7c478bd9Sstevel@tonic-gate 
182*7c478bd9Sstevel@tonic-gate 	queue_t			*hid_rq_ptr;	/* pointer to read queue */
183*7c478bd9Sstevel@tonic-gate 	queue_t			*hid_wq_ptr;	/* pointer to write queue */
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate 	hid_power_t		*hid_pm;	/* ptr to power struct */
186*7c478bd9Sstevel@tonic-gate 
187*7c478bd9Sstevel@tonic-gate 	usb_client_dev_data_t	*hid_dev_data;	/* ptr to usb reg struct */
188*7c478bd9Sstevel@tonic-gate 
189*7c478bd9Sstevel@tonic-gate 	usb_dev_descr_t		*hid_dev_descr;	/* device descriptor. */
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate 	/* hid driver is attached to this interface */
192*7c478bd9Sstevel@tonic-gate 	int			hid_interfaceno;
193*7c478bd9Sstevel@tonic-gate 
194*7c478bd9Sstevel@tonic-gate 	usb_if_descr_t		hid_if_descr;		/* interface descr */
195*7c478bd9Sstevel@tonic-gate 	usb_hid_descr_t		hid_hid_descr;		/* hid descriptor */
196*7c478bd9Sstevel@tonic-gate 	usb_ep_descr_t		hid_ep_intr_descr;
197*7c478bd9Sstevel@tonic-gate 	hidparser_handle_t	hid_report_descr;	/* report descr */
198*7c478bd9Sstevel@tonic-gate 
199*7c478bd9Sstevel@tonic-gate 	usb_pipe_handle_t	hid_default_pipe;	/* default pipe */
200*7c478bd9Sstevel@tonic-gate 	usb_pipe_handle_t	hid_interrupt_pipe;	/* intr pipe handle */
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate 	int			hid_streams_flags;	/* see below */
203*7c478bd9Sstevel@tonic-gate 	int			hid_packet_size;	/* data packet size */
204*7c478bd9Sstevel@tonic-gate 
205*7c478bd9Sstevel@tonic-gate 	/* Pipe policy for the interrupt pipe is saved here */
206*7c478bd9Sstevel@tonic-gate 	usb_pipe_policy_t	hid_intr_pipe_policy;
207*7c478bd9Sstevel@tonic-gate 
208*7c478bd9Sstevel@tonic-gate 	/*
209*7c478bd9Sstevel@tonic-gate 	 * This field is only used if the device provides polled input
210*7c478bd9Sstevel@tonic-gate 	 * This is state information for the usba layer.
211*7c478bd9Sstevel@tonic-gate 	 */
212*7c478bd9Sstevel@tonic-gate 	usb_console_info_t	hid_polled_console_info;
213*7c478bd9Sstevel@tonic-gate 
214*7c478bd9Sstevel@tonic-gate 	/*
215*7c478bd9Sstevel@tonic-gate 	 * This is the buffer that the raw characters are stored in.
216*7c478bd9Sstevel@tonic-gate 	 * for polled mode.
217*7c478bd9Sstevel@tonic-gate 	 */
218*7c478bd9Sstevel@tonic-gate 	uchar_t			*hid_polled_raw_buf;
219*7c478bd9Sstevel@tonic-gate 
220*7c478bd9Sstevel@tonic-gate 	/* handle for outputting messages */
221*7c478bd9Sstevel@tonic-gate 	usb_log_handle_t	hid_log_handle;
222*7c478bd9Sstevel@tonic-gate } hid_state_t;
223*7c478bd9Sstevel@tonic-gate 
224*7c478bd9Sstevel@tonic-gate /* warlock directives, stable data */
225*7c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(hid_state_t::hid_mutex, hid_state_t))
226*7c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(hid_state_t::hid_mutex, hid_power_t))
227*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_dip))
228*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_pm))
229*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_dev_data))
230*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_instance))
231*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_km))
232*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_minor))
233*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_interrupt_pipe))
234*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_ep_intr_descr))
235*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_default_pipe))
236*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_log_handle))
237*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_if_descr))
238*7c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_dev_data))
239*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", hid_state_t::hid_rq_ptr))
240*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", hid_state_t::hid_wq_ptr))
241*7c478bd9Sstevel@tonic-gate 
242*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", usb_ep_descr))
243*7c478bd9Sstevel@tonic-gate 
244*7c478bd9Sstevel@tonic-gate 
245*7c478bd9Sstevel@tonic-gate /*
246*7c478bd9Sstevel@tonic-gate  * The hid_polled_console_info field is a handle from usba.  The
247*7c478bd9Sstevel@tonic-gate  * handle is used when the kernel is in the single thread mode
248*7c478bd9Sstevel@tonic-gate  * so the field is tagged with this note.
249*7c478bd9Sstevel@tonic-gate  */
250*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unique per call",
251*7c478bd9Sstevel@tonic-gate 				hid_state_t::hid_polled_console_info))
252*7c478bd9Sstevel@tonic-gate 
253*7c478bd9Sstevel@tonic-gate /*
254*7c478bd9Sstevel@tonic-gate  * structure for argument for callback routine for async
255*7c478bd9Sstevel@tonic-gate  * data transfer through default pipe.
256*7c478bd9Sstevel@tonic-gate  */
257*7c478bd9Sstevel@tonic-gate typedef struct hid_default_pipe_argument {
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate 	/* Message to be sent up to the stream */
260*7c478bd9Sstevel@tonic-gate 	struct iocblk	hid_default_pipe_arg_mctlmsg;
261*7c478bd9Sstevel@tonic-gate 
262*7c478bd9Sstevel@tonic-gate 	/* Pointer to hid_state structure */
263*7c478bd9Sstevel@tonic-gate 	hid_state_t	*hid_default_pipe_arg_hidp;
264*7c478bd9Sstevel@tonic-gate 
265*7c478bd9Sstevel@tonic-gate 	/* Pointer to the original mblk_t received from hid_wput() */
266*7c478bd9Sstevel@tonic-gate 	mblk_t		*hid_default_pipe_arg_mblk;
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate 	/* Request that caused this callback to happen */
269*7c478bd9Sstevel@tonic-gate 	uchar_t		hid_default_pipe_arg_bRequest;
270*7c478bd9Sstevel@tonic-gate 
271*7c478bd9Sstevel@tonic-gate } hid_default_pipe_arg_t;
272*7c478bd9Sstevel@tonic-gate 
273*7c478bd9Sstevel@tonic-gate /*
274*7c478bd9Sstevel@tonic-gate  * An instance of this structure is created per command down to the
275*7c478bd9Sstevel@tonic-gate  * device.  The control callback is not executed until the call is
276*7c478bd9Sstevel@tonic-gate  * made into usba, so there is no danger of a callback happening when
277*7c478bd9Sstevel@tonic-gate  * the fields of the structure are being set.
278*7c478bd9Sstevel@tonic-gate  */
279*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unique per call", hid_default_pipe_arg_t))
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate /*
282*7c478bd9Sstevel@tonic-gate  * An instance of this structure is created per command down to the
283*7c478bd9Sstevel@tonic-gate  * device.  The callback is not executed until the call is
284*7c478bd9Sstevel@tonic-gate  * made into usba, so there is no danger of a callback happening when
285*7c478bd9Sstevel@tonic-gate  * the fields of the structure are being set.
286*7c478bd9Sstevel@tonic-gate  */
287*7c478bd9Sstevel@tonic-gate 
288*7c478bd9Sstevel@tonic-gate /* Value for hid_streams_flags */
289*7c478bd9Sstevel@tonic-gate #define	HID_STREAMS_OPEN	0x00000001	/* Streams are open */
290*7c478bd9Sstevel@tonic-gate #define	HID_STREAMS_DISMANTLING	0x00000002	/* In hid_close() */
291*7c478bd9Sstevel@tonic-gate 
292*7c478bd9Sstevel@tonic-gate #define	HID_BAD_DESCR		0x01		/* Bad hid report descriptor */
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate #define	HID_MINOR_NAME_LEN	20	/* Max length of minor_name string */
295*7c478bd9Sstevel@tonic-gate 
296*7c478bd9Sstevel@tonic-gate /* hid_close will wait 60 secons for callbacks to be over */
297*7c478bd9Sstevel@tonic-gate #define	HID_CLOSE_WAIT_TIMEOUT	10
298*7c478bd9Sstevel@tonic-gate 
299*7c478bd9Sstevel@tonic-gate /* define a timeout for draining requests on the default control pipe */
300*7c478bd9Sstevel@tonic-gate #define	HID_DEFAULT_PIPE_DRAIN_TIMEOUT	5
301*7c478bd9Sstevel@tonic-gate 
302*7c478bd9Sstevel@tonic-gate /* To support PM on SUN mice of later revisions */
303*7c478bd9Sstevel@tonic-gate #define	HID_SUN_MOUSE_VENDOR_ID	0x0430
304*7c478bd9Sstevel@tonic-gate #define	HID_SUN_MOUSE_PROD_ID	0x0100
305*7c478bd9Sstevel@tonic-gate #define	HID_SUN_MOUSE_BCDDEVICE	0x0105	/* and later revisions */
306*7c478bd9Sstevel@tonic-gate 
307*7c478bd9Sstevel@tonic-gate 
308*7c478bd9Sstevel@tonic-gate /*
309*7c478bd9Sstevel@tonic-gate  * Debug message Masks
310*7c478bd9Sstevel@tonic-gate  */
311*7c478bd9Sstevel@tonic-gate #define	PRINT_MASK_ATTA		0x00000001
312*7c478bd9Sstevel@tonic-gate #define	PRINT_MASK_OPEN 	0x00000002
313*7c478bd9Sstevel@tonic-gate #define	PRINT_MASK_CLOSE	0x00000004
314*7c478bd9Sstevel@tonic-gate #define	PRINT_MASK_EVENTS	0x00000008
315*7c478bd9Sstevel@tonic-gate #define	PRINT_MASK_PM		0x00000010
316*7c478bd9Sstevel@tonic-gate #define	PRINT_MASK_ALL		0xFFFFFFFF
317*7c478bd9Sstevel@tonic-gate 
318*7c478bd9Sstevel@tonic-gate /*
319*7c478bd9Sstevel@tonic-gate  * Define states local to hid driver
320*7c478bd9Sstevel@tonic-gate  */
321*7c478bd9Sstevel@tonic-gate #define	USB_DEV_HID_POWER_CHANGE 0x80
322*7c478bd9Sstevel@tonic-gate 
323*7c478bd9Sstevel@tonic-gate /* define for retrying control requests */
324*7c478bd9Sstevel@tonic-gate #define	HID_RETRY	10
325*7c478bd9Sstevel@tonic-gate 
326*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
327*7c478bd9Sstevel@tonic-gate }
328*7c478bd9Sstevel@tonic-gate #endif
329*7c478bd9Sstevel@tonic-gate 
330*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_USB_HIDVAR_H */
331