Revision 62aed765 hw/usb-serial.c
b/hw/usb-serial.c | ||
---|---|---|
570 | 570 |
.unmigratable = 1, |
571 | 571 |
}; |
572 | 572 |
|
573 |
static struct USBDeviceInfo serial_info = { |
|
574 |
.product_desc = "QEMU USB Serial", |
|
575 |
.qdev.name = "usb-serial", |
|
576 |
.qdev.size = sizeof(USBSerialState), |
|
577 |
.qdev.vmsd = &vmstate_usb_serial, |
|
578 |
.usb_desc = &desc_serial, |
|
579 |
.init = usb_serial_initfn, |
|
580 |
.handle_packet = usb_generic_handle_packet, |
|
581 |
.handle_reset = usb_serial_handle_reset, |
|
582 |
.handle_control = usb_serial_handle_control, |
|
583 |
.handle_data = usb_serial_handle_data, |
|
584 |
.handle_destroy = usb_serial_handle_destroy, |
|
585 |
.usbdevice_name = "serial", |
|
586 |
.usbdevice_init = usb_serial_init, |
|
587 |
.qdev.props = (Property[]) { |
|
573 |
static void usb_serial_class_initfn(ObjectClass *klass, void *data) |
|
574 |
{ |
|
575 |
USBDeviceClass *uc = USB_DEVICE_CLASS(klass); |
|
576 |
|
|
577 |
uc->init = usb_serial_initfn; |
|
578 |
uc->product_desc = "QEMU USB Serial"; |
|
579 |
uc->usb_desc = &desc_serial; |
|
580 |
uc->handle_packet = usb_generic_handle_packet; |
|
581 |
uc->handle_reset = usb_serial_handle_reset; |
|
582 |
uc->handle_control = usb_serial_handle_control; |
|
583 |
uc->handle_data = usb_serial_handle_data; |
|
584 |
uc->handle_destroy = usb_serial_handle_destroy; |
|
585 |
} |
|
586 |
|
|
587 |
static struct DeviceInfo serial_info = { |
|
588 |
.name = "usb-serial", |
|
589 |
.size = sizeof(USBSerialState), |
|
590 |
.vmsd = &vmstate_usb_serial, |
|
591 |
.class_init= usb_serial_class_initfn, |
|
592 |
.props = (Property[]) { |
|
588 | 593 |
DEFINE_PROP_CHR("chardev", USBSerialState, cs), |
589 | 594 |
DEFINE_PROP_END_OF_LIST(), |
590 | 595 |
}, |
591 | 596 |
}; |
592 | 597 |
|
593 |
static struct USBDeviceInfo braille_info = { |
|
594 |
.product_desc = "QEMU USB Braille", |
|
595 |
.qdev.name = "usb-braille", |
|
596 |
.qdev.size = sizeof(USBSerialState), |
|
597 |
.qdev.vmsd = &vmstate_usb_serial, |
|
598 |
.usb_desc = &desc_braille, |
|
599 |
.init = usb_serial_initfn, |
|
600 |
.handle_packet = usb_generic_handle_packet, |
|
601 |
.handle_reset = usb_serial_handle_reset, |
|
602 |
.handle_control = usb_serial_handle_control, |
|
603 |
.handle_data = usb_serial_handle_data, |
|
604 |
.handle_destroy = usb_serial_handle_destroy, |
|
605 |
.usbdevice_name = "braille", |
|
606 |
.usbdevice_init = usb_braille_init, |
|
607 |
.qdev.props = (Property[]) { |
|
598 |
static void usb_braille_class_initfn(ObjectClass *klass, void *data) |
|
599 |
{ |
|
600 |
USBDeviceClass *uc = USB_DEVICE_CLASS(klass); |
|
601 |
|
|
602 |
uc->init = usb_serial_initfn; |
|
603 |
uc->product_desc = "QEMU USB Braille"; |
|
604 |
uc->usb_desc = &desc_braille; |
|
605 |
uc->handle_packet = usb_generic_handle_packet; |
|
606 |
uc->handle_reset = usb_serial_handle_reset; |
|
607 |
uc->handle_control = usb_serial_handle_control; |
|
608 |
uc->handle_data = usb_serial_handle_data; |
|
609 |
uc->handle_destroy = usb_serial_handle_destroy; |
|
610 |
} |
|
611 |
|
|
612 |
static struct DeviceInfo braille_info = { |
|
613 |
.name = "usb-braille", |
|
614 |
.size = sizeof(USBSerialState), |
|
615 |
.vmsd = &vmstate_usb_serial, |
|
616 |
.class_init= usb_braille_class_initfn, |
|
617 |
.props = (Property[]) { |
|
608 | 618 |
DEFINE_PROP_CHR("chardev", USBSerialState, cs), |
609 | 619 |
DEFINE_PROP_END_OF_LIST(), |
610 | 620 |
}, |
... | ... | |
612 | 622 |
|
613 | 623 |
static void usb_serial_register_devices(void) |
614 | 624 |
{ |
615 |
usb_qdev_register(&serial_info); |
|
616 |
usb_qdev_register(&braille_info); |
|
625 |
usb_qdev_register(&serial_info, "serial", usb_serial_init);
|
|
626 |
usb_qdev_register(&braille_info, "braille", usb_braille_init);
|
|
617 | 627 |
} |
618 | 628 |
device_init(usb_serial_register_devices) |
Also available in: Unified diff