diff options
-rw-r--r-- | serial/manager.c | 2 | ||||
-rw-r--r-- | serial/port.c | 13 | ||||
-rw-r--r-- | serial/port.h | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/serial/manager.c b/serial/manager.c index 2bb1ce84..d0a21ce6 100644 --- a/serial/manager.c +++ b/serial/manager.c @@ -2295,6 +2295,8 @@ void serial_manager_exit(void) dbus_connection_unref(connection); connection = NULL; + port_release_all(); + if (rfcomm_ctl >= 0) close(rfcomm_ctl); } diff --git a/serial/port.c b/serial/port.c index c090ebd4..f2c0eb61 100644 --- a/serial/port.c +++ b/serial/port.c @@ -328,6 +328,19 @@ int port_remove_listener(const char *owner, const char *dev) return 0; } +void port_release_all(void) +{ + struct rfcomm_node *node; + GSList *l; + + for (l = connected_nodes; l; l = l->next) { + node = l->data; + + connected_nodes = g_slist_remove(connected_nodes, node); + rfcomm_node_free(node); + } +} + int port_register(DBusConnection *conn, int16_t id, bdaddr_t *src, bdaddr_t *dst, const char *dev, char *ppath, const char *svc) { diff --git a/serial/port.h b/serial/port.h index 88bcb200..5471525b 100644 --- a/serial/port.h +++ b/serial/port.h @@ -26,6 +26,8 @@ int port_add_listener(DBusConnection *conn, int16_t id, bdaddr_t *dst, int port_remove_listener(const char *owner, const char *dev); +void port_release_all(void); + int port_register(DBusConnection *conn, int16_t id, bdaddr_t *src, bdaddr_t *dst, const char *dev, char *ppath, const char *svc); |