linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] audio: returns error if poll_revents failed.
@ 2012-06-30  4:29 Vic Lee
  2012-07-02 21:51 ` Lucas De Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: Vic Lee @ 2012-06-30  4:29 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: 0001-audio-returns-error-if-poll_revents-failed.patch --]
[-- Type: text/x-patch, Size: 1343 bytes --]

>From a79537c26867fd92f32e77a6fe59bf0e1dd61c11 Mon Sep 17 00:00:00 2001
From: Vic Lee <llyzs@163.com>
Date: Sat, 30 Jun 2012 20:16:18 +0800
Subject: [PATCH] audio: returns error if poll_revents failed.

Error must be reported back to ALSA if poll_revents failed. Otherwise,
when the bluetooth audio device is disconnected during playback, ALSA
will enter in an infinite loop, bluez will keep printing "read error",
and application freezes.

Signed-off-by: Vic Lee <llyzs@163.com>
---
 audio/pcm_bluetooth.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index b9da805..ca5ff11 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
@@ -821,6 +821,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
 					unsigned short *revents)
 {
 	static char buf[1];
+	int err = 0;
 
 	DBG("");
 
@@ -832,14 +833,17 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
 
 	if (io->state != SND_PCM_STATE_PREPARED)
 		if (read(pfds[0].fd, buf, 1) < 0)
+		{
 			SYSERR("read error: %s (%d)", strerror(errno), errno);
+			err = -1;
+		}
 
 	if (pfds[1].revents & (POLLERR | POLLHUP | POLLNVAL))
 		io->state = SND_PCM_STATE_DISCONNECTED;
 
 	*revents = (pfds[0].revents & POLLIN) ? POLLOUT : 0;
 
-	return 0;
+	return err;
 }
 
 
-- 
1.7.10


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

* Re: [PATCH] audio: returns error if poll_revents failed.
  2012-06-30  4:29 [PATCH] audio: returns error if poll_revents failed Vic Lee
@ 2012-07-02 21:51 ` Lucas De Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas De Marchi @ 2012-07-02 21:51 UTC (permalink / raw)
  To: Vic Lee; +Cc: linux-bluetooth

Hi Vic

On Sat, Jun 30, 2012 at 1:29 AM, Vic Lee <llyzs.vic@gmail.com> wrote:
>


First of all, please use git-sendemail for next patches.

This file was just removed from the tree, so there's no need for this
patch anymore.


Lucas De Marchi

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

end of thread, other threads:[~2012-07-02 21:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-30  4:29 [PATCH] audio: returns error if poll_revents failed Vic Lee
2012-07-02 21:51 ` Lucas De Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).