* [Bluez-devel] [PATCH] Small headset.c fixes
@ 2007-10-14 15:39 Fabien Chevalier
2007-10-15 1:48 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 3+ messages in thread
From: Fabien Chevalier @ 2007-10-14 15:39 UTC (permalink / raw)
To: Brad Midgley, Johan Hedberg, Luiz Augusto von Dentz; +Cc: BlueZ development
[-- Attachment #1: Type: text/plain, Size: 329 bytes --]
Hi All,
Please find attached a rather small patch, that fixes some small issues
i found while reading headset.c code:
* make String representation of state consistent with the state name
* send Stop() signal only if we transition from playing state, not
playin_in_progress
* remove unused io_id field.
Cheers,
Fabien
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: headset.patch --]
[-- Type: text/x-patch; name="headset.patch", Size: 1288 bytes --]
Index: headset.c
===================================================================
--- headset.c (révision 120)
+++ headset.c (copie de travail)
@@ -63,14 +63,18 @@
#define HEADSET_GAIN_SPEAKER 'S'
#define HEADSET_GAIN_MICROPHONE 'M'
-static char *str_state[] = {"DISCONNECTED", "CONNECTING", "CONNECTED",
- "STREAM_STARTING", "STREAMING"};
+static char *str_state[] = {
+ "HEADSET_STATE_DISCONNECTED",
+ "HEADSET_STATE_CONNECT_IN_PROGRESS",
+ "HEADSET_STATE_CONNECTED",
+ "HEADSET_STATE_PLAY_IN_PROGRESS",
+ "HEADSET_STATE_PLAYING",
+ };
struct pending_connect {
DBusMessage *msg;
DBusPendingCall *call;
GIOChannel *io;
- guint io_id;
int sock;
int err;
unsigned int id;
@@ -489,9 +493,9 @@
return -err;
}
- c->io_id = g_io_add_watch(c->io,
- G_IO_OUT | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
- (GIOFunc) sco_connect_cb, device);
+ g_io_add_watch(c->io,
+ G_IO_OUT | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
+ (GIOFunc) sco_connect_cb, device);
} else
do_callback = TRUE;
@@ -1553,7 +1557,7 @@
AUDIO_HEADSET_INTERFACE,
"Connected",
DBUS_TYPE_INVALID);
- } else {
+ } else if (hs->state == HEADSET_STATE_PLAYING) {
close_sco(dev);
dbus_connection_emit_signal(dev->conn, dev->path,
AUDIO_HEADSET_INTERFACE,
[-- Attachment #3: Type: text/plain, Size: 314 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Bluez-devel] [PATCH] Small headset.c fixes
2007-10-14 15:39 [Bluez-devel] [PATCH] Small headset.c fixes Fabien Chevalier
@ 2007-10-15 1:48 ` Luiz Augusto von Dentz
2007-10-15 9:25 ` Fabien Chevalier
0 siblings, 1 reply; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2007-10-15 1:48 UTC (permalink / raw)
To: Fabien Chevalier; +Cc: BlueZ development, Johan Hedberg, Brad Midgley
Hi Fabien,
On 10/14/07, Fabien Chevalier <fabchevalier@free.fr> wrote:
> Hi All,
>
> Please find attached a rather small patch, that fixes some small issues
> i found while reading headset.c code:
> * make String representation of state consistent with the state name
> * send Stop() signal only if we transition from playing state, not
> playin_in_progress
> * remove unused io_id field.
Thought we should not emit Stopped signal please maintain the code
for sco cleanup (close_sco), sco connection may fail or disconnected
before we got a chance to change the state to playing.
Besides that it seems good to me.
-- =
Luiz Augusto von Dentz
Engenheiro de Computa=E7=E3o
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Bluez-devel] [PATCH] Small headset.c fixes
2007-10-15 1:48 ` Luiz Augusto von Dentz
@ 2007-10-15 9:25 ` Fabien Chevalier
0 siblings, 0 replies; 3+ messages in thread
From: Fabien Chevalier @ 2007-10-15 9:25 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: BlueZ development, Johan Hedberg, Brad Midgley
[-- Attachment #1: Type: text/plain, Size: 508 bytes --]
Hi Luiz,
> Thought we should not emit Stopped signal please maintain the code
> for sco cleanup (close_sco), sco connection may fail or disconnected
> before we got a chance to change the state to playing.
This was bogus indeed, thanks for spotting that ;-)
>
> Besides that it seems good to me.
>
Here comes ans updated version of the patch. I moved close_sco to be
executed at anytime, it doesn't hurt as close_sco does already check to
see if the the sco channel is already opened.
Cheers,
Fabien
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: headset.patch --]
[-- Type: text/x-patch; name="headset.patch", Size: 1538 bytes --]
Index: headset.c
===================================================================
--- headset.c (révision 120)
+++ headset.c (copie de travail)
@@ -63,14 +63,18 @@
#define HEADSET_GAIN_SPEAKER 'S'
#define HEADSET_GAIN_MICROPHONE 'M'
-static char *str_state[] = {"DISCONNECTED", "CONNECTING", "CONNECTED",
- "STREAM_STARTING", "STREAMING"};
+static char *str_state[] = {
+ "HEADSET_STATE_DISCONNECTED",
+ "HEADSET_STATE_CONNECT_IN_PROGRESS",
+ "HEADSET_STATE_CONNECTED",
+ "HEADSET_STATE_PLAY_IN_PROGRESS",
+ "HEADSET_STATE_PLAYING",
+ };
struct pending_connect {
DBusMessage *msg;
DBusPendingCall *call;
GIOChannel *io;
- guint io_id;
int sock;
int err;
unsigned int id;
@@ -489,9 +493,9 @@
return -err;
}
- c->io_id = g_io_add_watch(c->io,
- G_IO_OUT | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
- (GIOFunc) sco_connect_cb, device);
+ g_io_add_watch(c->io,
+ G_IO_OUT | G_IO_NVAL | G_IO_ERR | G_IO_HUP,
+ (GIOFunc) sco_connect_cb, device);
} else
do_callback = TRUE;
@@ -1544,6 +1548,7 @@
case HEADSET_STATE_CONNECT_IN_PROGRESS:
break;
case HEADSET_STATE_CONNECTED:
+ close_sco(dev);
if (hs->state < state) {
g_io_add_watch(hs->rfcomm,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
@@ -1553,8 +1558,7 @@
AUDIO_HEADSET_INTERFACE,
"Connected",
DBUS_TYPE_INVALID);
- } else {
- close_sco(dev);
+ } else if (hs->state == HEADSET_STATE_PLAYING) {
dbus_connection_emit_signal(dev->conn, dev->path,
AUDIO_HEADSET_INTERFACE,
"Stopped",
[-- Attachment #3: Type: text/plain, Size: 314 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-10-15 9:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-14 15:39 [Bluez-devel] [PATCH] Small headset.c fixes Fabien Chevalier
2007-10-15 1:48 ` Luiz Augusto von Dentz
2007-10-15 9:25 ` Fabien Chevalier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox