summaryrefslogtreecommitdiffstats
path: root/serial
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-05-06 01:20:42 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-05-06 01:20:42 +0000
commit6dd473cb823393b9dbfc370d64a039411664372d (patch)
tree8ceffb79cc43a2dfcae13926db7cb4a9ac3873af /serial
parentd78c8f2dce3e97c62e71e07a5f78f1289db1dd58 (diff)
Remove all serial ports on shutdown
Diffstat (limited to 'serial')
-rw-r--r--serial/manager.c2
-rw-r--r--serial/port.c13
-rw-r--r--serial/port.h2
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);