* [PATCH 4/5] android/hal-socket: Match functions names with HAL name
2014-02-18 10:05 [PATCH 1/5] android/hidhost: Add idle time callback implementation Szymon Janc
2014-02-18 10:05 ` [PATCH 2/5] android/socket: Move statics declarations after types definitions Szymon Janc
2014-02-18 10:05 ` [PATCH 3/5] android/hal-sock: Rename to hal-socket Szymon Janc
@ 2014-02-18 10:05 ` Szymon Janc
2014-02-18 10:05 ` [PATCH 5/5] android: Match socket IPC messages types " Szymon Janc
2014-02-19 18:00 ` [PATCH 1/5] android/hidhost: Add idle time callback implementation Szymon Janc
4 siblings, 0 replies; 6+ messages in thread
From: Szymon Janc @ 2014-02-18 10:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/hal-bluetooth.c | 2 +-
android/hal-socket.c | 16 ++++++++--------
android/hal.h | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 67c91e4..65432a8 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -751,7 +751,7 @@ static const void *get_profile_interface(const char *profile_id)
return NULL;
if (!strcmp(profile_id, BT_PROFILE_SOCKETS_ID))
- return bt_get_sock_interface();
+ return bt_get_socket_interface();
if (!strcmp(profile_id, BT_PROFILE_HIDHOST_ID))
return bt_get_hidhost_interface();
diff --git a/android/hal-socket.c b/android/hal-socket.c
index f62b7ef..ea7d9d8 100644
--- a/android/hal-socket.c
+++ b/android/hal-socket.c
@@ -26,7 +26,7 @@
#include "hal-utils.h"
#include "hal.h"
-static bt_status_t sock_listen(btsock_type_t type, const char *service_name,
+static bt_status_t socket_listen(btsock_type_t type, const char *service_name,
const uint8_t *uuid, int chan,
int *sock, int flags)
{
@@ -55,7 +55,7 @@ static bt_status_t sock_listen(btsock_type_t type, const char *service_name,
sizeof(cmd), &cmd, NULL, NULL, sock);
}
-static bt_status_t sock_connect(const bt_bdaddr_t *bdaddr, btsock_type_t type,
+static bt_status_t socket_connect(const bt_bdaddr_t *bdaddr, btsock_type_t type,
const uint8_t *uuid, int chan,
int *sock, int flags)
{
@@ -84,13 +84,13 @@ static bt_status_t sock_connect(const bt_bdaddr_t *bdaddr, btsock_type_t type,
sizeof(cmd), &cmd, NULL, NULL, sock);
}
-static btsock_interface_t sock_if = {
- sizeof(sock_if),
- sock_listen,
- sock_connect
+static btsock_interface_t socket_if = {
+ sizeof(socket_if),
+ socket_listen,
+ socket_connect
};
-btsock_interface_t *bt_get_sock_interface(void)
+btsock_interface_t *bt_get_socket_interface(void)
{
- return &sock_if;
+ return &socket_if;
}
diff --git a/android/hal.h b/android/hal.h
index 5005b49..6fd2559 100644
--- a/android/hal.h
+++ b/android/hal.h
@@ -23,7 +23,7 @@
#include <hardware/bt_rc.h>
#include <hardware/bt_hf.h>
-btsock_interface_t *bt_get_sock_interface(void);
+btsock_interface_t *bt_get_socket_interface(void);
bthh_interface_t *bt_get_hidhost_interface(void);
btpan_interface_t *bt_get_pan_interface(void);
btav_interface_t *bt_get_a2dp_interface(void);
--
1.8.3.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 5/5] android: Match socket IPC messages types with HAL name
2014-02-18 10:05 [PATCH 1/5] android/hidhost: Add idle time callback implementation Szymon Janc
` (2 preceding siblings ...)
2014-02-18 10:05 ` [PATCH 4/5] android/hal-socket: Match functions names with HAL name Szymon Janc
@ 2014-02-18 10:05 ` Szymon Janc
2014-02-19 18:00 ` [PATCH 1/5] android/hidhost: Add idle time callback implementation Szymon Janc
4 siblings, 0 replies; 6+ messages in thread
From: Szymon Janc @ 2014-02-18 10:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
android/hal-msg.h | 8 ++++----
android/hal-socket.c | 8 ++++----
android/ipc-tester.c | 24 ++++++++++++------------
android/socket.c | 20 ++++++++++----------
4 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 15c7ebe..964ab35 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -238,8 +238,8 @@ struct hal_cmd_le_test_mode {
#define HAL_SOCK_FLAG_ENCRYPT 0x01
#define HAL_SOCK_FLAG_AUTH 0x02
-#define HAL_OP_SOCK_LISTEN 0x01
-struct hal_cmd_sock_listen {
+#define HAL_OP_SOCKET_LISTEN 0x01
+struct hal_cmd_socket_listen {
uint8_t type;
uint8_t name[256];
uint8_t uuid[16];
@@ -247,8 +247,8 @@ struct hal_cmd_sock_listen {
uint8_t flags;
} __attribute__((packed));
-#define HAL_OP_SOCK_CONNECT 0x02
-struct hal_cmd_sock_connect {
+#define HAL_OP_SOCKET_CONNECT 0x02
+struct hal_cmd_socket_connect {
uint8_t bdaddr[6];
uint8_t type;
uint8_t uuid[16];
diff --git a/android/hal-socket.c b/android/hal-socket.c
index ea7d9d8..3688c5f 100644
--- a/android/hal-socket.c
+++ b/android/hal-socket.c
@@ -30,7 +30,7 @@ static bt_status_t socket_listen(btsock_type_t type, const char *service_name,
const uint8_t *uuid, int chan,
int *sock, int flags)
{
- struct hal_cmd_sock_listen cmd;
+ struct hal_cmd_socket_listen cmd;
if (!sock)
return BT_STATUS_PARM_INVALID;
@@ -51,7 +51,7 @@ static bt_status_t socket_listen(btsock_type_t type, const char *service_name,
if (service_name)
memcpy(cmd.name, service_name, strlen(service_name));
- return hal_ipc_cmd(HAL_SERVICE_ID_SOCK, HAL_OP_SOCK_LISTEN,
+ return hal_ipc_cmd(HAL_SERVICE_ID_SOCK, HAL_OP_SOCKET_LISTEN,
sizeof(cmd), &cmd, NULL, NULL, sock);
}
@@ -59,7 +59,7 @@ static bt_status_t socket_connect(const bt_bdaddr_t *bdaddr, btsock_type_t type,
const uint8_t *uuid, int chan,
int *sock, int flags)
{
- struct hal_cmd_sock_connect cmd;
+ struct hal_cmd_socket_connect cmd;
if (!sock)
return BT_STATUS_PARM_INVALID;
@@ -80,7 +80,7 @@ static bt_status_t socket_connect(const bt_bdaddr_t *bdaddr, btsock_type_t type,
if (bdaddr)
memcpy(cmd.bdaddr, bdaddr, sizeof(cmd.bdaddr));
- return hal_ipc_cmd(HAL_SERVICE_ID_SOCK, HAL_OP_SOCK_CONNECT,
+ return hal_ipc_cmd(HAL_SERVICE_ID_SOCK, HAL_OP_SOCKET_CONNECT,
sizeof(cmd), &cmd, NULL, NULL, sock);
}
diff --git a/android/ipc-tester.c b/android/ipc-tester.c
index 1c8a595..246638a 100644
--- a/android/ipc-tester.c
+++ b/android/ipc-tester.c
@@ -1074,21 +1074,21 @@ int main(int argc, char *argv[])
HAL_SERVICE_ID_BLUETOOTH);
/* check for valid data size for SOCK */
- test_datasize_valid("SOCK Listen+", HAL_SERVICE_ID_SOCK,
- HAL_OP_SOCK_LISTEN,
- sizeof(struct hal_cmd_sock_listen), 1,
+ test_datasize_valid("SOCKET Listen+", HAL_SERVICE_ID_SOCK,
+ HAL_OP_SOCKET_LISTEN,
+ sizeof(struct hal_cmd_socket_listen), 1,
HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
- test_datasize_valid("SOCK Listen-", HAL_SERVICE_ID_SOCK,
- HAL_OP_SOCK_LISTEN,
- sizeof(struct hal_cmd_sock_listen), -1,
+ test_datasize_valid("SOCKET Listen-", HAL_SERVICE_ID_SOCK,
+ HAL_OP_SOCKET_LISTEN,
+ sizeof(struct hal_cmd_socket_listen), -1,
HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
- test_datasize_valid("SOCK Connect+", HAL_SERVICE_ID_SOCK,
- HAL_OP_SOCK_CONNECT,
- sizeof(struct hal_cmd_sock_connect), 1,
+ test_datasize_valid("SOCKET Connect+", HAL_SERVICE_ID_SOCK,
+ HAL_OP_SOCKET_CONNECT,
+ sizeof(struct hal_cmd_socket_connect), 1,
HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
- test_datasize_valid("SOCK Connect-", HAL_SERVICE_ID_SOCK,
- HAL_OP_SOCK_CONNECT,
- sizeof(struct hal_cmd_sock_connect), -1,
+ test_datasize_valid("SOCKET Connect-", HAL_SERVICE_ID_SOCK,
+ HAL_OP_SOCKET_CONNECT,
+ sizeof(struct hal_cmd_socket_connect), -1,
HAL_SERVICE_ID_BLUETOOTH, HAL_SERVICE_ID_SOCK);
/* check for valid data size for HID Host */
diff --git a/android/socket.c b/android/socket.c
index 36fffbd..f67dab5 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -841,7 +841,7 @@ failed:
static void handle_listen(const void *buf, uint16_t len)
{
- const struct hal_cmd_sock_listen *cmd = buf;
+ const struct hal_cmd_socket_listen *cmd = buf;
uint8_t status;
int hal_sock;
@@ -862,13 +862,13 @@ static void handle_listen(const void *buf, uint16_t len)
if (status != HAL_STATUS_SUCCESS)
goto failed;
- ipc_send_rsp_full(HAL_SERVICE_ID_SOCK, HAL_OP_SOCK_LISTEN, 0, NULL,
+ ipc_send_rsp_full(HAL_SERVICE_ID_SOCK, HAL_OP_SOCKET_LISTEN, 0, NULL,
hal_sock);
close(hal_sock);
return ;
failed:
- ipc_send_rsp(HAL_SERVICE_ID_SOCK, HAL_OP_SOCK_LISTEN, status);
+ ipc_send_rsp(HAL_SERVICE_ID_SOCK, HAL_OP_SOCKET_LISTEN, status);
}
static bool sock_send_connect(struct rfcomm_sock *rfsock, bdaddr_t *bdaddr)
@@ -1080,7 +1080,7 @@ failed:
static void handle_connect(const void *buf, uint16_t len)
{
- const struct hal_cmd_sock_connect *cmd = buf;
+ const struct hal_cmd_socket_connect *cmd = buf;
bdaddr_t bdaddr;
uint8_t status;
int hal_sock;
@@ -1106,21 +1106,21 @@ static void handle_connect(const void *buf, uint16_t len)
if (status != HAL_STATUS_SUCCESS)
goto failed;
- ipc_send_rsp_full(HAL_SERVICE_ID_SOCK, HAL_OP_SOCK_CONNECT, 0, NULL,
+ ipc_send_rsp_full(HAL_SERVICE_ID_SOCK, HAL_OP_SOCKET_CONNECT, 0, NULL,
hal_sock);
close(hal_sock);
return;
failed:
- ipc_send_rsp(HAL_SERVICE_ID_SOCK, HAL_OP_SOCK_CONNECT, status);
+ ipc_send_rsp(HAL_SERVICE_ID_SOCK, HAL_OP_SOCKET_CONNECT, status);
}
static const struct ipc_handler cmd_handlers[] = {
- /* HAL_OP_SOCK_LISTEN */
- { handle_listen, false, sizeof(struct hal_cmd_sock_listen) },
- /* HAL_OP_SOCK_CONNECT */
- { handle_connect, false, sizeof(struct hal_cmd_sock_connect) },
+ /* HAL_OP_SOCKET_LISTEN */
+ { handle_listen, false, sizeof(struct hal_cmd_socket_listen) },
+ /* HAL_OP_SOCKET_CONNECT */
+ { handle_connect, false, sizeof(struct hal_cmd_socket_connect) },
};
void bt_socket_register(const bdaddr_t *addr)
--
1.8.3.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/5] android/hidhost: Add idle time callback implementation
2014-02-18 10:05 [PATCH 1/5] android/hidhost: Add idle time callback implementation Szymon Janc
` (3 preceding siblings ...)
2014-02-18 10:05 ` [PATCH 5/5] android: Match socket IPC messages types " Szymon Janc
@ 2014-02-19 18:00 ` Szymon Janc
4 siblings, 0 replies; 6+ messages in thread
From: Szymon Janc @ 2014-02-19 18:00 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
On Tuesday 18 February 2014 11:05:20 Szymon Janc wrote:
> Although this callback is for deprecated functionality and
> corresponding notification is never send by daemon it should be
> implemented for library and IPC completeness.
> ---
> android/hal-hidhost.c | 14 ++++++++++++++
> android/hal-ipc-api.txt | 10 ++++++++--
> android/hal-msg.h | 11 +++++++++--
> 3 files changed, 31 insertions(+), 4 deletions(-)
>
> diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c
> index fd3ad2d..dcaf996 100644
> --- a/android/hal-hidhost.c
> +++ b/android/hal-hidhost.c
> @@ -69,6 +69,15 @@ static void handle_proto_mode(void *buf, uint16_t len)
> ev->status, ev->mode);
> }
>
> +static void handle_idle_time(void *buf, uint16_t len)
> +{
> + struct hal_ev_hidhost_idle_time *ev = buf;
> +
> + if (cbacks->idle_time_cb)
> + cbacks->idle_time_cb((bt_bdaddr_t *) ev->bdaddr, ev->status,
> + ev->idle_rate);
> +}
> +
> static void handle_get_report(void *buf, uint16_t len)
> {
> struct hal_ev_hidhost_get_report *ev = buf;
> @@ -110,6 +119,11 @@ static const struct hal_ipc_handler ev_handlers[] = {
> .var_len = false,
> .data_len = sizeof(struct hal_ev_hidhost_proto_mode),
> },
> + { /* HAL_EV_HIDHOST_IDLE_TIME */
> + .handler = handle_idle_time,
> + .var_len = false,
> + .data_len = sizeof(struct hal_ev_hidhost_idle_time),
> + },
> { /* HAL_EV_HIDHOST_GET_REPORT */
> .handler = handle_get_report,
> .var_len = true,
> diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
> index ee3bd76..22dd50d 100644
> --- a/android/hal-ipc-api.txt
> +++ b/android/hal-ipc-api.txt
> @@ -614,14 +614,20 @@ Notifications:
> 0x01 = Boot
> 0xff = Unsupported
>
> - Opcode 0x84 - Get Report notification
> + Opcode 0x84 - Idle Time notification
> +
> + Notification parameters: Remote address (6 octets)
> + Status (1 octet)
> + Idle time (2 octets)
> +
> + Opcode 0x85 - Get Report notification
>
> Notification parameters: Remote address (6 octets)
> Status (1 octet)
> Report length (2 octets)
> Report data (variable)
>
> - Opcode 0x85 - Virtual Unplug notification
> + Opcode 0x86 - Virtual Unplug notification
>
> Notification parameters: Remote address (6 octets)
> Status (1 octet)
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index 6504408..15c7ebe 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -648,7 +648,14 @@ struct hal_ev_hidhost_proto_mode {
> uint8_t mode;
> } __attribute__((packed));
>
> -#define HAL_EV_HIDHOST_GET_REPORT 0x84
> +#define HAL_EV_HIDHOST_IDLE_TIME 0x84
> +struct hal_ev_hidhost_idle_time {
> + uint8_t bdaddr[6];
> + uint8_t status;
> + uint32_t idle_rate;
> +} __attribute__((packed));
> +
> +#define HAL_EV_HIDHOST_GET_REPORT 0x85
> struct hal_ev_hidhost_get_report {
> uint8_t bdaddr[6];
> uint8_t status;
> @@ -656,7 +663,7 @@ struct hal_ev_hidhost_get_report {
> uint8_t data[0];
> } __attribute__((packed));
>
> -#define HAL_EV_HIDHOST_VIRTUAL_UNPLUG 0x85
> +#define HAL_EV_HIDHOST_VIRTUAL_UNPLUG 0x86
> struct hal_ev_hidhost_virtual_unplug {
> uint8_t bdaddr[6];
> uint8_t status;
All five patches are now upstream.
--
Szymon K. Janc
szymon.janc@gmail.com
^ permalink raw reply [flat|nested] 6+ messages in thread