diff options
-rwxr-xr-x[-rw-r--r--] | bta/hh/bta_hh_act.c | 27 | ||||
-rwxr-xr-x[-rw-r--r--] | bta/hh/bta_hh_api.c | 34 | ||||
-rwxr-xr-x[-rw-r--r--] | bta/include/bta_hh_api.h | 9 | ||||
-rwxr-xr-x | btif/src/btif_hh.c | 11 | ||||
-rwxr-xr-x[-rw-r--r--] | stack/hid/hidh_conn.c | 9 |
5 files changed, 57 insertions, 33 deletions
diff --git a/bta/hh/bta_hh_act.c b/bta/hh/bta_hh_act.c index 483e79c..163597e 100644..100755 --- a/bta/hh/bta_hh_act.c +++ b/bta/hh/bta_hh_act.c @@ -621,6 +621,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) hs_data.rsp_data.proto_mode = BTA_HH_PROTO_UNKNOWN; /* fall through */ case BTA_HH_GET_RPT_EVT: + case BTA_HH_GET_IDLE_EVT : hs_data.handle = p_cb->hid_handle; /* if handshake gives an OK code for these transaction, fill in UNSUPT */ if ((hs_data.status = bta_hh_get_trans_status(p_data->hid_cback.data)) == BTA_HH_OK) @@ -633,6 +634,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) /* acknoledgement from HID device for SET_ transaction */ case BTA_HH_SET_RPT_EVT: case BTA_HH_SET_PROTO_EVT: + case BTA_HH_SET_IDLE_EVT : cback_data.handle = p_cb->hid_handle; cback_data.status = bta_hh_get_trans_status(p_data->hid_cback.data); (* bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH *)&cback_data); @@ -659,7 +661,6 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) /* transaction achknoledgement received, inform PM for mode change */ bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr); - return; } /******************************************************************************* @@ -687,13 +688,16 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) switch (p_cb->w4_evt) { + case BTA_HH_GET_IDLE_EVT: + hs_data.rsp_data.idle_rate = *data; + break; case BTA_HH_GET_RPT_EVT: hs_data.rsp_data.p_rpt_data = pdata; break; case BTA_HH_GET_PROTO_EVT: /* match up BTE/BTA report/boot mode def*/ hs_data.rsp_data.proto_mode = ((*data) == HID_PAR_PROTOCOL_REPORT)? \ - BTA_HH_PROTO_RPT_MODE : BTA_HH_PROTO_BOOT_MODE; + BTA_HH_PROTO_RPT_MODE : BTA_HH_PROTO_BOOT_MODE; #if BTA_HH_DEBUG APPL_TRACE_DEBUG1("GET_PROTOCOL Mode = [%s]", (hs_data.rsp_data.proto_mode == BTA_HH_PROTO_RPT_MODE)? "Report" : "Boot"); @@ -704,6 +708,8 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) /* fall through */ case BTA_HH_SET_RPT_EVT: /* fall through */ + case BTA_HH_SET_IDLE_EVT : + /* fall through */ default: #if BTA_HH_DEBUG APPL_TRACE_DEBUG1("invalid transaction type for DATA payload: 4_evt[%s]", @@ -715,7 +721,7 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA * p_data) /* inform PM for mode change */ bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr); - + (* bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH *)&hs_data); p_cb->w4_evt = 0; @@ -937,7 +943,7 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data) cbdata.status = BTA_HH_ERR; if (p_data->api_sndcmd.t_type != HID_TRANS_CONTROL && - p_data->api_sndcmd.t_type != HID_TRANS_DATA) + p_data->api_sndcmd.t_type != HID_TRANS_DATA) (* bta_hh_cb.p_cback)(event, (tBTA_HH *)&cbdata); else if (p_data->api_sndcmd.param == BTA_HH_CTRL_VIRTUAL_CABLE_UNPLUG) (* bta_hh_cb.p_cback)(BTA_HH_VC_UNPLUG_EVT, (tBTA_HH *)&cbdata); @@ -953,7 +959,11 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data) /* fall through */ case HID_TRANS_SET_REPORT: /* fall through */ - case HID_TRANS_GET_PROTOCOL:/* set w4_handsk event name for callback function use */ + case HID_TRANS_GET_PROTOCOL: + /* fall through */ + case HID_TRANS_GET_IDLE: + /* fall through */ + case HID_TRANS_SET_IDLE:/* set w4_handsk event name for callback function use */ p_cb->w4_evt = event; break; case HID_TRANS_DATA: /* output report */ @@ -965,13 +975,6 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data) p_cb->vp = TRUE; break; - /* deprecated for HID 1.1, shall not be sent out */ - case HID_TRANS_GET_IDLE: - /* fall through */ - case HID_TRANS_SET_IDLE: - APPL_TRACE_ERROR0("SET_IDLE, GET_IDLE is deprecated in HID 1.1") - break; - /* currently not expected */ case HID_TRANS_DATAC: default: diff --git a/bta/hh/bta_hh_api.c b/bta/hh/bta_hh_api.c index b1af978..c84243d 100644..100755 --- a/bta/hh/bta_hh_api.c +++ b/bta/hh/bta_hh_api.c @@ -231,18 +231,38 @@ void BTA_HhGetProtoMode(UINT8 dev_handle) { bta_hh_snd_write_dev(dev_handle, HID_TRANS_GET_PROTOCOL, 0, 0, 0, NULL); } +/******************************************************************************* +** +** Function BTA_HhSetIdle +** +** Description send SET_IDLE to device. +** +** Returns void +** +*******************************************************************************/ +void BTA_HhSetIdle(UINT8 dev_handle, UINT16 idle_rate) +{ + bta_hh_snd_write_dev(dev_handle, HID_TRANS_SET_IDLE, 0, idle_rate, 0, NULL); +} -// btla-specific ++ -// ATTENTION: -// BTA_HH_GET_IDLE_EVT and BTA_HH_SET_IDLE_EVT had been deprecated in the newer stack -// btla apps will need to be changed accordingly for this -// btla-specific -- - +/******************************************************************************* +** +** Function BTA_HhGetIdle +** +** Description Send a GET_IDLE from HID device. +** +** Returns void +** +*******************************************************************************/ +void BTA_HhGetIdle(UINT8 dev_handle) +{ + bta_hh_snd_write_dev(dev_handle, HID_TRANS_GET_IDLE, 0, 0, 0, NULL); +} /******************************************************************************* ** ** Function BTA_HhSendCtrl ** -** Description Send a control command to HID device. +** Description Send a control command to HID device. ** ** Returns void ** diff --git a/bta/include/bta_hh_api.h b/bta/include/bta_hh_api.h index 11dc35e..41af74c 100644..100755 --- a/bta/include/bta_hh_api.h +++ b/bta/include/bta_hh_api.h @@ -35,11 +35,12 @@ #define BTA_HH_OPEN_EVT 2 /* connection opened */ #define BTA_HH_CLOSE_EVT 3 /* connection closed */ #define BTA_HH_GET_RPT_EVT 4 /* BTA_HhGetReport callback */ -#define BTA_HH_SET_RPT_EVT 5 /* BTA_HhSetReport callback */ +#define BTA_HH_SET_RPT_EVT 5 /* BTA_HhSetReport callback */ #define BTA_HH_GET_PROTO_EVT 6 /* BTA_GetProtoMode callback */ -#define BTA_HH_SET_PROTO_EVT 7 /* BTA_HhSetProtoMode callback */ -/* leave 8, 9 gap due to deprecate of GET_IDLE and SET_IDLE */ -#define BTA_HH_GET_DSCP_EVT 10 /* Get report descripotor */ +#define BTA_HH_SET_PROTO_EVT 7 /* BTA_HhSetProtoMode callback */ +#define BTA_HH_GET_IDLE_EVT 8 /* BTA_HhGetIdle comes callback */ +#define BTA_HH_SET_IDLE_EVT 9 /* BTA_HhSetIdle finish callback */ +#define BTA_HH_GET_DSCP_EVT 10 /* Get report descripotor */ #define BTA_HH_ADD_DEV_EVT 11 /* Add Device callback */ #define BTA_HH_RMV_DEV_EVT 12 /* remove device finished */ #define BTA_HH_VC_UNPLUG_EVT 13 /* virtually unplugged */ diff --git a/btif/src/btif_hh.c b/btif/src/btif_hh.c index 01061a1..0b945a0 100755 --- a/btif/src/btif_hh.c +++ b/btif/src/btif_hh.c @@ -401,13 +401,8 @@ void btif_hh_virtual_unpug(bt_bdaddr_t *bd_addr) p_dev = btif_hh_find_dev_by_bda(bd_addr); if (p_dev != NULL) { - if(p_dev->attr_mask & HID_VIRTUAL_CABLE) - { BTIF_TRACE_DEBUG1("%s Sending BTA_HH_CTRL_VIRTUAL_CABLE_UNPLUG", __FUNCTION__); BTA_HhSendCtrl(p_dev->dev_handle, BTA_HH_CTRL_VIRTUAL_CABLE_UNPLUG); - } - else - BTA_HhClose(p_dev->dev_handle); } else BTIF_TRACE_ERROR2("%s: Error, device %s not opened.", __FUNCTION__, bd_str); @@ -1344,9 +1339,7 @@ static bt_status_t send_data (bt_bdaddr_t *bd_addr, char* data) /* Build a SetReport data buffer */ memset(hexbuf, 0, 200); - //TODO - /* - hex_bytes_filled = scru_ascii_2_hex(data, len, hexbuf); + hex_bytes_filled = ascii_2_hex(data, len, hexbuf); BTIF_TRACE_ERROR2("Hex bytes filled, hex value: %d, %d", hex_bytes_filled, len); if (hex_bytes_filled) { @@ -1355,7 +1348,7 @@ static bt_status_t send_data (bt_bdaddr_t *bd_addr, char* data) memcpy(pbuf_data, hexbuf, hex_bytes_filled); BTA_HhSendData(p_dev->dev_handle, *bda, p_dev->p_buf); return BT_STATUS_SUCCESS; - }*/ + } } return BT_STATUS_FAIL; diff --git a/stack/hid/hidh_conn.c b/stack/hid/hidh_conn.c index 4744e10..29c4025 100644..100755 --- a/stack/hid/hidh_conn.c +++ b/stack/hid/hidh_conn.c @@ -830,6 +830,11 @@ tHID_STATUS hidh_conn_snd_data (UINT8 dhandle, UINT8 trans_type, UINT8 param, case HID_TRANS_SET_REPORT: case HID_TRANS_GET_PROTOCOL: case HID_TRANS_SET_PROTOCOL: + case HID_TRANS_GET_IDLE: + case HID_TRANS_SET_IDLE: + cid = p_hcon->ctrl_cid; + pool_id = HID_CONTROL_POOL_ID; + break; case HID_TRANS_DATA: cid = p_hcon->intr_cid; pool_id = HID_INTERRUPT_POOL_ID; @@ -838,7 +843,9 @@ tHID_STATUS hidh_conn_snd_data (UINT8 dhandle, UINT8 trans_type, UINT8 param, return (HID_ERR_INVALID_PARAM) ; } - if( (trans_type == HID_TRANS_GET_REPORT) && (param & 0x08) ) + if( trans_type == HID_TRANS_SET_IDLE ) + use_data = 1; + else if( (trans_type == HID_TRANS_GET_REPORT) && (param & 0x08) ) use_data = 2; do |