]> git.ozlabs.org Git - petitboot/blob - discover/device-handler.c
0e902df6b86ed4c1805868617cf7db85abb08bf7
[petitboot] / discover / device-handler.c
1
2 #include <talloc/talloc.h>
3 #include <pb-protocol/pb-protocol.h>
4
5 #include "device-handler.h"
6
7 struct device_handler {
8         struct discover_server *server;
9
10         struct device *devices;
11         int n_devices;
12 };
13
14 struct device_handler *device_handler_init(struct discover_server *server)
15 {
16         struct device_handler *handler;
17
18         handler = talloc(NULL, struct device_handler);
19         handler->devices = NULL;
20         handler->n_devices = 0;
21
22         return handler;
23 }
24
25 void device_handler_destroy(struct device_handler *devices)
26 {
27         talloc_free(devices);
28 }
29
30 static struct boot_option options[] = {
31         {
32                 .id = "1.1",
33                 .name = "meep one",
34                 .description = "meep description one",
35                 .icon_file = "meep.one.png",
36                 .boot_args = "root=/dev/sda1",
37         },
38 };
39
40 static struct device device = {
41         .id = "1",
42         .name = "meep",
43         .description = "meep description",
44         .icon_file = "meep.png",
45         .n_options = 1,
46         .options = options,
47 };
48
49 int device_handler_get_current_devices(struct device_handler *handler,
50                 struct device **devices)
51
52 {
53         *devices = &device;
54         return 1;
55 }
56
57
58 int device_handler_event(struct device_handler *handler,
59                 struct udev_event *event)
60 {
61         return 0;
62 }