Initial code for hal hid host
cover Initial code for hal hid host
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(-)
Signature · 1 line
1.7.9.5
PATCH 1/7 android: Return right from hal_ipc_cmd call in hal hid connect
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(-)
android/hal-hidhost.c +2 -7
@@ -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)
Signature · 1 line
1.7.9.5
PATCH 2/7 android: Return right from hal_ipc_cmd call in hal hid disconnect
In reply to Ravi kumar VeeramallyDo 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(-)
android/hal-hidhost.c +2 -7
@@ -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)
Signature · 1 line
1.7.9.5
PATCH 3/7 android: Add initial code for hidhost virtual unplug
In reply to Ravi kumar VeeramallyThis adds initial code for hidhost .virtual_unplug interface
--- android/hal-hidhost.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
android/hal-hidhost.c +6 -1
@@ -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)
Signature · 1 line
1.7.9.5
PATCH 4/7 android: Add initial code for hidhost get and set protocol
In reply to Ravi kumar VeeramallyThis adds the initial code for hidhost .get_protocol and .set_protocol interfaces
--- android/hal-hidhost.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)
android/hal-hidhost.c +38 -2
@@ -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,
Signature · 1 line
1.7.9.5
PATCH 5/7 android: Add initial code for hidhost get and set report
In reply to Ravi kumar VeeramallyThis adds the initial code for hidhost .get_report and .set_report interfaces
--- android/hal-hidhost.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-)
android/hal-hidhost.c +37 -2
@@ -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)
Signature · 1 line
1.7.9.5
PATCH 6/7 android: Add initial code for hidhost send data
In reply to Ravi kumar VeeramallyThis adds the initial code for hidhost .send_data interface
--- android/hal-hidhost.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
android/hal-hidhost.c +6 -1
@@ -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)
Signature · 1 line
1.7.9.5
PATCH 7/7 android: Add initial code for hidhost set hid information
In reply to Ravi kumar VeeramallyThis adds the initial code for hidhost .set_info interface
--- android/hal-hidhost.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
android/hal-hidhost.c +14 -1
@@ -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,
Signature · 1 line
1.7.9.5
Hi Ravi,
Quoted 16 lines · Ravi kumar Veeramally
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.
---_v2is about fixing issues as per Johan comments.Ravi kumar Veeramally (7):
android: Return right fromhal_ipc_cmdcall in hal hid connect
android: Return right fromhal_ipc_cmdcall 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
Quoted 2 lines
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