summaryrefslogtreecommitdiff
path: root/android/hal-hidhost.c
diff options
context:
space:
mode:
authorRavi kumar Veeramally <ravikumar.veeramally@linux.intel.com>2013-10-23 00:41:57 -0700
committerJohan Hedberg <johan.hedberg@intel.com>2013-10-23 10:57:43 +0300
commitd1f285e9ff2e2d9c0efa278bae79671c4ab0f0f1 (patch)
treebcfdd7453f842d662cd04e5cadaaac146dac4a02 /android/hal-hidhost.c
parentd5a7a9980fa0133cb1b0bb161efcc3e2b0b7288e (diff)
downloadbluez-d1f285e9ff2e2d9c0efa278bae79671c4ab0f0f1.tar.gz
android: Add initial code for hidhost get and set report
This adds the initial code for hidhost .get_report and .set_report interfaces
Diffstat (limited to 'android/hal-hidhost.c')
-rw-r--r--android/hal-hidhost.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 4e43b8a67..c89ec1589 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -167,6 +167,8 @@ static bt_status_t hh_get_report(bt_bdaddr_t *bd_addr,
uint8_t reportId,
int bufferSize)
{
+ struct hal_msg_cmd_bt_hid_get_report cmd;
+
DBG("");
if (!interface_ready())
@@ -175,13 +177,31 @@ static bt_status_t hh_get_report(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));
+ cmd.id = reportId;
+
+ switch (reportType) {
+ case BTHH_INPUT_REPORT:
+ cmd.type = HAL_MSG_BT_HID_INPUT_REPORT;
+ break;
+ case BTHH_OUTPUT_REPORT:
+ cmd.type = HAL_MSG_BT_HID_OUTPUT_REPORT;
+ break;
+ case BTHH_FEATURE_REPORT:
+ cmd.type = HAL_MSG_BT_HID_FEATURE_REPORT;
+ break;
+ }
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_GET_REPORT,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_set_report(bt_bdaddr_t *bd_addr,
bthh_report_type_t reportType,
char *report)
{
+ struct hal_msg_cmd_bt_hid_set_report cmd;
+
DBG("");
if (!interface_ready())
@@ -190,7 +210,23 @@ static bt_status_t hh_set_report(bt_bdaddr_t *bd_addr,
if (!bd_addr || !report)
return BT_STATUS_PARM_INVALID;
- return BT_STATUS_UNSUPPORTED;
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ switch (reportType) {
+ case BTHH_INPUT_REPORT:
+ cmd.type = HAL_MSG_BT_HID_INPUT_REPORT;
+ break;
+ case BTHH_OUTPUT_REPORT:
+ cmd.type = HAL_MSG_BT_HID_OUTPUT_REPORT;
+ break;
+ case BTHH_FEATURE_REPORT:
+ cmd.type = HAL_MSG_BT_HID_FEATURE_REPORT;
+ break;
+ }
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST,
+ HAL_MSG_OP_BT_HID_SET_REPORT,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_send_data(bt_bdaddr_t *bd_addr, char *data)