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,