4 #include <talloc/talloc.h>
6 #include "pb-protocol/pb-protocol.h"
8 #include "device-handler.h"
9 #include "parser-utils.h"
11 void device_add_boot_option(struct device *device,
12 struct boot_option *boot_option)
14 list_add(&device->boot_options, &boot_option->list);
15 talloc_steal(device, boot_option);
18 const char *generic_icon_file(enum generic_icon_type type)
22 return artwork_pathname("hdd.png");
24 return artwork_pathname("usbpen.png");
25 case ICON_TYPE_OPTICAL:
26 return artwork_pathname("cdrom.png");
27 case ICON_TYPE_NETWORK:
28 case ICON_TYPE_UNKNOWN:
31 return artwork_pathname("hdd.png");
34 enum generic_icon_type guess_device_type(struct discover_context *ctx)
36 struct udev_event *event;
37 const char *type, *bus;
41 type = udev_event_param(event, "ID_TYPE");
42 bus = udev_event_param(event, "ID_BUS");
44 if (type && streq(type, "cd"))
45 return ICON_TYPE_OPTICAL;
47 return ICON_TYPE_UNKNOWN;
48 if (streq(bus, "usb"))
50 if (streq(bus, "ata") || streq(bus, "scsi"))
51 return ICON_TYPE_DISK;
52 return ICON_TYPE_UNKNOWN;