{
.qdev.name = "QEMU USB Tablet",
.qdev.alias = "usb-tablet",
+ .usbdevice_name = "tablet",
.qdev.size = sizeof(USBHIDState),
.init = usb_tablet_initfn,
.handle_packet = usb_generic_handle_packet,
},{
.qdev.name = "QEMU USB Mouse",
.qdev.alias = "usb-mouse",
+ .usbdevice_name = "mouse",
.qdev.size = sizeof(USBHIDState),
.init = usb_mouse_initfn,
.handle_packet = usb_generic_handle_packet,
},{
.qdev.name = "QEMU USB Keyboard",
.qdev.alias = "usb-kbd",
+ .usbdevice_name = "keyboard",
.qdev.size = sizeof(USBHIDState),
.init = usb_keyboard_initfn,
.handle_packet = usb_generic_handle_packet,
static struct USBDeviceInfo wacom_info = {
.qdev.name = "QEMU PenPartner Tablet",
.qdev.alias = "wacom-tablet",
+ .usbdevice_name = "wacom-tablet",
.qdev.size = sizeof(USBWacomState),
.init = usb_wacom_initfn,
.handle_packet = usb_generic_handle_packet,
dev->info->handle_destroy(dev);
}
-static struct {
- const char *name;
- const char *qdev;
-} usbdevs[] = {
- {
- .name = "mouse",
- .qdev = "QEMU USB Mouse",
- },{
- .name = "tablet",
- .qdev = "QEMU USB Tablet",
- },{
- .name = "keyboard",
- .qdev = "QEMU USB Keyboard",
- },{
- .name = "wacom-tablet",
- .qdev = "QEMU PenPartner Tablet",
- }
-};
-
static int usb_device_add(const char *devname, int is_hotplug)
{
const char *p;
- USBBus *bus = usb_bus_find(-1 /* any */);
USBDevice *dev = NULL;
- int i;
if (!usb_enabled)
return -1;
if (dev)
goto done;
- /* simple devices which don't need extra care */
- for (i = 0; i < ARRAY_SIZE(usbdevs); i++) {
- if (strcmp(devname, usbdevs[i].name) != 0)
- continue;
- dev = usb_create_simple(bus, usbdevs[i].qdev);
- goto done;
- }
-
/* the other ones */
if (strstart(devname, "host:", &p)) {
dev = usb_host_device_open(p);