struct requery_data *rqd = data;
struct device_handler *handler;
struct discover_device *device;
+ bool autoboot;
handler = rqd->handler;
device = rqd->device;
talloc_free(opt);
}
+ /* Track whether autoboot was enabled, if we cancel a default option
+ * it will be switched off.
+ */
+ autoboot = handler->autoboot_enabled;
+
list_for_each_entry_safe(&device->boot_options, opt, tmp, list) {
if (opt == handler->default_boot_option) {
- pb_log("Default option %s cancelled since device is being requeried",
+ pb_log("Default option %s cancelled since device is being requeried\n",
opt->option->name);
device_handler_cancel_default(handler);
}
talloc_free(opt);
}
+ handler->autoboot_enabled = autoboot;
+
discover_server_notify_device_remove(handler->server, device->device);
device->notified = false;
return 0;
}
+struct discover_boot_option *device_handler_find_option_by_name(
+ struct device_handler *handler, const char *device,
+ const char *name)
+{
+ size_t len = strlen(name);
+ unsigned int i;
+
+ for (i = 0; i < handler->n_devices; i++) {
+ struct discover_device *dev = handler->devices[i];
+ struct discover_boot_option *opt;
+
+ list_for_each_entry(&dev->boot_options, opt, list)
+ /* Match exactly, partial matches can be quite common */
+ if (strlen(opt->option->name) == len &&
+ !strcmp(opt->option->name, name))
+ if (!dev || !strcmp(opt->option->device_id, device))
+ return opt;
+ }
+
+ return NULL;
+}
+
static struct discover_boot_option *find_boot_option_by_id(
struct device_handler *handler, const char *id)
{