The Android Open Source Project | 624a787 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2002-2012 Broadcom Corporation |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at: |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | * |
| 17 | ******************************************************************************/ |
| 18 | |
| 19 | /****************************************************************************** |
| 20 | * |
| 21 | * This file contains HID protocol definitions |
| 22 | * |
| 23 | ******************************************************************************/ |
| 24 | |
| 25 | #ifndef HIDDEFS_H |
| 26 | #define HIDDEFS_H |
| 27 | |
| 28 | #include "sdp_api.h" |
| 29 | /* |
| 30 | ** tHID_STATUS: HID result codes, returned by HID and device and host functions. |
| 31 | */ |
| 32 | enum |
| 33 | { |
| 34 | HID_SUCCESS, |
| 35 | HID_ERR_NOT_REGISTERED, |
| 36 | HID_ERR_ALREADY_REGISTERED, |
| 37 | HID_ERR_NO_RESOURCES, |
| 38 | HID_ERR_NO_CONNECTION, |
| 39 | HID_ERR_INVALID_PARAM, |
| 40 | HID_ERR_UNSUPPORTED, |
| 41 | HID_ERR_UNKNOWN_COMMAND, |
| 42 | HID_ERR_CONGESTED, |
| 43 | HID_ERR_CONN_IN_PROCESS, |
| 44 | HID_ERR_ALREADY_CONN, |
| 45 | HID_ERR_DISCONNECTING, |
| 46 | HID_ERR_SET_CONNABLE_FAIL, |
| 47 | /* Device specific error codes */ |
| 48 | HID_ERR_HOST_UNKNOWN, |
| 49 | HID_ERR_L2CAP_FAILED, |
| 50 | HID_ERR_AUTH_FAILED, |
| 51 | HID_ERR_SDP_BUSY, |
Andre Eisenbach | bdd3209 | 2013-08-08 15:42:48 -0700 | [diff] [blame] | 52 | HID_ERR_GATT, |
The Android Open Source Project | 624a787 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 53 | |
| 54 | HID_ERR_INVALID = 0xFF |
| 55 | }; |
| 56 | |
| 57 | typedef UINT8 tHID_STATUS; |
| 58 | |
| 59 | #define HID_L2CAP_CONN_FAIL (0x0100) /* Connection Attempt was made but failed */ |
| 60 | #define HID_L2CAP_REQ_FAIL (0x0200) /* L2CAP_ConnectReq API failed */ |
| 61 | #define HID_L2CAP_CFG_FAIL (0x0400) /* L2CAP Configuration was rejected by peer */ |
| 62 | |
| 63 | |
| 64 | |
| 65 | /* Define the HID transaction types |
| 66 | */ |
| 67 | #define HID_TRANS_HANDSHAKE (0) |
| 68 | #define HID_TRANS_CONTROL (1) |
| 69 | #define HID_TRANS_GET_REPORT (4) |
| 70 | #define HID_TRANS_SET_REPORT (5) |
| 71 | #define HID_TRANS_GET_PROTOCOL (6) |
| 72 | #define HID_TRANS_SET_PROTOCOL (7) |
| 73 | #define HID_TRANS_GET_IDLE (8) |
| 74 | #define HID_TRANS_SET_IDLE (9) |
| 75 | #define HID_TRANS_DATA (10) |
| 76 | #define HID_TRANS_DATAC (11) |
| 77 | |
Chih-Hung Hsieh | b67e181 | 2016-05-20 10:29:31 -0700 | [diff] [blame^] | 78 | #define HID_GET_TRANS_FROM_HDR(x) (((x) >> 4) & 0x0f) |
| 79 | #define HID_GET_PARAM_FROM_HDR(x) ((x) & 0x0f) |
| 80 | #define HID_BUILD_HDR(t,p) (UINT8)(((t) << 4) | ((p) & 0x0f)) |
The Android Open Source Project | 624a787 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 81 | |
| 82 | |
| 83 | /* Parameters for Handshake |
| 84 | */ |
| 85 | #define HID_PAR_HANDSHAKE_RSP_SUCCESS (0) |
| 86 | #define HID_PAR_HANDSHAKE_RSP_NOT_READY (1) |
| 87 | #define HID_PAR_HANDSHAKE_RSP_ERR_INVALID_REP_ID (2) |
| 88 | #define HID_PAR_HANDSHAKE_RSP_ERR_UNSUPPORTED_REQ (3) |
| 89 | #define HID_PAR_HANDSHAKE_RSP_ERR_INVALID_PARAM (4) |
| 90 | #define HID_PAR_HANDSHAKE_RSP_ERR_UNKNOWN (14) |
| 91 | #define HID_PAR_HANDSHAKE_RSP_ERR_FATAL (15) |
| 92 | |
| 93 | |
| 94 | /* Parameters for Control |
| 95 | */ |
| 96 | #define HID_PAR_CONTROL_NOP (0) |
| 97 | #define HID_PAR_CONTROL_HARD_RESET (1) |
| 98 | #define HID_PAR_CONTROL_SOFT_RESET (2) |
| 99 | #define HID_PAR_CONTROL_SUSPEND (3) |
| 100 | #define HID_PAR_CONTROL_EXIT_SUSPEND (4) |
| 101 | #define HID_PAR_CONTROL_VIRTUAL_CABLE_UNPLUG (5) |
| 102 | |
| 103 | |
| 104 | /* Different report types in get, set, data |
| 105 | */ |
| 106 | #define HID_PAR_REP_TYPE_MASK (0x03) |
| 107 | #define HID_PAR_REP_TYPE_OTHER (0x00) |
| 108 | #define HID_PAR_REP_TYPE_INPUT (0x01) |
| 109 | #define HID_PAR_REP_TYPE_OUTPUT (0x02) |
| 110 | #define HID_PAR_REP_TYPE_FEATURE (0x03) |
| 111 | |
| 112 | /* Parameters for Get Report |
| 113 | */ |
| 114 | |
| 115 | /* Buffer size in two bytes after Report ID */ |
| 116 | #define HID_PAR_GET_REP_BUFSIZE_FOLLOWS (0x08) |
| 117 | |
| 118 | |
| 119 | /* Parameters for Protocol Type |
| 120 | */ |
| 121 | #define HID_PAR_PROTOCOL_MASK (0x01) |
| 122 | #define HID_PAR_PROTOCOL_REPORT (0x01) |
| 123 | #define HID_PAR_PROTOCOL_BOOT_MODE (0x00) |
| 124 | |
| 125 | #define HID_PAR_REP_TYPE_MASK (0x03) |
| 126 | |
| 127 | /* Descriptor types in the SDP record |
| 128 | */ |
| 129 | #define HID_SDP_DESCRIPTOR_REPORT (0x22) |
| 130 | #define HID_SDP_DESCRIPTOR_PHYSICAL (0x23) |
| 131 | |
| 132 | typedef struct desc_info |
| 133 | { |
| 134 | UINT16 dl_len; |
| 135 | UINT8 *dsc_list; |
| 136 | } tHID_DEV_DSCP_INFO; |
| 137 | |
| 138 | #define HID_SSR_PARAM_INVALID 0xffff |
| 139 | |
| 140 | typedef struct sdp_info |
| 141 | { |
| 142 | char svc_name[HID_MAX_SVC_NAME_LEN]; /*Service Name */ |
| 143 | char svc_descr[HID_MAX_SVC_DESCR_LEN]; /*Service Description*/ |
| 144 | char prov_name[HID_MAX_PROV_NAME_LEN]; /*Provider Name.*/ |
| 145 | UINT16 rel_num; /*Release Number */ |
| 146 | UINT16 hpars_ver; /*HID Parser Version.*/ |
| 147 | UINT16 ssr_max_latency; /* HIDSSRHostMaxLatency value, if HID_SSR_PARAM_INVALID not used*/ |
| 148 | UINT16 ssr_min_tout; /* HIDSSRHostMinTimeout value, if HID_SSR_PARAM_INVALID not used* */ |
| 149 | UINT8 sub_class; /*Device Subclass.*/ |
| 150 | UINT8 ctry_code; /*Country Code.*/ |
| 151 | UINT16 sup_timeout;/* Supervisory Timeout */ |
| 152 | |
| 153 | tHID_DEV_DSCP_INFO dscp_info; /* Descriptor list and Report list to be set in the SDP record. |
| 154 | This parameter is used if HID_DEV_USE_GLB_SDP_REC is set to FALSE.*/ |
| 155 | tSDP_DISC_REC *p_sdp_layer_rec; |
| 156 | } tHID_DEV_SDP_INFO; |
| 157 | |
| 158 | #endif |
| 159 | |