This patch adds missing hid ipc documentation, hal headers,
renaming and virtual unplug notification in hid HAL.
Unsupported methods are virtual unplug and send data in daemon.
Ravi kumar Veeramally (6):
android/hid: Add missing hid send data parameters in ipc document
android/hid: Add missing parameters in send data struct in HAL headers
android/hid: Fill send data structure variables in hal-hidhost
android/hid: Rename virtual unplug define and struct
android/hid: Add hid event virtual unplug structure to HAL msg headers
android/hid: Handle virtual unplug notification in hid hal
android/hal-hidhost.c | 18 ++++++++++++++++--
android/hal-ipc-api.txt | 4 +++-
android/hal-msg.h | 14 +++++++++++---
android/hid.c | 5 +++--
4 files changed, 33 insertions(+), 8 deletions(-)
--
1.8.1.2
Renaming virtual unplug define and strcut name from VP to more
meaning full.
---
android/hal-hidhost.c | 4 ++--
android/hal-msg.h | 4 ++--
android/hid.c | 5 +++--
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index 22a5d15..b24e74e 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -140,7 +140,7 @@ 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_cmd_hid_vp cmd;
+ struct hal_cmd_hid_virtual_unplug cmd;
DBG("");
@@ -152,7 +152,7 @@ static bt_status_t hh_virtual_unplug(bt_bdaddr_t *bd_addr)
memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
- return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_OP_HID_VP,
+ return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_OP_HID_VIRTUAL_UNPLUG,
sizeof(cmd), &cmd, 0, NULL, NULL);
}
diff --git a/android/hal-msg.h b/android/hal-msg.h
index eb145a5..59e4f78 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -242,8 +242,8 @@ struct hal_cmd_hid_disconnect {
uint8_t bdaddr[6];
} __attribute__((packed));
-#define HAL_OP_HID_VP 0x03
-struct hal_cmd_hid_vp {
+#define HAL_OP_HID_VIRTUAL_UNPLUG 0x03
+struct hal_cmd_hid_virtual_unplug {
uint8_t bdaddr[6];
} __attribute__((packed));
diff --git a/android/hid.c b/android/hid.c
index c38c4c1..77dc81d 100644
--- a/android/hid.c
+++ b/android/hid.c
@@ -740,7 +740,8 @@ static uint8_t bt_hid_disconnect(struct hal_cmd_hid_disconnect *cmd,
return HAL_STATUS_SUCCESS;
}
-static uint8_t bt_hid_virtual_unplug(struct hal_cmd_hid_vp *cmd, uint16_t len)
+static uint8_t bt_hid_virtual_unplug(struct hal_cmd_hid_virtual_unplug *cmd,
+ uint16_t len)
{
DBG("Not Implemented");
@@ -938,7 +939,7 @@ void bt_hid_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf, uint16_t len)
case HAL_OP_HID_DISCONNECT:
status = bt_hid_disconnect(buf, len);
break;
- case HAL_OP_HID_VP:
+ case HAL_OP_HID_VIRTUAL_UNPLUG:
status = bt_hid_virtual_unplug(buf, len);
break;
case HAL_OP_HID_SET_INFO:
--
1.8.1.2
---
android/hal-hidhost.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index b24e74e..74a7fe7 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -77,6 +77,15 @@ static void handle_get_report(void *buf)
ev->status, ev->data, ev->len);
}
+static void handle_virtual_unplug(void *buf)
+{
+ struct hal_ev_hid_virtual_unplug *ev = buf;
+
+ if (bt_hh_cbacks->virtual_unplug_cb)
+ bt_hh_cbacks->virtual_unplug_cb((bt_bdaddr_t *) ev->bdaddr,
+ ev->status);
+}
+
/* will be called from notification thread context */
void bt_notify_hh(uint16_t opcode, void *buf, uint16_t len)
{
@@ -96,6 +105,9 @@ void bt_notify_hh(uint16_t opcode, void *buf, uint16_t len)
case HAL_EV_HID_GET_REPORT:
handle_get_report(buf);
break;
+ case HAL_EV_HID_VIRTUAL_UNPLUG:
+ handle_virtual_unplug(buf);
+ break;
default:
DBG("Unhandled callback opcode=0x%x", opcode);
break;
--
1.8.1.2
---
android/hal-msg.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 59e4f78..740f2ab 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -477,6 +477,12 @@ struct hal_ev_hid_get_report {
uint8_t data[0];
} __attribute__((packed));
+#define HAL_EV_HID_VIRTUAL_UNPLUG 0x86
+struct hal_ev_hid_virtual_unplug {
+ uint8_t bdaddr[6];
+ uint8_t status;
+} __attribute__((packed));
+
#define HAL_EV_AV_CONNECTION_STATE 0x81
struct hal_ev_av_connection_state {
uint8_t state;
--
1.8.1.2
---
android/hal-hidhost.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
index f1a2223..22a5d15 100644
--- a/android/hal-hidhost.c
+++ b/android/hal-hidhost.c
@@ -330,6 +330,8 @@ static bt_status_t hh_send_data(bt_bdaddr_t *bd_addr, char *data)
return BT_STATUS_PARM_INVALID;
memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+ cmd.len = strlen(data);
+ memcpy(cmd.data, data, cmd.len);
return hal_ipc_cmd(HAL_SERVICE_ID_HIDHOST, HAL_OP_HID_SEND_DATA,
sizeof(cmd), &cmd, 0, NULL, NULL);
--
1.8.1.2
---
android/hal-msg.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index f0cc800..eb145a5 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -298,7 +298,9 @@ struct hal_cmd_hid_set_report {
#define HAL_OP_HID_SEND_DATA 0x09
struct hal_cmd_hid_send_data {
- uint8_t bdaddr[6];
+ uint8_t bdaddr[6];
+ uint16_t len;
+ uint8_t data[670];
} __attribute__((packed));
#define HAL_OP_AV_CONNECT 0x01
--
1.8.1.2
---
android/hal-ipc-api.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index c39cb0d..da4eaaa 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -566,7 +566,9 @@ Commands and responses:
Opcode 0x09 - Send Data command/response
Command parameters: Remote address (6 octets)
- ...
+ Report length (2 octets)
+ Report data (670 octets)
+
Response parameters: <none>
In case of an error, the error response will be returned.
--
1.8.1.2