summaryrefslogtreecommitdiffstats
path: root/serial/port.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-05-18 19:19:49 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-05-18 19:19:49 +0000
commitaab0210d3c33296381cff7f988a30f75f058ae8c (patch)
treeabc7c0b3f67c8d030006c8e9a0861d55e28d6471 /serial/port.c
parent3568bdd8c1a21ba36e9baf0b1485a1960d1c566b (diff)
serial: remove the entry from the persistent storage when RemovePort is called
Diffstat (limited to 'serial/port.c')
-rw-r--r--serial/port.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/serial/port.c b/serial/port.c
index 3c6980ce..fac0d5f7 100644
--- a/serial/port.c
+++ b/serial/port.c
@@ -196,9 +196,17 @@ static gboolean rfcomm_disconnect_cb(GIOChannel *io,
static void port_handler_unregister(DBusConnection *conn, void *data)
{
struct rfcomm_node *node = data;
+ char path[MAX_PATH_LENGTH];
+ const char *ppath = path;
debug("Unregistered serial port: %s", node->name);
+ snprintf(path, MAX_PATH_LENGTH, "%s/rfcomm%d", SERIAL_MANAGER_PATH, node->id);
+ dbus_connection_emit_signal(conn, SERIAL_MANAGER_PATH,
+ SERIAL_MANAGER_INTERFACE, "PortRemoved" ,
+ DBUS_TYPE_STRING, &ppath,
+ DBUS_TYPE_INVALID);
+
bound_nodes = g_slist_remove(bound_nodes, node);
rfcomm_node_free(node);
}
@@ -289,12 +297,12 @@ int port_unregister(const char *path)
{
struct rfcomm_node *node;
char name[16];
- int id;
+ int16_t id;
- if (sscanf(path, SERIAL_MANAGER_PATH"/rfcomm%d", &id) != 1)
+ if (sscanf(path, SERIAL_MANAGER_PATH"/rfcomm%hd", &id) != 1)
return -ENOENT;
- snprintf(name, sizeof(name), "/dev/rfcomm%d", id);
+ snprintf(name, sizeof(name), "/dev/rfcomm%hd", id);
node = find_node_by_name(bound_nodes, name);
if (!node)
return -ENOENT;