OSDN Git Service

Fix bug which prevent a2dp adapter driver probe to succeed a second time.
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>
Tue, 28 Apr 2009 14:40:03 +0000 (11:40 -0300)
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>
Tue, 28 Apr 2009 17:01:50 +0000 (14:01 -0300)
a2dp adapter driver was not calling avdtp_exit on adapter removal so the next
time it is probed it fail since the kernel reports that the address is already
in use.

audio/a2dp.c
audio/avdtp.c

index cc72c4d..3f4d824 100644 (file)
@@ -1198,6 +1198,8 @@ void a2dp_unregister(const bdaddr_t *src)
        g_slist_foreach(server->sources, (GFunc) a2dp_unregister_sep, NULL);
        g_slist_free(server->sources);
 
+       avdtp_exit(src);
+
        if (server->source_record_id)
                remove_record_from_server(server->source_record_id);
 
index 1db7bcf..b12868d 100644 (file)
@@ -3211,15 +3211,11 @@ int avdtp_unregister_sep(struct avdtp_local_sep *sep)
        if (!sep)
                return -EINVAL;
 
-       if (sep->info.inuse)
-               return -EBUSY;
-
        server = sep->server;
        server->seps = g_slist_remove(server->seps, sep);
 
        if (sep->stream)
-               avdtp_sep_set_state(sep->stream->session, sep,
-                                                       AVDTP_STATE_IDLE);
+               release_stream(sep->stream, sep->stream->session);
 
        g_free(sep);
 
@@ -3347,11 +3343,19 @@ int avdtp_init(const bdaddr_t *src, GKeyFile *config)
 void avdtp_exit(const bdaddr_t *src)
 {
        struct avdtp_server *server;
+       GSList *l;
 
        server = find_server(servers, src);
        if (!server)
                return;
 
+       for (l = sessions; l; l = l->next) {
+               struct avdtp *session = l->data;
+
+               if (session->server == server)
+                       connection_lost(session, -ECONNABORTED);
+       }
+
        servers = g_slist_remove(servers, server);
 
        g_io_channel_shutdown(server->io, TRUE, NULL);