Patch set is all about initial code for hal hidhost interfaces which
are .virtual_unplug, .set_info, .get_protocol, .set_protocol,
.get_report, .set_report and .send_data. Also includes issue fixes
for .connect and .disconnect interfaces.
---
_v2 is about fixing issues as per Johan comments.
Ravi kumar Veeramally (7):
android: Return right from hal_ipc_cmd call in hal hid connect
android: Return right from hal_ipc_cmd call in hal hid disconnect
android: Add initial code for hidhost virtual unplug
android: Add initial code for hidhost get and set protocol
android: Add initial code for hidhost get and set report
android: Add initial code for hidhost send data
android: Add initial code for hidhost set hid information
android/hal-hidhost.c | 126 ++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 105 insertions(+), 21 deletions(-)
--
1.7.9.5
Hi Ravi,
On Wed, Oct 23, 2013, Ravi kumar Veeramally wrote:
> Patch set is all about initial code for hal hidhost interfaces which
> are .virtual_unplug, .set_info, .get_protocol, .set_protocol,
> .get_report, .set_report and .send_data. Also includes issue fixes
> for .connect and .disconnect interfaces.
> ---
> _v2 is about fixing issues as per Johan comments.
>
> Ravi kumar Veeramally (7):
> android: Return right from hal_ipc_cmd call in hal hid connect
> android: Return right from hal_ipc_cmd call in hal hid disconnect
> android: Add initial code for hidhost virtual unplug
> android: Add initial code for hidhost get and set protocol
> android: Add initial code for hidhost get and set report
> android: Add initial code for hidhost send data
> android: Add initial code for hidhost set hid information
>
> android/hal-hidhost.c | 126 ++++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 105 insertions(+), 21 deletions(-)
All patches have been applied (after some minor coding style fixes).
Thanks.
Johan
This adds the initial code for hidhost .get_report and .set_report
interfaces
---
android/hal-hidhost.c | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index f289f7f..22045f1 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,22 @@ 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)
--
1.7.9.5
This adds the initial code for hidhost .send_data interface
---
android/hal-hidhost.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 22045f1..02a3f7d 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -230,6 +230,8 @@ static bt_status_t hh_set_report(bt_bdaddr_t *bd_addr,
static bt_status_t hh_send_data(bt_bdaddr_t *bd_addr, char *data)
{
+ struct hal_msg_cmd_bt_hid_send_data cmd;
+
DBG("");
if (!interface_ready())
@@ -238,7 +240,10 @@ static bt_status_t hh_send_data(bt_bdaddr_t *bd_addr, char *data)
if (!bd_addr || !data)
return BT_STATUS_PARM_INVALID;
- return BT_STATUS_UNSUPPORTED;
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_SEND_DATA,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_init(bthh_callbacks_t *callbacks)
--
1.7.9.5
This adds the initial code for hidhost .set_info interface
---
android/hal-hidhost.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 02a3f7d..4842a01 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -87,6 +87,8 @@ static bt_status_t hh_virtual_unplug(bt_bdaddr_t *bd_addr)
static bt_status_t hh_set_info(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info)
{
+ struct hal_msg_cmd_bt_hid_set_info cmd;
+
DBG("");
if (!interface_ready())
@@ -95,7 +97,18 @@ static bt_status_t hh_set_info(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info)
if (!bd_addr)
return BT_STATUS_PARM_INVALID;
- return BT_STATUS_UNSUPPORTED;
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+ cmd.attr = hid_info.attr_mask;
+ cmd.subclass = hid_info.sub_class;
+ cmd.app_id = hid_info.app_id;
+ cmd.vendor = hid_info.vendor_id;
+ cmd.product = hid_info.product_id;
+ cmd.country = hid_info.ctry_code;
+ cmd.descr_len = hid_info.dl_len;
+ memcpy(cmd.descr, hid_info.dsc_list, cmd.descr_len);
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_SET_INFO,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_get_protocol(bt_bdaddr_t *bd_addr,
--
1.7.9.5
This adds the initial code for hidhost .get_protocol and .set_protocol
interfaces
---
android/hal-hidhost.c | 40 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index c6ac42f..f289f7f 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,
--
1.7.9.5
This adds initial code for hidhost .virtual_unplug interface
---
android/hal-hidhost.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 1f54bc4..c6ac42f 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -69,6 +69,8 @@ static bt_status_t hh_disconnect(bt_bdaddr_t *bd_addr)
static bt_status_t hh_virtual_unplug(bt_bdaddr_t *bd_addr)
{
+ struct hal_msg_cmd_bt_hid_vp cmd;
+
DBG("");
if (!interface_ready())
@@ -77,7 +79,10 @@ static bt_status_t hh_virtual_unplug(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));
+
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_VP,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_set_info(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info)
--
1.7.9.5
Do not print any error message and return from hal_ipc_cmd call in hal
hid disconnect
---
android/hal-hidhost.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index f7d8cbf..1f54bc4 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -63,13 +63,8 @@ static bt_status_t hh_disconnect(bt_bdaddr_t *bd_addr)
memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
- if (hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_DISCONNECT,
- sizeof(cmd), &cmd, 0, NULL, NULL) < 0) {
- error("Failed to disconnect hid device");
- return BT_STATUS_FAIL;
- }
-
- return BT_STATUS_SUCCESS;
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_DISCONNECT,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_virtual_unplug(bt_bdaddr_t *bd_addr)
--
1.7.9.5
Do not print any error message and return from hal_ipc_cmd call in hal
hid connect
---
android/hal-hidhost.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index f941f2f..f7d8cbf 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -45,13 +45,8 @@ static bt_status_t hh_connect(bt_bdaddr_t *bd_addr)
memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
- if (hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_CONNECT,
- sizeof(cmd), &cmd, 0, NULL, NULL) < 0) {
- error("Failed to connect hid device");
- return BT_STATUS_FAIL;
- }
-
- return BT_STATUS_SUCCESS;
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_MSG_OP_BT_HID_CONNECT,
+ sizeof(cmd), &cmd, 0, NULL, NULL);
}
static bt_status_t hh_disconnect(bt_bdaddr_t *bd_addr)
--
1.7.9.5