return 0;
}
+int qdev_device_help(QemuOpts *opts)
+{
+ const char *driver;
+ DeviceInfo *info;
+ char msg[256];
+
+ driver = qemu_opt_get(opts, "driver");
+ if (driver && !strcmp(driver, "?")) {
+ for (info = device_info_list; info != NULL; info = info->next) {
+ qdev_print_devinfo(info, msg, sizeof(msg));
+ qemu_error("%s\n", msg);
+ }
+ return 1;
+ }
+
+ return 0;
+}
+
DeviceState *qdev_device_add(QemuOpts *opts)
{
const char *driver, *path, *id;
qemu_error("-device: no driver specified\n");
return NULL;
}
- if (strcmp(driver, "?") == 0) {
- char msg[256];
- for (info = device_info_list; info != NULL; info = info->next) {
- qdev_print_devinfo(info, msg, sizeof(msg));
- qemu_error("%s\n", msg);
- }
- return NULL;
- }
/* find driver */
info = qdev_find_info(NULL, driver);
opts = qemu_opts_parse(&qemu_device_opts,
qdict_get_str(qdict, "config"), "driver");
- if (opts)
+ if (opts && !qdev_device_help(opts))
qdev_device_add(opts);
}
/*** Board API. This should go away once we have a machine config file. ***/
DeviceState *qdev_create(BusState *bus, const char *name);
+int qdev_device_help(QemuOpts *opts);
DeviceState *qdev_device_add(QemuOpts *opts);
int qdev_init(DeviceState *dev) QEMU_WARN_UNUSED_RESULT;
void qdev_init_nofail(DeviceState *dev);
return buf;
}
+static int device_help_func(QemuOpts *opts, void *opaque)
+{
+ return qdev_device_help(opts);
+}
+
static int device_init_func(QemuOpts *opts, void *opaque)
{
DeviceState *dev;
module_call_init(MODULE_INIT_DEVICE);
+ if (qemu_opts_foreach(&qemu_device_opts, device_help_func, NULL, 0) != 0)
+ exit(0);
+
if (watchdog) {
i = select_watchdog(watchdog);
if (i > 0)