* [Qemu-devel] [FOR 0.12][PATCH] Improve usbdevice error messages
@ 2009-12-22 20:30 Scott Tsai
0 siblings, 0 replies; only message in thread
From: Scott Tsai @ 2009-12-22 20:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Scott Tsai
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>
---
vl.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/vl.c b/vl.c
index 8be3648..ee9c3f9 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);
+ }
}
/***********************************************************/
--
1.6.5.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-12-22 20:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-22 20:30 [Qemu-devel] [FOR 0.12][PATCH] Improve usbdevice error messages Scott Tsai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).