diff options
-rw-r--r-- | serial/port.c | 9 | ||||
-rw-r--r-- | serial/port.h | 4 | ||||
-rw-r--r-- | serial/storage.c | 8 | ||||
-rw-r--r-- | serial/storage.h | 4 |
4 files changed, 13 insertions, 12 deletions
diff --git a/serial/port.c b/serial/port.c index fac0d5f7..49042785 100644 --- a/serial/port.c +++ b/serial/port.c @@ -201,7 +201,8 @@ static void port_handler_unregister(DBusConnection *conn, void *data) debug("Unregistered serial port: %s", node->name); - snprintf(path, MAX_PATH_LENGTH, "%s/rfcomm%d", SERIAL_MANAGER_PATH, node->id); + snprintf(path, MAX_PATH_LENGTH, "%s/rfcomm%hd", SERIAL_MANAGER_PATH, node->id); + dbus_connection_emit_signal(conn, SERIAL_MANAGER_PATH, SERIAL_MANAGER_INTERFACE, "PortRemoved" , DBUS_TYPE_STRING, &ppath, @@ -211,7 +212,7 @@ static void port_handler_unregister(DBusConnection *conn, void *data) rfcomm_node_free(node); } -int port_add_listener(DBusConnection *conn, int id, bdaddr_t *dst, +int port_add_listener(DBusConnection *conn, int16_t id, bdaddr_t *dst, int fd, const char *name, const char *owner) { struct rfcomm_node *node; @@ -252,7 +253,7 @@ int port_remove_listener(const char *owner, const char *name) return 0; } -int port_register(DBusConnection *conn, int id, bdaddr_t *dst, +int port_register(DBusConnection *conn, int16_t id, bdaddr_t *dst, const char *name, char *ppath) { char path[MAX_PATH_LENGTH]; @@ -264,7 +265,7 @@ int port_register(DBusConnection *conn, int id, bdaddr_t *dst, node->name = g_strdup(name); node->conn = dbus_connection_ref(conn); - snprintf(path, MAX_PATH_LENGTH, "%s/rfcomm%d", SERIAL_MANAGER_PATH, id); + snprintf(path, MAX_PATH_LENGTH, "%s/rfcomm%hd", SERIAL_MANAGER_PATH, id); if (!dbus_connection_create_object_path(conn, path, node, port_handler_unregister)) { diff --git a/serial/port.h b/serial/port.h index 026ba242..27077925 100644 --- a/serial/port.h +++ b/serial/port.h @@ -21,12 +21,12 @@ * */ -int port_add_listener(DBusConnection *conn, int id, bdaddr_t *dst, +int port_add_listener(DBusConnection *conn, int16_t id, bdaddr_t *dst, int fd, const char *name, const char *owner); int port_remove_listener(const char *owner, const char *name); -int port_register(DBusConnection *conn, int id, bdaddr_t *dst, +int port_register(DBusConnection *conn, int16_t id, bdaddr_t *dst, const char *name, char *ppath); int port_unregister(const char *path); diff --git a/serial/storage.c b/serial/storage.c index e6d73827..46e63f5d 100644 --- a/serial/storage.c +++ b/serial/storage.c @@ -38,7 +38,7 @@ #include "storage.h" -int port_delete(bdaddr_t *src, bdaddr_t *dst, int id) +int port_delete(bdaddr_t *src, bdaddr_t *dst, int16_t id) { char filename[PATH_MAX + 1]; char src_addr[18], dst_addr[18]; @@ -48,12 +48,12 @@ int port_delete(bdaddr_t *src, bdaddr_t *dst, int id) ba2str(dst, dst_addr); create_name(filename, PATH_MAX, STORAGEDIR, src_addr, "serial"); - snprintf(key, sizeof(key), "%s#%d", dst_addr, id); + snprintf(key, sizeof(key), "%s#%hd", dst_addr, id); return textfile_del(filename, key); } -int port_store(bdaddr_t *src, bdaddr_t *dst, int id, +int port_store(bdaddr_t *src, bdaddr_t *dst, int16_t id, uint8_t ch, const char *svcname) { char filename[PATH_MAX + 1]; @@ -74,7 +74,7 @@ int port_store(bdaddr_t *src, bdaddr_t *dst, int id, size = strlen(svcname) + 3; value = g_malloc0(size); - snprintf(key, 32, "%s#%d", dst_addr, id); + snprintf(key, 32, "%s#%hd", dst_addr, id); snprintf(value, size, "%d:%s", ch, svcname); err = textfile_put(filename, key, value); diff --git a/serial/storage.h b/serial/storage.h index 2abdf0ce..1f92f521 100644 --- a/serial/storage.h +++ b/serial/storage.h @@ -21,6 +21,6 @@ * */ -int port_delete(bdaddr_t *src, bdaddr_t *dst, int id); -int port_store(bdaddr_t *src, bdaddr_t *dst, int id, +int port_delete(bdaddr_t *src, bdaddr_t *dst, int16_t id); +int port_store(bdaddr_t *src, bdaddr_t *dst, int16_t id, uint8_t ch, const char *svcname); |