aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorScott Tsai <scottt.tw@gmail.com>2009-12-23 04:30:18 +0800
committerAurelien Jarno <aurelien@aurel32.net>2009-12-23 07:42:38 +0100
commit41193c50fac2b6d78122514826770b43318dca8d (patch)
treeea44bb7f0c7169ab483921a1a41c1390208969cf /vl.c
parentcpu-all.h: fix cpu_get_real_ticks() #ifdef (diff)
downloadqemu-kvm-41193c50fac2b6d78122514826770b43318dca8d.tar.gz
qemu-kvm-41193c50fac2b6d78122514826770b43318dca8d.tar.bz2
qemu-kvm-41193c50fac2b6d78122514826770b43318dca8d.zip
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: Scott Tsai <scottt.tw@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> (cherry picked from commit 59d1c1c2d774cccb0a88ff73501f97bea190c154)
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/vl.c b/vl.c
index 8be3648f4..ee9c3f947 100644
--- a/vl.c
+++ b/vl.c
@@ -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);
+ }
}
/***********************************************************/