* [PATCH] Fix check for valid SCO socket before shutdown
@ 2011-04-01 14:20 Daniel Örstadius
2011-04-04 9:08 ` Luiz Augusto von Dentz
2011-04-05 2:48 ` Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Örstadius @ 2011-04-01 14:20 UTC (permalink / raw)
To: linux-bluetooth
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-Fix-check-for-valid-SCO-socket-before-shutdown.patch --]
[-- Type: text/x-patch, Size: 1258 bytes --]
From 7070265aabd5c497df095e13dfbafe582db70eea Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@nokia.com>
Date: Fri, 1 Apr 2011 16:53:09 +0300
Subject: [PATCH] Fix check for valid SCO socket before shutdown
To prevent a crash in the event that there is a request to remove
the audio connection when it has already been disconnected by the
remote.
Set headset state to connected directly if there is no SCO socket.
---
audio/headset.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/audio/headset.c b/audio/headset.c
index dff10d1..c605e9d 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -2397,10 +2397,16 @@ unsigned int headset_suspend_stream(struct audio_device *dev,
hs->dc_timer = 0;
}
- sock = g_io_channel_unix_get_fd(hs->sco);
+ if (hs->sco) {
+ sock = g_io_channel_unix_get_fd(hs->sco);
- /* shutdown but leave the socket open and wait for hup */
- shutdown(sock, SHUT_RDWR);
+ /* shutdown but leave the socket open and wait for hup */
+ shutdown(sock, SHUT_RDWR);
+ } else {
+ headset_set_state(dev, HEADSET_STATE_CONNECTED);
+
+ g_idle_add((GSourceFunc) dummy_connect_complete, dev);
+ }
id = connect_cb_new(hs, HEADSET_STATE_CONNECTED, cb, user_data);
--
1.6.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Fix check for valid SCO socket before shutdown
2011-04-01 14:20 [PATCH] Fix check for valid SCO socket before shutdown Daniel Örstadius
@ 2011-04-04 9:08 ` Luiz Augusto von Dentz
2011-04-05 2:48 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2011-04-04 9:08 UTC (permalink / raw)
To: Daniel Örstadius; +Cc: linux-bluetooth
Hi,
On Fri, Apr 1, 2011 at 5:20 PM, Daniel Örstadius
<daniel.orstadius@gmail.com> wrote:
>
>
Ack, this is actually a regression create by commit
d3f69537a46b1050d2415ca4afcdedba967096e8
--
Luiz Augusto von Dentz
Computer Engineer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix check for valid SCO socket before shutdown
2011-04-01 14:20 [PATCH] Fix check for valid SCO socket before shutdown Daniel Örstadius
2011-04-04 9:08 ` Luiz Augusto von Dentz
@ 2011-04-05 2:48 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2011-04-05 2:48 UTC (permalink / raw)
To: Daniel Örstadius; +Cc: linux-bluetooth
Hi Daniel,
On Fri, Apr 01, 2011, Daniel Örstadius wrote:
> To prevent a crash in the event that there is a request to remove
> the audio connection when it has already been disconnected by the
> remote.
>
> Set headset state to connected directly if there is no SCO socket.
> ---
> audio/headset.c | 12 +++++++++---
> 1 files changed, 9 insertions(+), 3 deletions(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-05 2:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-01 14:20 [PATCH] Fix check for valid SCO socket before shutdown Daniel Örstadius
2011-04-04 9:08 ` Luiz Augusto von Dentz
2011-04-05 2:48 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox