diff options
Diffstat (limited to 'serial/manager.c')
-rw-r--r-- | serial/manager.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/serial/manager.c b/serial/manager.c index 6bce2d69..9a6972da 100644 --- a/serial/manager.c +++ b/serial/manager.c @@ -777,7 +777,23 @@ done: static DBusHandlerResult remove_port(DBusConnection *conn, DBusMessage *msg, void *data) { - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + DBusError derr; + const char *path; + + dbus_error_init(&derr); + if (!dbus_message_get_args(msg, &derr, + DBUS_TYPE_STRING, &path, + DBUS_TYPE_INVALID)) { + err_invalid_args(conn, msg, derr.message); + dbus_error_free(&derr); + return DBUS_HANDLER_RESULT_HANDLED; + } + + if (port_unregister(path) < 0) + return err_does_not_exist(conn, msg, "path doesn't exist"); + + return send_message_and_unref(conn, + dbus_message_new_method_return(msg)); } static DBusHandlerResult connect_service(DBusConnection *conn, |