Skip to contentSkip to conversation

android/ipc: Add initial code for audio IPC

PATCH New Luiz Augusto von Dentz 1 participant 10 messages Jan 7, 2014 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v3 1/10 android/ipc: Add initial code for audio IPC

From: Luiz Augusto von Dentz <[email protected]>

This add initial code for listen and accept connections on the abstract socket defined for the audio IPC.
---
v2: Split audio IPC services for HAL services and fix invalid messages or disconnections causing the daemon to exit. The audio HAL is independent of bluetooth and should only affect A2DP service.
v3: Split audio IPC related functions to separate files (audio-ipc.{c,h}), please disregard git thinking there is a copy of hdp code because they are similar.

 android/Android.mk                                 |   1 +
 android/Makefile.am                                |   2 +
 android/audio-ipc.c                                | 104 +++++++++++++++++++++
 .../health/hdp_manager.h => android/audio-ipc.h    |   7 +-
 monitor/analyze.h => android/audio-msg.h           |   7 +-
 android/ipc.c                                      |  14 +--
 android/ipc.h                                      |   1 +
 7 files changed, 124 insertions(+), 12 deletions(-)
 create mode 100644 android/audio-ipc.c
 copy profiles/health/hdp_manager.h => android/audio-ipc.h (86%)
 copy monitor/analyze.h => android/audio-msg.h (83%)
android/Android.mk +1 -0
index 7d9cc4f..27631cc 100644
@@ -26,6 +26,7 @@ LOCAL_SRC_FILES := \
 	hidhost.c \
 	socket.c \
 	ipc.c ipc.h \
+	audio-ipc.c audio-ipc.h \
 	avdtp.c \
 	a2dp.c \
 	pan.c \
android/Makefile.am +2 -0
index 7d9b580..8810369 100644
@@ -15,6 +15,7 @@ noinst_PROGRAMS += android/bluetoothd
 android_bluetoothd_SOURCES = android/main.c \
 				src/log.c \
 				android/hal-msg.h \
+				android/audio-msg.h \
 				android/utils.h \
 				src/sdpd-database.c src/sdpd-server.c \
 				src/sdpd-service.c src/sdpd-request.c \
@@ -25,6 +26,7 @@ android_bluetoothd_SOURCES = android/main.c \
 				android/bluetooth.h android/bluetooth.c \
 				android/hidhost.h android/hidhost.c \
 				android/ipc.h android/ipc.c \
+				android/audio-ipc.h android/audio-ipc.c \
 				android/avdtp.h android/avdtp.c \
 				android/a2dp.h android/a2dp.c \
 				android/socket.h android/socket.c \
android/audio-ipc.c new file +104 -0

104 lines not on this page · raw message

android/audio-ipc.h renamed from profiles/health/hdp_manager.h +4 -3
similarity index 86%
copy from profiles/health/hdp_manager.h
copy to android/audio-ipc.h
index 1cab4d0..769bfd6 100644
@@ -2,7 +2,8 @@
  *
  *  BlueZ - Bluetooth protocol stack for Linux
  *
- *  Copyright (C) 2010 GSyC/LibreSoft, Universidad Rey Juan Carlos.
+ *  Copyright (C) 2014  Intel Corporation. All rights reserved.
+ *
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -20,5 +21,5 @@
  *
  */
 
-int hdp_manager_init(void);
-void hdp_manager_exit(void);
+void audio_ipc_init(void);
+void audio_ipc_cleanup(void);
android/audio-msg.h renamed from monitor/analyze.h +4 -3
similarity index 83%
copy from monitor/analyze.h
copy to android/audio-msg.h
index 7cdda51..d5b4099 100644
@@ -2,8 +2,7 @@
  *
  *  BlueZ - Bluetooth protocol stack for Linux
  *
- *  Copyright (C) 2011-2012  Intel Corporation
- *  Copyright (C) 2004-2010  Marcel Holtmann <[email protected]>
+ *  Copyright (C) 2014  Intel Corporation. All rights reserved.
  *
  *
  *  This library is free software; you can redistribute it and/or
@@ -22,4 +21,6 @@
  *
  */
 
-void analyze_trace(const char *path);
+#define BLUEZ_AUDIO_MTU 1024
+
+static const char BLUEZ_AUDIO_SK_PATH[] = "\0bluez_audio_socket";
android/ipc.c +8 -6
index 9e8ccc3..8a91248 100644
@@ -145,7 +145,7 @@ static gboolean notif_watch_cb(GIOChannel *io, GIOCondition cond,
 	return FALSE;
 }
 
-static GIOChannel *connect_hal(GIOFunc connect_cb)
+GIOChannel *ipc_connect(const char *path, size_t size, GIOFunc connect_cb)
 {
 	struct sockaddr_un addr;
 	GIOCondition cond;
@@ -167,11 +167,11 @@ static GIOChannel *connect_hal(GIOFunc connect_cb)
 	memset(&addr, 0, sizeof(addr));
 	addr.sun_family = AF_UNIX;
 
-	memcpy(addr.sun_path, BLUEZ_HAL_SK_PATH, sizeof(BLUEZ_HAL_SK_PATH));
+	memcpy(addr.sun_path, path, size);
 
 	if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
-		error("IPC: failed to connect HAL socket: %d (%s)", errno,
-							strerror(errno));
+		error("IPC: failed to connect HAL socket %s: %d (%s)", &path[1],
+							errno, strerror(errno));
 		g_io_channel_unref(io);
 		return NULL;
 	}
@@ -218,7 +218,8 @@ static gboolean cmd_connect_cb(GIOChannel *io, GIOCondition cond,
 		return FALSE;
 	}
 
-	notif_io = connect_hal(notif_connect_cb);
+	notif_io = ipc_connect(BLUEZ_HAL_SK_PATH, sizeof(BLUEZ_HAL_SK_PATH),
+							notif_connect_cb);
 	if (!notif_io)
 		raise(SIGTERM);
 
@@ -227,7 +228,8 @@ static gboolean cmd_connect_cb(GIOChannel *io, GIOCondition cond,
 
 void ipc_init(void)
 {
-	cmd_io = connect_hal(cmd_connect_cb);
+	cmd_io = ipc_connect(BLUEZ_HAL_SK_PATH, sizeof(BLUEZ_HAL_SK_PATH),
+							cmd_connect_cb);
 	if (!cmd_io)
 		raise(SIGTERM);
 }
android/ipc.h +1 -0
index 6cd102b..02ad6bb 100644
@@ -28,6 +28,7 @@ struct ipc_handler {
 };
 void ipc_init(void);
 void ipc_cleanup(void);
+GIOChannel *ipc_connect(const char *path, size_t size, GIOFunc connect_cb);
 
 void ipc_send_rsp(uint8_t service_id, uint8_t opcode, uint8_t status);
 void ipc_send_rsp_full(uint8_t service_id, uint8_t opcode, uint16_t len,
Signature · 1 line
1.8.4.2
author maintainer
#1 lore raw

PATCH v3 2/10 android/ipc: Add message handling for audio IPC

From: Luiz Augusto von Dentz <[email protected]>

This adds audio_ipc_register and audio_ipc_unregister and adapt ipc_handle_msg to be able to handle audio services messages.

---
 android/audio-ipc.c | 23 +++++++++++++++++++-
 android/audio-ipc.h |  3 +++
 android/audio-msg.h |  2 ++
 android/ipc.c       | 60 +++++++++++++++++++++++++----------------------------
 android/ipc.h       |  8 +++++++
 5 files changed, 63 insertions(+), 33 deletions(-)
android/audio-ipc.c +22 -1
index b537f21..0c5433a 100644
@@ -41,12 +41,14 @@
 
 static GIOChannel *audio_io = NULL;
 
+static struct service_handler service;
+
 static gboolean audio_watch_cb(GIOChannel *io, GIOCondition cond,
 							gpointer user_data)
 {
 	char buf[BLUEZ_AUDIO_MTU];
 	ssize_t ret;
-	int fd;
+	int fd, err;
 
 	if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
 		info("Audio IPC: command socket closed");
@@ -61,6 +63,13 @@ static gboolean audio_watch_cb(GIOChannel *io, GIOCondition cond,
 		goto fail;
 	}
 
+	err = ipc_handle_msg(&service, AUDIO_SERVICE_ID, buf, ret);
+	if (err < 0) {
+		error("Audio IPC: failed to handle message (%s)",
+							strerror(-err));
+		goto fail;
+	}
+
 	return TRUE;
 
 fail:
@@ -102,3 +111,15 @@ void audio_ipc_cleanup(void)
 		audio_io = NULL;
 	}
 }
+
+void audio_ipc_register(const struct ipc_handler *handlers, uint8_t size)
+{
+	service.handler = handlers;
+	service.size = size;
+}
+
+void audio_ipc_unregister(void)
+{
+	service.handler = NULL;
+	service.size = 0;
+}
android/audio-ipc.h +3 -0
index 769bfd6..1dfa245 100644
@@ -23,3 +23,6 @@
 
 void audio_ipc_init(void);
 void audio_ipc_cleanup(void);
+
+void audio_ipc_register(const struct ipc_handler *handlers, uint8_t size);
+void audio_ipc_unregister(void);
android/audio-msg.h +2 -0
index d5b4099..1ec2520 100644
@@ -24,3 +24,5 @@
 #define BLUEZ_AUDIO_MTU 1024
 
 static const char BLUEZ_AUDIO_SK_PATH[] = "\0bluez_audio_socket";
+
+#define AUDIO_SERVICE_ID		0
android/ipc.c +28 -32

111 lines not on this page · raw message

android/ipc.h +8 -0
index 02ad6bb..7b8bdeb 100644
@@ -26,9 +26,17 @@ struct ipc_handler {
 	bool var_len;
 	size_t data_len;
 };
+
+struct service_handler {
+	const struct ipc_handler *handler;
+	uint8_t size;
+};
+
 void ipc_init(void);
 void ipc_cleanup(void);
 GIOChannel *ipc_connect(const char *path, size_t size, GIOFunc connect_cb);
+int ipc_handle_msg(struct service_handler *handlers, size_t max_index,
+						const void *buf, ssize_t len);
 
 void ipc_send_rsp(uint8_t service_id, uint8_t opcode, uint8_t status);
 void ipc_send_rsp_full(uint8_t service_id, uint8_t opcode, uint16_t len,
Signature · 1 line
1.8.4.2
author maintainer
#2 lore raw

PATCH v3 3/10 android/ipc: Add audio_ipc_send_rsp and audio_ipc_send_rsp_full

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

These functions can be used to respond to commands recieved over audio IPC.

---
 android/audio-ipc.c | 23 +++++++++++++++++++++++
 android/audio-ipc.h |  3 +++
 android/audio-msg.h |  8 ++++++++
 android/ipc.c       |  2 +-
 android/ipc.h       |  2 ++
 5 files changed, 37 insertions(+), 1 deletion(-)
android/audio-ipc.c +23 -0
index 0c5433a..f4b55e3 100644
@@ -123,3 +123,26 @@ void audio_ipc_unregister(void)
 	service.handler = NULL;
 	service.size = 0;
 }
+
+void audio_ipc_send_rsp(uint8_t opcode, uint8_t status)
+{
+	struct audio_status s;
+	int sk;
+
+	sk = g_io_channel_unix_get_fd(audio_io);
+
+	if (status == AUDIO_STATUS_SUCCESS) {
+		ipc_send(sk, AUDIO_SERVICE_ID, opcode, 0, NULL, -1);
+		return;
+	}
+
+	s.code = status;
+
+	ipc_send(sk, AUDIO_SERVICE_ID, AUDIO_OP_STATUS, sizeof(s), &s, -1);
+}
+
+void audio_ipc_send_rsp_full(uint8_t opcode, uint16_t len, void *param, int fd)
+{
+	ipc_send(g_io_channel_unix_get_fd(audio_io), AUDIO_SERVICE_ID, opcode,
+							len, param, fd);
+}
android/audio-ipc.h +3 -0
index 1dfa245..0b5f216 100644
@@ -26,3 +26,6 @@ void audio_ipc_cleanup(void);
 
 void audio_ipc_register(const struct ipc_handler *handlers, uint8_t size);
 void audio_ipc_unregister(void);
+
+void audio_ipc_send_rsp(uint8_t opcode, uint8_t status);
+void audio_ipc_send_rsp_full(uint8_t opcode, uint16_t len, void *param, int fd);
android/audio-msg.h +8 -0
index 1ec2520..ae8a168 100644
@@ -26,3 +26,11 @@
 static const char BLUEZ_AUDIO_SK_PATH[] = "\0bluez_audio_socket";
 
 #define AUDIO_SERVICE_ID		0
+
+#define AUDIO_STATUS_SUCCESS		0x00
+#define AUDIO_STATUS_FAILED		0x01
+
+#define AUDIO_OP_STATUS			0x00
+struct audio_status {
+	uint8_t code;
+} __attribute__((packed));
android/ipc.c +1 -1
index 1499962..03bdc35 100644
@@ -245,7 +245,7 @@ void ipc_cleanup(void)
 	}
 }
 
-static void ipc_send(int sk, uint8_t service_id, uint8_t opcode, uint16_t len,
+void ipc_send(int sk, uint8_t service_id, uint8_t opcode, uint16_t len,
 							void *param, int fd)
 {
 	struct msghdr msg;
android/ipc.h +2 -0
index 7b8bdeb..b1cc5c5 100644
@@ -43,6 +43,8 @@ void ipc_send_rsp_full(uint8_t service_id, uint8_t opcode, uint16_t len,
 							void *param, int fd);
 void ipc_send_notif(uint8_t service_id, uint8_t opcode,  uint16_t len,
 								void *param);
+void ipc_send(int sk, uint8_t service_id, uint8_t opcode, uint16_t len,
+							void *param, int fd);
 void ipc_register(uint8_t service, const struct ipc_handler *handlers,
 								uint8_t size);
 void ipc_unregister(uint8_t service);
Signature · 1 line
1.8.4.2
author maintainer
#3 lore raw

PATCH v3 4/10 android/A2DP: Add initial code to handle audio IPC commands

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds initial code to handle audio IPC commands.

---
 android/a2dp.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
android/a2dp.c +13 -1
index 581d094..c12d8f1 100644
@@ -44,6 +44,8 @@
 #include "utils.h"
 #include "bluetooth.h"
 #include "avdtp.h"
+#include "audio-msg.h"
+#include "audio-ipc.h"
 
 #define L2CAP_PSM_AVDTP 0x19
 #define SVC_HINT_CAPTURING 0x08
@@ -352,6 +354,9 @@ static sdp_record_t *a2dp_record(void)
 	return record;
 }
 
+static const struct ipc_handler audio_handlers[] = {
+};
+
 bool bt_a2dp_register(const bdaddr_t *addr)
 {
 	GError *err = NULL;
@@ -359,6 +364,8 @@ bool bt_a2dp_register(const bdaddr_t *addr)
 
 	DBG("");
 
+	audio_ipc_init();
+
 	bacpy(&adapter_addr, addr);
 
 	server = bt_io_listen(connect_cb, NULL, NULL, NULL, &err,
@@ -388,6 +395,8 @@ bool bt_a2dp_register(const bdaddr_t *addr)
 	ipc_register(HAL_SERVICE_ID_A2DP, cmd_handlers,
 						G_N_ELEMENTS(cmd_handlers));
 
+	audio_ipc_register(audio_handlers, G_N_ELEMENTS(audio_handlers));
+
 	return true;
 
 fail:
@@ -411,8 +420,9 @@ void bt_a2dp_unregister(void)
 	g_slist_foreach(devices, a2dp_device_disconnected, NULL);
 	devices = NULL;
 
-
 	ipc_unregister(HAL_SERVICE_ID_A2DP);
+	audio_ipc_unregister();
+
 	bt_adapter_remove_record(record_id);
 	record_id = 0;
 
@@ -421,4 +431,6 @@ void bt_a2dp_unregister(void)
 		g_io_channel_unref(server);
 		server = NULL;
 	}
+
+	audio_ipc_cleanup();
 }
Signature · 1 line
1.8.4.2
author maintainer
#4 lore raw

PATCH v3 5/10 android/A2DP: Add audio open command/response struct

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds the definitions to audio open command and response.

---
 android/a2dp.c            |  9 +++++++++
 android/audio-ipc-api.txt |  2 +-
 android/audio-msg.h       | 18 ++++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)
android/a2dp.c +9 -0
index c12d8f1..38384f6 100644
@@ -354,7 +354,16 @@ static sdp_record_t *a2dp_record(void)
 	return record;
 }
 
+static void bt_audio_open(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	audio_ipc_send_rsp(AUDIO_OP_OPEN, AUDIO_STATUS_FAILED);
+}
+
 static const struct ipc_handler audio_handlers[] = {
+	/* AUDIO_OP_OPEN */
+	{ bt_audio_open, true, sizeof(struct audio_cmd_open) },
 };
 
 bool bt_a2dp_register(const bdaddr_t *addr)
android/audio-ipc-api.txt +1 -1
index 1c42800..37a1569 100644
@@ -49,9 +49,9 @@ Identifier: "audio" (BT_AUDIO_ID)
 
 		Command parameters: Service UUID (16 octets)
 				    Codec ID (1 octet)
+				    Number of codec presets (1 octet)
 				    Codec capabilities length (1 octet)
 				    Codec capabilities (variable)
-				    Number of codec presets (1 octet)
 				    Codec preset # length (1 octet)
 				    Codec preset # configuration (variable)
 				    ...
android/audio-msg.h +18 -0
index ae8a168..158a2ab 100644
@@ -34,3 +34,21 @@ static const char BLUEZ_AUDIO_SK_PATH[] = "\0bluez_audio_socket";
 struct audio_status {
 	uint8_t code;
 } __attribute__((packed));
+
+#define AUDIO_OP_OPEN			0x01
+struct audio_preset {
+	uint8_t len;
+	uint8_t data[0];
+} __attribute__((packed));
+
+struct audio_cmd_open {
+	uint16_t uuid;
+	uint8_t codec;
+	uint8_t presets;
+	uint8_t len;
+	struct audio_preset preset[0];
+} __attribute__((packed));
+
+struct audio_rsp_open {
+	uint8_t id;
+} __attribute__((packed));
Signature · 1 line
1.8.4.2
author maintainer
#5 lore raw

PATCH v3 6/10 android/A2DP: Add audio close command/response struct

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds the definitions to audio close command and response.

---
 android/a2dp.c      | 9 +++++++++
 android/audio-msg.h | 5 +++++
 2 files changed, 14 insertions(+)
android/a2dp.c +9 -0
index 38384f6..97e2778 100644
@@ -361,9 +361,18 @@ static void bt_audio_open(const void *buf, uint16_t len)
 	audio_ipc_send_rsp(AUDIO_OP_OPEN, AUDIO_STATUS_FAILED);
 }
 
+static void bt_audio_close(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	audio_ipc_send_rsp(AUDIO_OP_CLOSE, HAL_STATUS_FAILED);
+}
+
 static const struct ipc_handler audio_handlers[] = {
 	/* AUDIO_OP_OPEN */
 	{ bt_audio_open, true, sizeof(struct audio_cmd_open) },
+	/* AUDIO_OP_CLOSE */
+	{ bt_audio_close, false, sizeof(struct audio_cmd_close) },
 };
 
 bool bt_a2dp_register(const bdaddr_t *addr)
android/audio-msg.h +5 -0
index 158a2ab..6ac1fff 100644
@@ -52,3 +52,8 @@ struct audio_cmd_open {
 struct audio_rsp_open {
 	uint8_t id;
 } __attribute__((packed));
+
+#define AUDIO_OP_CLOSE			0x02
+struct audio_cmd_close {
+	uint8_t id;
+} __attribute__((packed));
Signature · 1 line
1.8.4.2
author maintainer
#6 lore raw

PATCH v3 7/10 android/A2DP: Add stream open command/response struct

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds the definitions to stream open command and response.

---
 android/a2dp.c      |  9 +++++++++
 android/audio-msg.h | 10 ++++++++++
 2 files changed, 19 insertions(+)
android/a2dp.c +9 -0
index 97e2778..09a65e1 100644
@@ -368,11 +368,20 @@ static void bt_audio_close(const void *buf, uint16_t len)
 	audio_ipc_send_rsp(AUDIO_OP_CLOSE, HAL_STATUS_FAILED);
 }
 
+static void bt_stream_open(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	audio_ipc_send_rsp(AUDIO_OP_OPEN_STREAM, AUDIO_STATUS_FAILED);
+}
+
 static const struct ipc_handler audio_handlers[] = {
 	/* AUDIO_OP_OPEN */
 	{ bt_audio_open, true, sizeof(struct audio_cmd_open) },
 	/* AUDIO_OP_CLOSE */
 	{ bt_audio_close, false, sizeof(struct audio_cmd_close) },
+	/* AUDIO_OP_OPEN_STREAM */
+	{ bt_stream_open, false, sizeof(struct audio_cmd_open_stream) },
 };
 
 bool bt_a2dp_register(const bdaddr_t *addr)
android/audio-msg.h +10 -0
index 6ac1fff..0f0309a 100644
@@ -57,3 +57,13 @@ struct audio_rsp_open {
 struct audio_cmd_close {
 	uint8_t id;
 } __attribute__((packed));
+
+#define AUDIO_OP_OPEN_STREAM		0x03
+struct audio_cmd_open_stream {
+	uint8_t id;
+} __attribute__((packed));
+
+struct audio_rsp_open_stream {
+	uint8_t len;
+	uint8_t data[0];
+} __attribute__((packed));
Signature · 1 line
1.8.4.2
author maintainer
#7 lore raw

PATCH v3 8/10 android/A2DP: Add stream close command/response struct

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds the definitions to stream close command and response.

---
 android/a2dp.c      | 9 +++++++++
 android/audio-msg.h | 5 +++++
 2 files changed, 14 insertions(+)
android/a2dp.c +9 -0
index 09a65e1..7c49bc9 100644
@@ -375,6 +375,13 @@ static void bt_stream_open(const void *buf, uint16_t len)
 	audio_ipc_send_rsp(AUDIO_OP_OPEN_STREAM, AUDIO_STATUS_FAILED);
 }
 
+static void bt_stream_close(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	audio_ipc_send_rsp(AUDIO_OP_CLOSE_STREAM, AUDIO_STATUS_FAILED);
+}
+
 static const struct ipc_handler audio_handlers[] = {
 	/* AUDIO_OP_OPEN */
 	{ bt_audio_open, true, sizeof(struct audio_cmd_open) },
@@ -382,6 +389,8 @@ static const struct ipc_handler audio_handlers[] = {
 	{ bt_audio_close, false, sizeof(struct audio_cmd_close) },
 	/* AUDIO_OP_OPEN_STREAM */
 	{ bt_stream_open, false, sizeof(struct audio_cmd_open_stream) },
+	/* AUDIO_OP_CLOSE_STREAM */
+	{ bt_stream_close, false, sizeof(struct audio_cmd_close_stream) },
 };
 
 bool bt_a2dp_register(const bdaddr_t *addr)
android/audio-msg.h +5 -0
index 0f0309a..4dfa8cf 100644
@@ -67,3 +67,8 @@ struct audio_rsp_open_stream {
 	uint8_t len;
 	uint8_t data[0];
 } __attribute__((packed));
+
+#define AUDIO_OP_CLOSE_STREAM		0x04
+struct audio_cmd_close_stream {
+	uint8_t id;
+} __attribute__((packed));
Signature · 1 line
1.8.4.2
author maintainer
#8 lore raw

PATCH v3 9/10 android/A2DP: Add stream resume command/response struct

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds the definitions to stream resume command and response.

---
 android/a2dp.c      | 9 +++++++++
 android/audio-msg.h | 5 +++++
 2 files changed, 14 insertions(+)
android/a2dp.c +9 -0
index 7c49bc9..5d540f3 100644
@@ -382,6 +382,13 @@ static void bt_stream_close(const void *buf, uint16_t len)
 	audio_ipc_send_rsp(AUDIO_OP_CLOSE_STREAM, AUDIO_STATUS_FAILED);
 }
 
+static void bt_stream_resume(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	audio_ipc_send_rsp(AUDIO_OP_RESUME_STREAM, AUDIO_STATUS_FAILED);
+}
+
 static const struct ipc_handler audio_handlers[] = {
 	/* AUDIO_OP_OPEN */
 	{ bt_audio_open, true, sizeof(struct audio_cmd_open) },
@@ -391,6 +398,8 @@ static const struct ipc_handler audio_handlers[] = {
 	{ bt_stream_open, false, sizeof(struct audio_cmd_open_stream) },
 	/* AUDIO_OP_CLOSE_STREAM */
 	{ bt_stream_close, false, sizeof(struct audio_cmd_close_stream) },
+	/* AUDIO_OP_RESUME_STREAM */
+	{ bt_stream_resume, false, sizeof(struct audio_cmd_resume_stream) },
 };
 
 bool bt_a2dp_register(const bdaddr_t *addr)
android/audio-msg.h +5 -0
index 4dfa8cf..8f92413 100644
@@ -72,3 +72,8 @@ struct audio_rsp_open_stream {
 struct audio_cmd_close_stream {
 	uint8_t id;
 } __attribute__((packed));
+
+#define AUDIO_OP_RESUME_STREAM		0x05
+struct audio_cmd_resume_stream {
+	uint8_t id;
+} __attribute__((packed));
Signature · 1 line
1.8.4.2
author maintainer
#9 lore raw

PATCH v3 10/10 android/A2DP: Add stream suspend command/response struct

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds the definitions to stream suspend command and response.

---
 android/a2dp.c      | 9 +++++++++
 android/audio-msg.h | 5 +++++
 2 files changed, 14 insertions(+)
android/a2dp.c +9 -0
index 5d540f3..b59c53d 100644
@@ -389,6 +389,13 @@ static void bt_stream_resume(const void *buf, uint16_t len)
 	audio_ipc_send_rsp(AUDIO_OP_RESUME_STREAM, AUDIO_STATUS_FAILED);
 }
 
+static void bt_stream_suspend(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+
+	audio_ipc_send_rsp(AUDIO_OP_SUSPEND_STREAM, AUDIO_STATUS_FAILED);
+}
+
 static const struct ipc_handler audio_handlers[] = {
 	/* AUDIO_OP_OPEN */
 	{ bt_audio_open, true, sizeof(struct audio_cmd_open) },
@@ -400,6 +407,8 @@ static const struct ipc_handler audio_handlers[] = {
 	{ bt_stream_close, false, sizeof(struct audio_cmd_close_stream) },
 	/* AUDIO_OP_RESUME_STREAM */
 	{ bt_stream_resume, false, sizeof(struct audio_cmd_resume_stream) },
+	/* AUDIO_OP_SUSPEND_STREAM */
+	{ bt_stream_suspend, false, sizeof(struct audio_cmd_suspend_stream) },
 };
 
 bool bt_a2dp_register(const bdaddr_t *addr)
android/audio-msg.h +5 -0
index 8f92413..438bc18 100644
@@ -77,3 +77,8 @@ struct audio_cmd_close_stream {
 struct audio_cmd_resume_stream {
 	uint8_t id;
 } __attribute__((packed));
+
+#define AUDIO_OP_SUSPEND_STREAM		0x06
+struct audio_cmd_suspend_stream {
+	uint8_t id;
+} __attribute__((packed));
Signature · 1 line
1.8.4.2