From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 4/4] android/hal-audio: Set stream fd to blocking
Date: Mon, 27 Jan 2014 15:41:50 -0800 [thread overview]
Message-ID: <1390866110-16184-4-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1390866110-16184-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes the stream to block on io operation so it does not return
EAGAIN on syscall such as write.
---
android/hal-audio.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/android/hal-audio.c b/android/hal-audio.c
index 8a0737b..103e174 100644
--- a/android/hal-audio.c
+++ b/android/hal-audio.c
@@ -25,6 +25,7 @@
#include <sys/un.h>
#include <unistd.h>
#include <arpa/inet.h>
+#include <fcntl.h>
#include <hardware/audio.h>
#include <hardware/hardware.h>
@@ -1159,8 +1160,13 @@ static int audio_open_output_stream(struct audio_hw_device *dev,
if (!preset || fd < 0)
goto fail;
- out->ep->fd = fd;
+ if (fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK) < 0) {
+ error("fcntl(F_SETFL, ~O_NONBLOCK): %s (%d)", strerror(errno),
+ errno);
+ goto fail;
+ }
+ out->ep->fd = fd;
codec = out->ep->codec;
codec->init(preset, mtu, &out->ep->codec_data);
--
1.8.4.2
prev parent reply other threads:[~2014-01-27 23:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-27 23:41 [PATCH BlueZ 1/4] android/AVDTP: Make signalling channel priority 6 Luiz Augusto von Dentz
2014-01-27 23:41 ` [PATCH BlueZ 2/4] android/AVDTP: Make stream channel priority 5 Luiz Augusto von Dentz
2014-01-27 23:41 ` [PATCH BlueZ 3/4] android/hal-audio: Fix not handling EINTR errors Luiz Augusto von Dentz
2014-01-27 23:41 ` Luiz Augusto von Dentz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1390866110-16184-4-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox