ui/common: Add code to send cancel-default messages
[petitboot] / ui / common / discover-client.c
index a40bfdafe0ce669b1d832f5d95d90f50267eadc8..ae5d5cd2e50b00e03cfca47b41fb6b0c8e23d0eb 100644 (file)
@@ -215,8 +215,8 @@ struct discover_client* discover_client_init(struct waitset *waitset,
                goto out_err;
        }
 
-       waiter_register(waitset, client->fd, WAIT_IN, discover_client_process,
-                       client);
+       waiter_register_io(waitset, client->fd, WAIT_IN,
+                       discover_client_process, client);
 
        return client;
 
@@ -278,3 +278,16 @@ int discover_client_boot(struct discover_client *client,
 
        return rc;
 }
+
+int discover_client_cancel_default(struct discover_client *client)
+{
+       struct pb_protocol_message *message;
+
+       message = pb_protocol_create_message(client,
+                       PB_PROTOCOL_ACTION_CANCEL_DEFAULT, 0);
+
+       if (!message)
+               return -1;
+
+       return pb_protocol_write_message(client->fd, message);
+}