|
@@ -310,13 +310,13 @@ typedef struct LegacyUSBFactory
|
|
{
|
|
{
|
|
const char *name;
|
|
const char *name;
|
|
const char *usbdevice_name;
|
|
const char *usbdevice_name;
|
|
- USBDevice *(*usbdevice_init)(const char *params);
|
|
|
|
|
|
+ USBDevice *(*usbdevice_init)(void);
|
|
} LegacyUSBFactory;
|
|
} LegacyUSBFactory;
|
|
|
|
|
|
static GSList *legacy_usb_factory;
|
|
static GSList *legacy_usb_factory;
|
|
|
|
|
|
void usb_legacy_register(const char *typename, const char *usbdevice_name,
|
|
void usb_legacy_register(const char *typename, const char *usbdevice_name,
|
|
- USBDevice *(*usbdevice_init)(const char *params))
|
|
|
|
|
|
+ USBDevice *(*usbdevice_init)(void))
|
|
{
|
|
{
|
|
if (usbdevice_name) {
|
|
if (usbdevice_name) {
|
|
LegacyUSBFactory *f = g_malloc0(sizeof(*f));
|
|
LegacyUSBFactory *f = g_malloc0(sizeof(*f));
|
|
@@ -658,27 +658,17 @@ void hmp_info_usb(Monitor *mon, const QDict *qdict)
|
|
}
|
|
}
|
|
|
|
|
|
/* handle legacy -usbdevice cmd line option */
|
|
/* handle legacy -usbdevice cmd line option */
|
|
-USBDevice *usbdevice_create(const char *cmdline)
|
|
|
|
|
|
+USBDevice *usbdevice_create(const char *driver)
|
|
{
|
|
{
|
|
USBBus *bus = usb_bus_find(-1 /* any */);
|
|
USBBus *bus = usb_bus_find(-1 /* any */);
|
|
LegacyUSBFactory *f = NULL;
|
|
LegacyUSBFactory *f = NULL;
|
|
Error *err = NULL;
|
|
Error *err = NULL;
|
|
GSList *i;
|
|
GSList *i;
|
|
- char driver[32];
|
|
|
|
- const char *params;
|
|
|
|
- int len;
|
|
|
|
USBDevice *dev;
|
|
USBDevice *dev;
|
|
|
|
|
|
- params = strchr(cmdline,':');
|
|
|
|
- if (params) {
|
|
|
|
- params++;
|
|
|
|
- len = params - cmdline;
|
|
|
|
- if (len > sizeof(driver))
|
|
|
|
- len = sizeof(driver);
|
|
|
|
- pstrcpy(driver, len, cmdline);
|
|
|
|
- } else {
|
|
|
|
- params = "";
|
|
|
|
- pstrcpy(driver, sizeof(driver), cmdline);
|
|
|
|
|
|
+ if (strchr(driver, ':')) {
|
|
|
|
+ error_report("usbdevice parameters are not supported anymore");
|
|
|
|
+ return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
for (i = legacy_usb_factory; i; i = i->next) {
|
|
for (i = legacy_usb_factory; i; i = i->next) {
|
|
@@ -702,15 +692,7 @@ USBDevice *usbdevice_create(const char *cmdline)
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
- if (f->usbdevice_init) {
|
|
|
|
- dev = f->usbdevice_init(params);
|
|
|
|
- } else {
|
|
|
|
- if (*params) {
|
|
|
|
- error_report("usbdevice %s accepts no params", driver);
|
|
|
|
- return NULL;
|
|
|
|
- }
|
|
|
|
- dev = usb_new(f->name);
|
|
|
|
- }
|
|
|
|
|
|
+ dev = f->usbdevice_init ? f->usbdevice_init() : usb_new(f->name);
|
|
if (!dev) {
|
|
if (!dev) {
|
|
error_report("Failed to create USB device '%s'", f->name);
|
|
error_report("Failed to create USB device '%s'", f->name);
|
|
return NULL;
|
|
return NULL;
|