]> git.ozlabs.org Git - petitboot/blobdiff - ui/twin/pbt-client.c
ui/ncurses: Use pmenu_item destrutor to free ncurses ITEMs
[petitboot] / ui / twin / pbt-client.c
index 09d8e99c2518e5d138b3e3781b76ab7688d02afb..a4ad0e926f35155f4e2557a62a6f3138d9a304ed 100644 (file)
@@ -19,7 +19,6 @@
 #include "config.h"
 #endif
 
-#define _GNU_SOURCE
 #include <assert.h>
 #include <string.h>
 
@@ -30,6 +29,7 @@
 #include "log/log.h"
 #include "talloc/talloc.h"
 #include "waiter/waiter.h"
+#include "process/process.h"
 #include "ui/common/discover-client.h"
 
 static struct pb_opt_data *pbt_opt_data_from_item(struct pbt_item *item)
@@ -57,7 +57,7 @@ static int pbt_client_boot(struct pbt_item *item)
        int result;
        struct pb_opt_data *opt_data = pbt_opt_data_from_item(item);
 
-       pb_log("%s: %s\n", __func__, pbt_item_name(item));
+       pb_debug("%s: %s\n", __func__, pbt_item_name(item));
 
        pbt_frame_status_printf(&item->pbt_client->frame, "Booting %s...",
                pbt_item_name(item));
@@ -87,7 +87,7 @@ static int pbt_device_add(struct device *dev, struct pbt_client *client)
        struct pbt_quad q;
        const char *icon_file;
 
-       pb_log("%s: %p %s: n_options %d\n", __func__, dev, dev->id,
+       pb_debug("%s: %p %s: n_options %d\n", __func__, dev, dev->id,
                dev->n_options);
 
        pb_protocol_dump_device(dev, "", pb_log_get_stream());
@@ -147,6 +147,8 @@ static int pbt_boot_option_add(struct device *dev, struct boot_option *opt,
                opt->boot_image_file);
        opt_data->bd->initrd = talloc_strdup(opt_data->bd,
                opt->initrd_file);
+       opt_data->bd->dtb = talloc_strdup(opt_data->bd,
+               opt->dtb_file);
        opt_data->bd->args = talloc_strdup(opt_data->bd,
                opt->boot_args);
        opt_data->opt = opt;
@@ -178,7 +180,7 @@ static void pbt_device_remove(struct device *dev, struct pbt_client *client)
        struct pbt_item *next_item;
        struct pbt_item *i;
 
-       pb_log("%s: %p %s: n_options %d\n", __func__, dev, dev->id,
+       pb_debug("%s: %p %s: n_options %d\n", __func__, dev, dev->id,
                dev->n_options);
 
        pb_protocol_dump_device(dev, "", pb_log_get_stream());
@@ -242,7 +244,7 @@ static struct discover_client_ops pbt_client_ops = {
 
 static void pbt_client_destructor(struct pbt_client *client)
 {
-       pb_log("%s\n", __func__);
+       pb_debug("%s\n", __func__);
 
        // move to screen twin_x11_destroy(twin_ctx);
        talloc_free(client->discover_client);
@@ -267,6 +269,8 @@ struct pbt_client *pbt_client_init(enum pbt_twin_backend backend,
 
        pbt_client->waitset = waitset_create(pbt_client);
 
+       process_init(pbt_client, pbt_client->waitset, false);
+
        pbt_client->sig = "pbt_client";
        pbt_client->frame.scr = pbt_scr_init(pbt_client, pbt_client->waitset,
                        backend, width, height, NULL, NULL);
@@ -293,7 +297,7 @@ retry_start:
 
                start_deamon = 0;
 
-               result = pb_start_daemon();
+               result = pb_start_daemon(pbt_client);
 
                if (!result)
                        goto retry_start;