Skip to contentSkip to conversation

Should new USB devices such as usb-ccid support legacy -usbdevice?

Qemu-devel Markus Armbruster 4 participants 5 messages May 13, 2011 – May 17, 2011

lore
Share & tools
lore
#0 lore raw

When Gerd qdevified USB, he kept legacy -usbdevice working (commit 0958b4cc...). What about new USB devices? Should they get a legacy syntax, too?

The only existing new device is usb-ccid, and it got one in commit 36707144.

#1 lore raw
Quoted 6 lines · Markus Armbruster

When Gerd qdevified USB, he kept legacy -usbdevice working (commit 0958b4cc...). What about new USB devices? Should they get a legacy syntax, too?

The only existing new device is usb-ccid, and it got one in commit 36707144.

What keeps -usbdevice from being a light wrapper to -device such that no future code is needed for this?

I know some of the names are different but presumably we could use a map for existing ones and pass through names for newer ones.

Regards,

Anthony Liguori

#2 lore raw
Quoted 4 lines · Anthony Liguori
Quoted 3 lines · Markus Armbruster

When Gerd qdevified USB, he kept legacy -usbdevice working (commit 0958b4cc...). What about new USB devices? Should they get a legacy syntax, too?

Any reason to do that? We already have a number of devices which can be setup via -device only, and that is perfectly fine IMHO. Also I don't want extend the legacy syntax when adding new properties for new features to usb devices, which will add more cases where you have to use -device to use new features.

Quoted 5 lines
Quoted 2 lines

The only existing new device is usb-ccid, and it got one in commit 36707144.

What keeps -usbdevice from being a light wrapper to -device such that no future code is needed for this?

Different command line syntax. Each device (which needs/accepts parameters) has a init function to handle the -usbdevice command line, which basically does:

* parse old syntax
* usb_create()
* qdev_set_prop_*() calls
* qdev_init

Quoted 2 lines

I know some of the names are different but presumably we could use a map for existing ones and pass through names for newer ones.

Just the device name is easy, there is a field in USBDeviceInfo for that already, and in fact "-usbdevice tablet" acts like "-device usb-tablet" thanks to that entry ;)

cheers,
Gerd

#3 lore raw
In reply to Anthony Liguori
Quoted 10 lines · Anthony Liguori
Quoted 6 lines · Markus Armbruster

When Gerd qdevified USB, he kept legacy -usbdevice working (commit 0958b4cc...). What about new USB devices? Should they get a legacy syntax, too?

The only existing new device is usb-ccid, and it got one in commit 36707144.

What keeps -usbdevice from being a light wrapper to -device such that no future code is needed for this?

What would that buy us? Inhowfar is -usbdevice any lighter than -device?

Quoted 2 lines

I know some of the names are different but presumably we could use a map for existing ones and pass through names for newer ones.

Here's what an USB device needs to do for -usbdevice:

* For -usbdevice NAME (no parameters), set USBDeviceInfo member usbdevice_name to NAME.

* For -usbdevice NAME:PARAMS, additionally set USBDeviceInfo member usbdevice_init() to a function that parses PARAMS and creates the device.

Legacy PARAMs use various ad hoc syntax, and that's why we have a callback here.

For new devices, we could require regular syntax, and then a common callback would do. The common NAME=VALUE,... syntax is the obvious choice, where the NAMEs are property names.

But then -usbdevice is *exactly* like -device, except you the "usb" goes in a different place: "-usbdevice ccid" vs. "-device usb-ccid". And except that -usbdevice is crippled for some devices. For instance, usb-ccid doesn't support parameters with -usbdevice, even though it has a qdev property.

#4 lore raw

Am 16.05.2011 10:33, schrieb Markus Armbruster:

Quoted 7 lines
Quoted 5 lines · Anthony Liguori
Quoted 4 lines · Markus Armbruster

When Gerd qdevified USB, he kept legacy -usbdevice working (commit 0958b4cc...). What about new USB devices? Should they get a legacy syntax, too?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The only existing new device is usb-ccid, and it got one in commit 36707144.

What keeps -usbdevice from being a light wrapper to -device such that no future code is needed for this?

What would that buy us? Inhowfar is -usbdevice any lighter than -device?

One difference is that it automagically gives you an USB host controller, whereas with -device you need to specify one explicitly.

Kevin