diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c
index 294d1e9..99485d6 100644
--- a/android/hal-handsfree.c
+++ b/android/hal-handsfree.c
}
#endif
-static bt_status_t at_response(bthf_at_response_t response, int error)
+static bt_status_t at_response_real(bthf_at_response_t response, int error,
+ bt_bdaddr_t *bd_addr)
{
struct hal_cmd_handsfree_at_response cmd;
if (!interface_ready())
return BT_STATUS_NOT_READY;
+ if (bd_addr)
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+ memset(&cmd, 0, sizeof(cmd));
+
cmd.response = response;
cmd.error = error;
sizeof(cmd), &cmd, NULL, NULL, NULL);
}
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+static bt_status_t at_response(bthf_at_response_t response, int error,
+ bt_bdaddr_t *bd_addr)
+{
+ return at_response_real(response, error, bd_addr);
+}
+#else
+static bt_status_t at_response(bthf_at_response_t response, int error)
+{
+ return at_response_real(response, error, NULL);
+}
+#endif
+
static bt_status_t clcc_response(int index, bthf_call_direction_t dir,
bthf_call_state_t state,
bthf_call_mode_t mode,
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 44cfe23..1352950 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
Command parameters: Response code (1 octet)
Error code (1 octet)
+ Remote address (6 octets)
Response parameters: <none>
Valid response codes: 0x00 = ERROR
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 5c5ed22..4b3d8b8 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
struct hal_cmd_handsfree_at_response {
uint8_t response;
uint8_t error;
+ uint8_t bdaddr[6];
} __attribute__((packed));
#define HAL_HANDSFREE_CALL_DIRECTION_OUTGOING 0x00
diff --git a/android/handsfree.c b/android/handsfree.c
index 15753bb..c8dfc8f 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
{
const struct hal_cmd_handsfree_at_response *cmd = buf;
struct hf_device *dev;
+ bdaddr_t bdaddr;
uint8_t status;
DBG("");
- dev = find_default_device();
+ android2bdaddr(cmd->bdaddr, &bdaddr);
+
+ dev = find_device(&bdaddr);
if (!dev) {
status = HAL_STATUS_FAILED;
goto done;