> -void qmp_screendump(const char *filename, Error **errp) > +void qmp_screendump(const char *filename, bool has_id, const char *id, > + Error **errp) > { > QemuConsole *con = qemu_console_lookup_by_index(0); > DisplaySurface *surface; > + DeviceState *dev; > + > + if (has_id) { > + dev = qdev_find_recursive(sysbus_get_default(), id); > + if (!dev) { > + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, > + "Device '%s' not found", id); > + return; > + } > + con = qemu_console_lookup_by_device(dev, 0);
I'd suggest to name this 'device', because this is what it actually is. While being at it you should also add a 'head' parameter (second arg of qemu_console_lookup_by_device()), for devices like virtio-vga which can support multiple heads. > if (con == NULL) { > error_setg(errp, "There is no QemuConsole I can screendump from."); This might also be refined to say something like 'device $name is not a display device' in case qemu_console_lookup_by_device() failed. > -- > 1.8.3.1 >