Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v3 1/4] android/AVDTP: Make signalling channel priority 6
@ 2014-01-28 17:14 Luiz Augusto von Dentz
  2014-01-28 17:14 ` [PATCH BlueZ v3 2/4] android/AVDTP: Make stream channel priority 5 Luiz Augusto von Dentz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2014-01-28 17:14 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This makes signalling priority 6 so it can push commands before the
stream channel, without this the stream channel may be schedule
first and cause the signalling commands to timeout while waiting a slot.
---
v2: Return error if writes fails since that probably means the socket has been
disconnected, also makes code setting socket to blocking a bit cleaner.
v3: Remove cast as suggested by Marcel, make code setting stream fd to block a
separate function.

 android/avdtp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/android/avdtp.c b/android/avdtp.c
index 4abcd75..e93ff70 100644
--- a/android/avdtp.c
+++ b/android/avdtp.c
@@ -2056,7 +2056,7 @@ struct avdtp *avdtp_new(int fd, size_t imtu, size_t omtu, uint16_t version)
 {
 	struct avdtp *session;
 	GIOCondition cond = G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL;
-	int new_fd;
+	int new_fd, priority;
 
 	new_fd = dup(fd);
 	if (new_fd < 0) {
@@ -2064,6 +2064,14 @@ struct avdtp *avdtp_new(int fd, size_t imtu, size_t omtu, uint16_t version)
 		return NULL;
 	}
 
+	priority = 6;
+	if (setsockopt(new_fd, SOL_SOCKET, SO_PRIORITY, &priority,
+						sizeof(priority)) < 0) {
+		error("setsockopt(SO_PRIORITY): %s (%d)", strerror(errno),
+									errno);
+		return NULL;
+	}
+
 	session = g_new0(struct avdtp, 1);
 	session->io = g_io_channel_unix_new(new_fd);
 	session->version = version;
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-28 23:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28 17:14 [PATCH BlueZ v3 1/4] android/AVDTP: Make signalling channel priority 6 Luiz Augusto von Dentz
2014-01-28 17:14 ` [PATCH BlueZ v3 2/4] android/AVDTP: Make stream channel priority 5 Luiz Augusto von Dentz
2014-01-28 17:14 ` [PATCH BlueZ v3 3/4] android/hal-audio: Fix not handling EINTR errors Luiz Augusto von Dentz
2014-01-28 17:14 ` [PATCH BlueZ v3 4/4] android/hal-audio: Set stream fd to blocking Luiz Augusto von Dentz
2014-01-28 23:33 ` [PATCH BlueZ v3 1/4] android/AVDTP: Make signalling channel priority 6 Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox