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 5f3b88bd2Scg * Common Development and Distribution License (the "License"). 6f3b88bd2Scg * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21f3b88bd2Scg 227c478bd9Sstevel@tonic-gate /* 23ac9468f8Spengcheng chen - Sun Microsystems - Beijing China * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24*cfe80fe3SAlex Wilson * Copyright 2017 Joyent, Inc. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_USB_HIDVAR_H 287c478bd9Sstevel@tonic-gate #define _SYS_USB_HIDVAR_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/usb/usba/usbai_private.h> 36*cfe80fe3SAlex Wilson #include <sys/usb/usba/usba_ugen.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* 397c478bd9Sstevel@tonic-gate * HID : This header file contains the internal structures 407c478bd9Sstevel@tonic-gate * and variable definitions used in hid driver. 417c478bd9Sstevel@tonic-gate */ 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate /* 447c478bd9Sstevel@tonic-gate * HID USB device state management : 457c478bd9Sstevel@tonic-gate * 467c478bd9Sstevel@tonic-gate * ONLINE-----1--->SUSPENDED----2---->ONLINE 477c478bd9Sstevel@tonic-gate * | 487c478bd9Sstevel@tonic-gate * +-----3--->DISCONNECTED----4----->ONLINE 497c478bd9Sstevel@tonic-gate * | 507c478bd9Sstevel@tonic-gate * +-----7--->POWERED DOWN----8----->POWER CHANGE---9--->ONLINE 517c478bd9Sstevel@tonic-gate * | 527c478bd9Sstevel@tonic-gate * +---3--->DISCONNECTED 537c478bd9Sstevel@tonic-gate * 547c478bd9Sstevel@tonic-gate * POWERED DOWN----1--->SUSPENDED------2----->POWERED DOWN 557c478bd9Sstevel@tonic-gate * | | ^ 567c478bd9Sstevel@tonic-gate * | 5 | 577c478bd9Sstevel@tonic-gate * | | 6 587c478bd9Sstevel@tonic-gate * | v | 597c478bd9Sstevel@tonic-gate * +---------3----->DISCONNECTED-------4----->POWERED DOWN 607c478bd9Sstevel@tonic-gate * 617c478bd9Sstevel@tonic-gate * 1 = CPR SUSPEND 627c478bd9Sstevel@tonic-gate * 2 = CPR RESUME (with original device) 637c478bd9Sstevel@tonic-gate * 3 = Device Unplug 647c478bd9Sstevel@tonic-gate * 4 = Original Device Plugged in 657c478bd9Sstevel@tonic-gate * 5 = CPR RESUME (with device disconnected or with a wrong device) 667c478bd9Sstevel@tonic-gate * 6 = CPR SUSPEND on a disconnected device 677c478bd9Sstevel@tonic-gate * 7 = Device idles for time T & transitions to low power state 687c478bd9Sstevel@tonic-gate * 8 = Remote wakeup by device OR Application kicking off IO to device 697c478bd9Sstevel@tonic-gate * This results in a Transistion state till PM calls the power 707c478bd9Sstevel@tonic-gate * entry point to raise the power level of the device 717c478bd9Sstevel@tonic-gate * 9 = Device entry point called to raise power level of the device 727c478bd9Sstevel@tonic-gate * 737c478bd9Sstevel@tonic-gate */ 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate 760fc2d926Sqz /* Boot Interface Subclass for HID devices */ 770fc2d926Sqz #define BOOT_INTERFACE 0x01 780fc2d926Sqz 797c478bd9Sstevel@tonic-gate /* Boot protocol values for keyboard and mouse */ 807c478bd9Sstevel@tonic-gate #define KEYBOARD_PROTOCOL 0x01 /* legacy keyboard */ 817c478bd9Sstevel@tonic-gate #define MOUSE_PROTOCOL 0x02 /* legacy mouse */ 820fc2d926Sqz #define NONE_PROTOCOL 0 837c478bd9Sstevel@tonic-gate /* 847c478bd9Sstevel@tonic-gate * If the hid descriptor is not valid, the following values are 857c478bd9Sstevel@tonic-gate * used. 867c478bd9Sstevel@tonic-gate */ 87*cfe80fe3SAlex Wilson #define USBKPSZ 8 /* keyboard packet size */ 88*cfe80fe3SAlex Wilson #define USBMSSZ 3 /* mouse packet size */ 89*cfe80fe3SAlex Wilson #define USB_KB_HID_DESCR_LENGTH 0x3f /* keyboard Report descr length */ 90*cfe80fe3SAlex Wilson #define USB_MS_HID_DESCR_LENGTH 0x32 /* mouse Report descr length */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate /* 937c478bd9Sstevel@tonic-gate * Flags for the default pipe. 947c478bd9Sstevel@tonic-gate */ 957c478bd9Sstevel@tonic-gate #define HID_DEFAULT_PIPE_BUSY 0x01 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* 987c478bd9Sstevel@tonic-gate * Hid interrupt pipe states. Interrupt pipe 997c478bd9Sstevel@tonic-gate * can be in only one of these states : 1007c478bd9Sstevel@tonic-gate * 1017c478bd9Sstevel@tonic-gate * open--1-->data_transferring--1-->open 1027c478bd9Sstevel@tonic-gate * | 1037c478bd9Sstevel@tonic-gate * |----2---->closed 1047c478bd9Sstevel@tonic-gate * 1057c478bd9Sstevel@tonic-gate * 1 = interrupt pipe callback 1067c478bd9Sstevel@tonic-gate * 2 = hid_close 1077c478bd9Sstevel@tonic-gate */ 1087c478bd9Sstevel@tonic-gate #define HID_INTERRUPT_PIPE_CLOSED 0x00 /* Int. pipe is closed */ 1097c478bd9Sstevel@tonic-gate #define HID_INTERRUPT_PIPE_OPEN 0x01 /* Int. pipe is opened */ 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate /* HID mctl processing return codes */ 1127c478bd9Sstevel@tonic-gate #define HID_SUCCESS 0 /* mctl processed successfully */ 1137c478bd9Sstevel@tonic-gate #define HID_INPROGRESS 1 /* mctl queued/deferred for execution */ 1147c478bd9Sstevel@tonic-gate #define HID_ENQUEUE 2 /* mctl queued/deferred for execution */ 1157c478bd9Sstevel@tonic-gate #define HID_FAILURE -1 /* mctl processing failed */ 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate /* Data is being sent up */ 1187c478bd9Sstevel@tonic-gate #define HID_INTERRUPT_PIPE_DATA_TRANSFERRING 0x03 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate /* Attach/detach states */ 1217c478bd9Sstevel@tonic-gate #define HID_LOCK_INIT 0x01 /* Initial attach state */ 122*cfe80fe3SAlex Wilson #define HID_MINOR_NODES 0x02 /* Set after minor node is created */ 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate /* HID Protocol Requests */ 125*cfe80fe3SAlex Wilson #define SET_IDLE 0x0a /* bRequest value to set idle request */ 126*cfe80fe3SAlex Wilson #define DURATION (0<<8) /* no. of repeat reports (HID 7.2.4) */ 127*cfe80fe3SAlex Wilson #define SET_PROTOCOL 0x0b /* bRequest value for boot protocol */ 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate /* Hid PM scheme */ 1307c478bd9Sstevel@tonic-gate typedef enum { 1317c478bd9Sstevel@tonic-gate HID_PM_ACTIVITY, /* device is power managed by idleness */ 1327c478bd9Sstevel@tonic-gate HID_PM_OPEN_CLOSE, /* device is busy on open, idle on close */ 1337c478bd9Sstevel@tonic-gate HID_PM_APPLICATION /* device is power managed by application */ 1347c478bd9Sstevel@tonic-gate } hid_pm_scheme_t; 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate typedef struct hid_power { 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate void *hid_state; /* points back to hid_state */ 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate int hid_pm_busy; /* device busy accounting */ 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate hid_pm_scheme_t hid_pm_strategy; /* device PM */ 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate uint8_t hid_wakeup_enabled; 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate /* this is the bit mask of the power states that device has */ 1477c478bd9Sstevel@tonic-gate uint8_t hid_pwr_states; 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate /* wakeup and power transistion capabilites of an interface */ 1507c478bd9Sstevel@tonic-gate uint8_t hid_pm_capabilities; 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate /* flag to indicate if driver is about to raise power level */ 1537c478bd9Sstevel@tonic-gate boolean_t hid_raise_power; 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate /* current power level the device is in */ 1567c478bd9Sstevel@tonic-gate uint8_t hid_current_power; 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate /* mblk indicating that the device has powered up */ 1597c478bd9Sstevel@tonic-gate mblk_t *hid_pm_pwrup; 1607c478bd9Sstevel@tonic-gate } hid_power_t; 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_power_t::hid_state)) 1637c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_power_t::hid_pm_strategy)) 1647c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_power_t::hid_wakeup_enabled)) 1657c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_power_t::hid_pwr_states)) 1667c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_power_t::hid_pm_capabilities)) 1677c478bd9Sstevel@tonic-gate 168ac9468f8Spengcheng chen - Sun Microsystems - Beijing China 1697c478bd9Sstevel@tonic-gate typedef struct hid_state { 1707c478bd9Sstevel@tonic-gate dev_info_t *hid_dip; /* per-device info handle */ 1717c478bd9Sstevel@tonic-gate kmutex_t hid_mutex; /* for general locking */ 1727c478bd9Sstevel@tonic-gate int hid_instance; /* instance number */ 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate /* Attach/detach flags */ 1757c478bd9Sstevel@tonic-gate int hid_attach_flags; 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate /* device state flag */ 1787c478bd9Sstevel@tonic-gate int hid_dev_state; 1797c478bd9Sstevel@tonic-gate 1807c478bd9Sstevel@tonic-gate /* outstanding requests on the default pipe */ 1817c478bd9Sstevel@tonic-gate int hid_default_pipe_req; 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate hid_power_t *hid_pm; /* ptr to power struct */ 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate usb_client_dev_data_t *hid_dev_data; /* ptr to usb reg struct */ 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate usb_dev_descr_t *hid_dev_descr; /* device descriptor. */ 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate /* hid driver is attached to this interface */ 1907c478bd9Sstevel@tonic-gate int hid_interfaceno; 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate usb_if_descr_t hid_if_descr; /* interface descr */ 1937c478bd9Sstevel@tonic-gate usb_hid_descr_t hid_hid_descr; /* hid descriptor */ 194993e3fafSRobert Mustacchi usb_ep_xdescr_t hid_ep_intr_xdescr; /* ep extended desc */ 1957c478bd9Sstevel@tonic-gate hidparser_handle_t hid_report_descr; /* report descr */ 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate usb_pipe_handle_t hid_default_pipe; /* default pipe */ 1987c478bd9Sstevel@tonic-gate usb_pipe_handle_t hid_interrupt_pipe; /* intr pipe handle */ 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate int hid_packet_size; /* data packet size */ 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate /* Pipe policy for the interrupt pipe is saved here */ 2037c478bd9Sstevel@tonic-gate usb_pipe_policy_t hid_intr_pipe_policy; 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate /* 2067c478bd9Sstevel@tonic-gate * This field is only used if the device provides polled input 2077c478bd9Sstevel@tonic-gate * This is state information for the usba layer. 2087c478bd9Sstevel@tonic-gate */ 2097c478bd9Sstevel@tonic-gate usb_console_info_t hid_polled_console_info; 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate /* 2127c478bd9Sstevel@tonic-gate * This is the buffer that the raw characters are stored in. 2137c478bd9Sstevel@tonic-gate * for polled mode. 2147c478bd9Sstevel@tonic-gate */ 2157c478bd9Sstevel@tonic-gate uchar_t *hid_polled_raw_buf; 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate /* handle for outputting messages */ 2187c478bd9Sstevel@tonic-gate usb_log_handle_t hid_log_handle; 219ac9468f8Spengcheng chen - Sun Microsystems - Beijing China 220ddee57faSrui zang - Sun Microsystems - Beijing China queue_t *hid_internal_rq; 221ddee57faSrui zang - Sun Microsystems - Beijing China queue_t *hid_external_rq; 222ddee57faSrui zang - Sun Microsystems - Beijing China /* which one of the above 2 streams gets the input */ 223ddee57faSrui zang - Sun Microsystems - Beijing China queue_t *hid_inuse_rq; 224ddee57faSrui zang - Sun Microsystems - Beijing China int hid_internal_flag; /* see below */ 225ddee57faSrui zang - Sun Microsystems - Beijing China int hid_external_flag; /* see below */ 226*cfe80fe3SAlex Wilson 227*cfe80fe3SAlex Wilson usb_ugen_hdl_t hid_ugen_hdl; /* ugen support */ 2287c478bd9Sstevel@tonic-gate } hid_state_t; 2297c478bd9Sstevel@tonic-gate 2307c478bd9Sstevel@tonic-gate /* warlock directives, stable data */ 2317c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(hid_state_t::hid_mutex, hid_state_t)) 2327c478bd9Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(hid_state_t::hid_mutex, hid_power_t)) 2337c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_dip)) 2347c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_pm)) 2357c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_dev_data)) 2367c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_instance)) 2377c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_interrupt_pipe)) 2387c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_ep_intr_descr)) 2397c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_default_pipe)) 2407c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_log_handle)) 2417c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_if_descr)) 2427c478bd9Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_dev_data)) 243d291d9f2Sfrits _NOTE(DATA_READABLE_WITHOUT_LOCK(hid_state_t::hid_dev_descr)) 2447c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", usb_ep_descr)) 2457c478bd9Sstevel@tonic-gate 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate /* 2487c478bd9Sstevel@tonic-gate * The hid_polled_console_info field is a handle from usba. The 2497c478bd9Sstevel@tonic-gate * handle is used when the kernel is in the single thread mode 2507c478bd9Sstevel@tonic-gate * so the field is tagged with this note. 2517c478bd9Sstevel@tonic-gate */ 252*cfe80fe3SAlex Wilson _NOTE(SCHEME_PROTECTS_DATA("unique per call", 2537c478bd9Sstevel@tonic-gate hid_state_t::hid_polled_console_info)) 2547c478bd9Sstevel@tonic-gate 2557c478bd9Sstevel@tonic-gate /* 2567c478bd9Sstevel@tonic-gate * structure for argument for callback routine for async 2577c478bd9Sstevel@tonic-gate * data transfer through default pipe. 2587c478bd9Sstevel@tonic-gate */ 2597c478bd9Sstevel@tonic-gate typedef struct hid_default_pipe_argument { 260ac9468f8Spengcheng chen - Sun Microsystems - Beijing China /* Pointer to the write queue from which the message comes from */ 261ac9468f8Spengcheng chen - Sun Microsystems - Beijing China queue_t *hid_default_pipe_arg_queue; 2627c478bd9Sstevel@tonic-gate 2637c478bd9Sstevel@tonic-gate /* Message to be sent up to the stream */ 2647c478bd9Sstevel@tonic-gate struct iocblk hid_default_pipe_arg_mctlmsg; 2657c478bd9Sstevel@tonic-gate 2667c478bd9Sstevel@tonic-gate /* Pointer to the original mblk_t received from hid_wput() */ 2677c478bd9Sstevel@tonic-gate mblk_t *hid_default_pipe_arg_mblk; 2687c478bd9Sstevel@tonic-gate 2697c478bd9Sstevel@tonic-gate /* Request that caused this callback to happen */ 2707c478bd9Sstevel@tonic-gate uchar_t hid_default_pipe_arg_bRequest; 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gate } hid_default_pipe_arg_t; 2737c478bd9Sstevel@tonic-gate 2747c478bd9Sstevel@tonic-gate /* 2757c478bd9Sstevel@tonic-gate * An instance of this structure is created per command down to the 2767c478bd9Sstevel@tonic-gate * device. The control callback is not executed until the call is 2777c478bd9Sstevel@tonic-gate * made into usba, so there is no danger of a callback happening when 2787c478bd9Sstevel@tonic-gate * the fields of the structure are being set. 2797c478bd9Sstevel@tonic-gate */ 2807c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unique per call", hid_default_pipe_arg_t)) 2817c478bd9Sstevel@tonic-gate 2827c478bd9Sstevel@tonic-gate /* 2837c478bd9Sstevel@tonic-gate * An instance of this structure is created per command down to the 2847c478bd9Sstevel@tonic-gate * device. The callback is not executed until the call is 2857c478bd9Sstevel@tonic-gate * made into usba, so there is no danger of a callback happening when 2867c478bd9Sstevel@tonic-gate * the fields of the structure are being set. 2877c478bd9Sstevel@tonic-gate */ 2887c478bd9Sstevel@tonic-gate 289ddee57faSrui zang - Sun Microsystems - Beijing China /* Value for hid_[internal|external]_flag */ 2907c478bd9Sstevel@tonic-gate #define HID_STREAMS_OPEN 0x00000001 /* Streams are open */ 2917c478bd9Sstevel@tonic-gate #define HID_STREAMS_DISMANTLING 0x00000002 /* In hid_close() */ 2927c478bd9Sstevel@tonic-gate 293ddee57faSrui zang - Sun Microsystems - Beijing China #define HID_STREAMS_FLAG(q, hidp) ((q) == (hidp)->hid_internal_rq ? \ 294ddee57faSrui zang - Sun Microsystems - Beijing China (hidp)->hid_internal_flag : (hidp)->hid_external_flag) 295ddee57faSrui zang - Sun Microsystems - Beijing China 296ddee57faSrui zang - Sun Microsystems - Beijing China #define HID_IS_OPEN(hidp) (((hidp)->hid_internal_flag == \ 297ddee57faSrui zang - Sun Microsystems - Beijing China HID_STREAMS_OPEN) || ((hidp)->hid_external_flag == HID_STREAMS_OPEN)) 298ddee57faSrui zang - Sun Microsystems - Beijing China 2997c478bd9Sstevel@tonic-gate #define HID_BAD_DESCR 0x01 /* Bad hid report descriptor */ 3007c478bd9Sstevel@tonic-gate 3017c478bd9Sstevel@tonic-gate #define HID_MINOR_NAME_LEN 20 /* Max length of minor_name string */ 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate /* hid_close will wait 60 secons for callbacks to be over */ 3047c478bd9Sstevel@tonic-gate #define HID_CLOSE_WAIT_TIMEOUT 10 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gate /* define a timeout for draining requests on the default control pipe */ 3077c478bd9Sstevel@tonic-gate #define HID_DEFAULT_PIPE_DRAIN_TIMEOUT 5 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate /* To support PM on SUN mice of later revisions */ 3107c478bd9Sstevel@tonic-gate #define HID_SUN_MOUSE_VENDOR_ID 0x0430 3117c478bd9Sstevel@tonic-gate #define HID_SUN_MOUSE_PROD_ID 0x0100 3127c478bd9Sstevel@tonic-gate #define HID_SUN_MOUSE_BCDDEVICE 0x0105 /* and later revisions */ 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gate 3157c478bd9Sstevel@tonic-gate /* 3167c478bd9Sstevel@tonic-gate * Debug message Masks 3177c478bd9Sstevel@tonic-gate */ 3187c478bd9Sstevel@tonic-gate #define PRINT_MASK_ATTA 0x00000001 319*cfe80fe3SAlex Wilson #define PRINT_MASK_OPEN 0x00000002 3207c478bd9Sstevel@tonic-gate #define PRINT_MASK_CLOSE 0x00000004 3217c478bd9Sstevel@tonic-gate #define PRINT_MASK_EVENTS 0x00000008 3227c478bd9Sstevel@tonic-gate #define PRINT_MASK_PM 0x00000010 3237c478bd9Sstevel@tonic-gate #define PRINT_MASK_ALL 0xFFFFFFFF 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate /* 3267c478bd9Sstevel@tonic-gate * Define states local to hid driver 3277c478bd9Sstevel@tonic-gate */ 3287c478bd9Sstevel@tonic-gate #define USB_DEV_HID_POWER_CHANGE 0x80 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate /* define for retrying control requests */ 3317c478bd9Sstevel@tonic-gate #define HID_RETRY 10 3327c478bd9Sstevel@tonic-gate 3337c478bd9Sstevel@tonic-gate #ifdef __cplusplus 3347c478bd9Sstevel@tonic-gate } 3357c478bd9Sstevel@tonic-gate #endif 3367c478bd9Sstevel@tonic-gate 3377c478bd9Sstevel@tonic-gate #endif /* _SYS_USB_HIDVAR_H */ 338