5 #include <talloc/talloc.h>
7 #include "pb-protocol/pb-protocol.h"
9 #include "device-handler.h"
10 #include "parser-utils.h"
12 void device_add_boot_option(struct device *device,
13 struct boot_option *boot_option)
15 pb_log("%s: %s\n", __func__, device->id);
16 pb_log(" id '%s'\n", boot_option->id);
17 pb_log(" name '%s'\n", boot_option->name);
18 pb_log(" descr '%s'\n", boot_option->description);
19 pb_log(" icon '%s'\n", boot_option->icon_file);
20 pb_log(" image '%s'\n", boot_option->boot_image_file);
21 pb_log(" initrd '%s'\n", boot_option->initrd_file);
22 pb_log(" args '%s'\n", boot_option->boot_args);
23 list_add(&device->boot_options, &boot_option->list);
24 talloc_steal(device, boot_option);
27 const char *generic_icon_file(enum generic_icon_type type)
31 return artwork_pathname("hdd.png");
33 return artwork_pathname("usbpen.png");
34 case ICON_TYPE_OPTICAL:
35 return artwork_pathname("cdrom.png");
36 case ICON_TYPE_NETWORK:
37 case ICON_TYPE_UNKNOWN:
40 return artwork_pathname("hdd.png");
43 enum generic_icon_type guess_device_type(struct discover_context *ctx)
45 struct udev_event *event;
46 const char *type, *bus;
50 type = udev_event_param(event, "ID_TYPE");
51 bus = udev_event_param(event, "ID_BUS");
53 if (type && streq(type, "cd"))
54 return ICON_TYPE_OPTICAL;
56 return ICON_TYPE_UNKNOWN;
57 if (streq(bus, "usb"))
59 if (streq(bus, "ata") || streq(bus, "scsi"))
60 return ICON_TYPE_DISK;
61 return ICON_TYPE_UNKNOWN;