* [Qemu-devel] [PATCH] hw/usb/dev-serial: Do not try to set vendorid or productid properties
@ 2017-05-04 7:41 Thomas Huth
2017-05-12 10:30 ` Gerd Hoffmann
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2017-05-04 7:41 UTC (permalink / raw)
To: qemu-devel, Gerd Hoffmann
When starting QEMU with the legacy USB serial device like this:
qemu-system-x86_64 -usbdevice serial:vendorid=0x1234:stdio
it currently aborts since the vendorid property does not exist
anymore (it has been removed by commit f29783f72ea77dfbd7ea0c9):
Unexpected error in object_property_find() at qemu/qom/object.c:1008:
qemu-system-x86_64: -usbdevice serial:vendorid=0x1234:stdio: Property
'.vendorid' not found
Aborted (core dumped)
Fix this crash by issuing a more friendly error message instead
(and simplify the code also a little bit this way).
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/usb/dev-serial.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index 6d51373..83a4f0e 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -513,27 +513,18 @@ static USBDevice *usb_serial_init(USBBus *bus, const char *filename)
{
USBDevice *dev;
Chardev *cdrv;
- uint32_t vendorid = 0, productid = 0;
char label[32];
static int index;
while (*filename && *filename != ':') {
const char *p;
- char *e;
+
if (strstart(filename, "vendorid=", &p)) {
- vendorid = strtol(p, &e, 16);
- if (e == p || (*e && *e != ',' && *e != ':')) {
- error_report("bogus vendor ID %s", p);
- return NULL;
- }
- filename = e;
+ error_report("vendorid is not supported anymore");
+ return NULL;
} else if (strstart(filename, "productid=", &p)) {
- productid = strtol(p, &e, 16);
- if (e == p || (*e && *e != ',' && *e != ':')) {
- error_report("bogus product ID %s", p);
- return NULL;
- }
- filename = e;
+ error_report("productid is not supported anymore");
+ return NULL;
} else {
error_report("unrecognized serial USB option %s", filename);
return NULL;
@@ -554,10 +545,7 @@ static USBDevice *usb_serial_init(USBBus *bus, const char *filename)
dev = usb_create(bus, "usb-serial");
qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
- if (vendorid)
- qdev_prop_set_uint16(&dev->qdev, "vendorid", vendorid);
- if (productid)
- qdev_prop_set_uint16(&dev->qdev, "productid", productid);
+
return dev;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/usb/dev-serial: Do not try to set vendorid or productid properties
2017-05-04 7:41 [Qemu-devel] [PATCH] hw/usb/dev-serial: Do not try to set vendorid or productid properties Thomas Huth
@ 2017-05-12 10:30 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2017-05-12 10:30 UTC (permalink / raw)
To: Thomas Huth; +Cc: qemu-devel
On Do, 2017-05-04 at 09:41 +0200, Thomas Huth wrote:
> When starting QEMU with the legacy USB serial device like this:
>
> qemu-system-x86_64 -usbdevice serial:vendorid=0x1234:stdio
>
> it currently aborts since the vendorid property does not exist
> anymore (it has been removed by commit f29783f72ea77dfbd7ea0c9):
>
> Unexpected error in object_property_find() at qemu/qom/object.c:1008:
> qemu-system-x86_64: -usbdevice serial:vendorid=0x1234:stdio: Property
> '.vendorid' not found
> Aborted (core dumped)
>
> Fix this crash by issuing a more friendly error message instead
> (and simplify the code also a little bit this way).
Added to usb queue.
thanks,
Gerd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-12 10:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04 7:41 [Qemu-devel] [PATCH] hw/usb/dev-serial: Do not try to set vendorid or productid properties Thomas Huth
2017-05-12 10:30 ` Gerd Hoffmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.