diff --git a/android/hal-handsfree.c b/android/hal-handsfree.c
index e5dd8c5..c1d8702 100644
--- a/android/hal-handsfree.c
+++ b/android/hal-handsfree.c
}
#endif
-static bt_status_t volume_control(bthf_volume_type_t type, int volume)
+static bt_status_t volume_control_real(bthf_volume_type_t type, int volume,
+ bt_bdaddr_t *bd_addr)
{
struct hal_cmd_handsfree_volume_control cmd;
if (!interface_ready())
return BT_STATUS_NOT_READY;
+ memset(&cmd, 0, sizeof(cmd));
+
cmd.type = type;
cmd.volume = volume;
+ if (bd_addr)
+ memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
return hal_ipc_cmd(HAL_SERVICE_ID_HANDSFREE,
HAL_OP_HANDSFREE_VOLUME_CONTROL, sizeof(cmd),
&cmd, NULL, NULL, NULL);
}
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+static bt_status_t volume_control(bthf_volume_type_t type, int volume,
+ bt_bdaddr_t *bd_addr)
+{
+ return volume_control_real(type, volume, bd_addr);
+}
+#else
+static bt_status_t volume_control(bthf_volume_type_t type, int volume)
+{
+ return volume_control_real(type, volume, NULL);
+}
+#endif
+
static bt_status_t device_status_notification(bthf_network_state_t state,
bthf_service_type_t type,
int signal, int battery)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index e422529..a4c7777 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
Command parameters: Volume type (1 octet)
Volume (1 octet)
+ Remote address (6 octets)
Response parameters: <none>
Valid volume types: 0x00 = Speaker
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 5d53957..9833451 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
struct hal_cmd_handsfree_volume_control {
uint8_t type;
uint8_t volume;
+ uint8_t bdaddr[6];
} __attribute__((packed));
#define HAL_HANDSFREE_NETWORK_STATE_NOT_AVAILABLE 0x00
diff --git a/android/handsfree.c b/android/handsfree.c
index d31482c..fc6605a 100644
--- a/android/handsfree.c
+++ b/android/handsfree.c
const struct hal_cmd_handsfree_volume_control *cmd = buf;
struct hf_device *dev;
uint8_t status, volume;
+ bdaddr_t bdaddr;
DBG("type=%u volume=%u", cmd->type, cmd->volume);
- dev = find_default_device();
+ android2bdaddr(cmd->bdaddr, &bdaddr);
+
+ dev = find_device(&bdaddr);
if (!dev) {
status = HAL_STATUS_FAILED;
goto done;