diff options
author | Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com> | 2013-10-23 00:41:56 -0700 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-23 10:56:19 +0300 |
commit | d5a7a9980fa0133cb1b0bb161efcc3e2b0b7288e (patch) | |
tree | ed96bfbed11c3f3c967091f087ff4863b0bb217c /android/hal-hidhost.c | |
parent | 3590e6b8e953c8dc309ebc4e06f9fcd9fa3c41a8 (diff) | |
download | bluez-d5a7a9980fa0133cb1b0bb161efcc3e2b0b7288e.tar.gz |
android: Add initial code for hidhost get and set protocol
This adds the initial code for hidhost .get_protocol and .set_protocol
interfaces
Diffstat (limited to 'android/hal-hidhost.c')
-rw-r--r-- | android/hal-hidhost.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c index dd2a88ff5..4e43b8a67 100644 --- a/android/hal-hidhost.c +++ b/android/hal-hidhost.c @@ -101,6 +101,8 @@ static bt_status_t hh_set_info(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info) static bt_status_t hh_get_protocol(bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode) { + struct hal_msg_cmd_bt_hid_get_protocol cmd; + DBG(""); if (!interface_ready()) @@ -109,12 +111,30 @@ static bt_status_t hh_get_protocol(bt_bdaddr_t *bd_addr, if (!bd_addr) return BT_STATUS_PARM_INVALID; - return BT_STATUS_UNSUPPORTED; + memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr)); + + switch (protocolMode) { + case BTHH_REPORT_MODE: + cmd.mode = HAL_MSG_BT_HID_REPORT_PROTOCOL; + break; + case BTHH_BOOT_MODE: + cmd.mode = HAL_MSG_BT_HID_BOOT_PROTOCOL; + break; + case BTHH_UNSUPPORTED_MODE: + cmd.mode = HAL_MSG_BT_HID_UNSUPPORTED_PROTOCOL; + break; + } + + return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, + HAL_MSG_OP_BT_HID_GET_PROTOCOL, + sizeof(cmd), &cmd, 0, NULL, NULL); } static bt_status_t hh_set_protocol(bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode) { + struct hal_msg_cmd_bt_hid_set_protocol cmd; + DBG(""); if (!interface_ready()) @@ -123,7 +143,23 @@ static bt_status_t hh_set_protocol(bt_bdaddr_t *bd_addr, if (!bd_addr) return BT_STATUS_PARM_INVALID; - return BT_STATUS_UNSUPPORTED; + memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr)); + + switch (protocolMode) { + case BTHH_REPORT_MODE: + cmd.mode = HAL_MSG_BT_HID_REPORT_PROTOCOL; + break; + case BTHH_BOOT_MODE: + cmd.mode = HAL_MSG_BT_HID_BOOT_PROTOCOL; + break; + case BTHH_UNSUPPORTED_MODE: + cmd.mode = HAL_MSG_BT_HID_UNSUPPORTED_PROTOCOL; + break; + } + + return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, + HAL_MSG_OP_BT_HID_SET_PROTOCOL, + sizeof(cmd), &cmd, 0, NULL, NULL); } static bt_status_t hh_get_report(bt_bdaddr_t *bd_addr, |