Anthony Liguori <anth...@codemonkey.ws> writes: > On 05/13/2011 11:36 AM, Markus Armbruster wrote: >> 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? > 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.