X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Ftest%2Fdiscover-test.c;h=8f7c2c22a9709bccb991a7b0d2fdd10ac1389c5d;hp=f3ef746de2382488fc40c469dcbe0e39c37383da;hb=100cb2cfc3ee4040ab969215e3cd8cc885f9efeb;hpb=2f8734a2e2f438dfc437ce7f29d98e3ff9572980 diff --git a/ui/test/discover-test.c b/ui/test/discover-test.c index f3ef746..8f7c2c2 100644 --- a/ui/test/discover-test.c +++ b/ui/test/discover-test.c @@ -28,6 +28,23 @@ static int print_device_add(struct device *device, return 0; } +static int print_boot_option_add(struct device *dev, + struct boot_option *opt, + void __attribute__((unused)) *arg) +{ + printf("new boot option (dev: %s):\n", dev->id); + printf("\tdev id: %s\n", opt->device_id); + printf("\tid: %s\n", opt->id); + printf("\tname: %s\n", opt->name); + printf("\tdesc: %s\n", opt->description); + printf("\ticon: %s\n", opt->icon_file); + printf("\tboot: %s\n", opt->boot_image_file); + printf("\tinit: %s\n", opt->initrd_file); + printf("\targs: %s\n", opt->boot_args); + + return 0; +} + static void print_device_remove(struct device *device, void __attribute__((unused)) *arg) { @@ -38,21 +55,25 @@ static void print_device_remove(struct device *device, static struct discover_client_ops client_ops = { .device_add = print_device_add, + .boot_option_add = print_boot_option_add, .device_remove = print_device_remove, }; int main(void) { struct discover_client *client; + struct waitset *waitset; + + waitset = waitset_create(NULL); - client = discover_client_init(&client_ops, NULL); + client = discover_client_init(waitset, &client_ops, NULL); if (!client) return -1; for (;;) { int rc; - rc = discover_client_process(client); + rc = waiter_poll(waitset); if (rc) break; }