]> git.proxmox.com Git - qemu.git/blobdiff - vl.c
USB: Improve usbdevice error messages
[qemu.git] / vl.c
diff --git a/vl.c b/vl.c
index 8be3648f4fe941ad0fd703c25b1233df41e60755..ee9c3f947f31b174ee2c9f362af25347d897ada0 100644 (file)
--- 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);
+    }
 }
 
 /***********************************************************/