* [PATCH] Fix error message when getting SCO connection handle
@ 2011-03-24 12:09 Luiz Augusto von Dentz
2011-03-24 12:09 ` [PATCH] Wait SCO socket to HUP before changing state Luiz Augusto von Dentz
2011-03-25 9:11 ` [PATCH] Fix error message when getting SCO connection handle Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2011-03-24 12:09 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
Error message should indicate the transport correctly which is SCO
not RFCOMM.
---
btio/btio.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/btio/btio.c b/btio/btio.c
index d8439e0..3f5b69a 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -1020,14 +1020,14 @@ static gboolean sco_get(int sock, GError **err, BtIOOption opt1, va_list args)
break;
case BT_IO_OPT_HANDLE:
if (sco_get_info(sock, &handle, dev_class) < 0) {
- ERROR_FAILED(err, "RFCOMM_CONNINFO", errno);
+ ERROR_FAILED(err, "SCO_CONNINFO", errno);
return FALSE;
}
*(va_arg(args, uint16_t *)) = handle;
break;
case BT_IO_OPT_CLASS:
if (sco_get_info(sock, &handle, dev_class) < 0) {
- ERROR_FAILED(err, "RFCOMM_CONNINFO", errno);
+ ERROR_FAILED(err, "SCO_CONNINFO", errno);
return FALSE;
}
memcpy(va_arg(args, uint8_t *), dev_class, 3);
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH] Wait SCO socket to HUP before changing state
2011-03-24 12:09 [PATCH] Fix error message when getting SCO connection handle Luiz Augusto von Dentz
@ 2011-03-24 12:09 ` Luiz Augusto von Dentz
2011-03-25 9:11 ` [PATCH] Fix error message when getting SCO connection handle Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2011-03-24 12:09 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
In situations where application wants to switch profiles e.g hfp to a2dp
it normally needs to wait SCO to be disconnected to resume a2dp due to
resource limitations on headset.
There seems to be an issue in the kernel side which prevent this to work
properly, apparently shutdown does not wait the link to be disconnected,
but it is under investigation.
---
audio/headset.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/audio/headset.c b/audio/headset.c
index bdaa8da..dff10d1 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -1345,6 +1345,7 @@ static gboolean sco_cb(GIOChannel *chan, GIOCondition cond,
error("Audio connection got disconnected");
+ pending_connect_finalize(device);
headset_set_state(device, HEADSET_STATE_CONNECTED);
return FALSE;
@@ -2385,6 +2386,7 @@ unsigned int headset_suspend_stream(struct audio_device *dev,
{
struct headset *hs = dev->headset;
unsigned int id;
+ int sock;
if (hs->state == HEADSET_STATE_DISCONNECTED ||
hs->state == HEADSET_STATE_CONNECTING)
@@ -2395,10 +2397,12 @@ unsigned int headset_suspend_stream(struct audio_device *dev,
hs->dc_timer = 0;
}
- headset_set_state(dev, HEADSET_STATE_CONNECTED);
+ sock = g_io_channel_unix_get_fd(hs->sco);
+
+ /* shutdown but leave the socket open and wait for hup */
+ shutdown(sock, SHUT_RDWR);
id = connect_cb_new(hs, HEADSET_STATE_CONNECTED, cb, user_data);
- g_idle_add((GSourceFunc) dummy_connect_complete, dev);
return id;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Fix error message when getting SCO connection handle
2011-03-24 12:09 [PATCH] Fix error message when getting SCO connection handle Luiz Augusto von Dentz
2011-03-24 12:09 ` [PATCH] Wait SCO socket to HUP before changing state Luiz Augusto von Dentz
@ 2011-03-25 9:11 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2011-03-25 9:11 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On Thu, Mar 24, 2011, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> Error message should indicate the transport correctly which is SCO
> not RFCOMM.
> ---
> btio/btio.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
Both of your patches have been pushed upstream. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-25 9:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-24 12:09 [PATCH] Fix error message when getting SCO connection handle Luiz Augusto von Dentz
2011-03-24 12:09 ` [PATCH] Wait SCO socket to HUP before changing state Luiz Augusto von Dentz
2011-03-25 9:11 ` [PATCH] Fix error message when getting SCO connection handle Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox