提交 59d1c1c2 编写于 作者: S Scott Tsai 提交者: Aurelien Jarno

USB: Improve usbdevice error messages

When an non-existent USB device is specified on the command line,
print "qemu: could not add USB device 'X'".
Likewise for the usb_{add,del} monitor commands.
Signed-off-by: NScott Tsai <scottt.tw@gmail.com>
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
上级 2edd07ef
......@@ -2689,17 +2689,28 @@ static int usb_device_del(const char *devname)
static int usb_parse(const char *cmdline)
{
return usb_device_add(cmdline, 0);
int r;
r = usb_device_add(cmdline, 0);
if (r < 0) {
fprintf(stderr, "qemu: could not add USB device '%s'\n", cmdline);
}
return r;
}
void do_usb_add(Monitor *mon, const QDict *qdict)
{
usb_device_add(qdict_get_str(qdict, "devname"), 1);
const char *devname = qdict_get_str(qdict, "devname");
if (usb_device_add(devname, 1) < 0) {
qemu_error("could not add USB device '%s'\n", devname);
}
}
void do_usb_del(Monitor *mon, const QDict *qdict)
{
usb_device_del(qdict_get_str(qdict, "devname"));
const char *devname = qdict_get_str(qdict, "devname");
if (usb_device_del(devname) < 0) {
qemu_error("could not delete USB device '%s'\n", devname);
}
}
/***********************************************************/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册