Remove reference to device.h
[petitboot] / ui / test / pb-test.c
1
2 #include <stdio.h>
3
4 #include "ui/common/discover-client.h"
5
6 static int print_device_add(struct device *device)
7 {
8         int i;
9
10         printf("new device:\n");
11         printf("\tid:   %s\n", device->id);
12         printf("\tname: %s\n", device->name);
13         printf("\tdesc: %s\n", device->description);
14         printf("\ticon: %s\n", device->icon_file);
15
16         printf("\t%d boot options:\n", device->n_options);
17         for (i = 0; i < device->n_options; i++) {
18                 struct boot_option *opt = &device->options[i];
19                 printf("\t\tid:   %s\n", opt->id);
20                 printf("\t\tname: %s\n", opt->name);
21                 printf("\t\tdesc: %s\n", opt->description);
22                 printf("\t\ticon: %s\n", opt->icon_file);
23                 printf("\t\tboot: %s\n", opt->boot_image_file);
24                 printf("\t\tinit: %s\n", opt->initrd_file);
25                 printf("\t\targs: %s\n", opt->boot_args);
26         }
27
28         return 0;
29 }
30
31 static void print_device_remove(char *dev_id)
32 {
33         printf("removed device:\n");
34         printf("\tid:   %s\n", dev_id);
35 }
36
37 struct discover_client_ops client_ops = {
38         .add_device = print_device_add,
39         .remove_device = print_device_remove,
40 };
41
42 int main(void)
43 {
44         struct discover_client *client;
45
46         client = discover_client_init(&client_ops);
47         if (!client)
48                 return -1;
49
50         for (;;) {
51                 int rc;
52
53                 rc = discover_client_process(client);
54                 if (rc)
55                         break;
56         }
57
58         return 0;
59 }