2 * USB Mass Storage Device emulation
4 * Copyright (c) 2006 CodeSourcery.
5 * Written by Paul Brook
7 * This code is licensed under the LGPL.
10 #include "qemu-common.h"
11 #include "qemu/error-report.h"
12 #include "qemu/option.h"
13 #include "qemu/config-file.h"
15 #include "hw/usb/desc.h"
16 #include "hw/scsi/scsi.h"
17 #include "ui/console.h"
18 #include "monitor/monitor.h"
19 #include "sysemu/sysemu.h"
20 #include "sysemu/block-backend.h"
21 #include "sysemu/blockdev.h"
22 #include "qapi/visitor.h"
27 #define DPRINTF(fmt, ...) \
28 do { printf("usb-msd: " fmt , ## __VA_ARGS__); } while (0)
30 #define DPRINTF(fmt, ...) do {} while(0)
34 #define MassStorageReset 0xff
35 #define GetMaxLun 0xfe
38 USB_MSDM_CBW
, /* Command Block. */
39 USB_MSDM_DATAOUT
, /* Transfer data to device. */
40 USB_MSDM_DATAIN
, /* Transfer data from device. */
41 USB_MSDM_CSW
/* Command Status. */
57 struct usb_msd_csw csw
;
60 /* For async completion. */
62 /* usb-storage only */
68 #define TYPE_USB_STORAGE "usb-storage-dev"
69 #define USB_STORAGE_DEV(obj) OBJECT_CHECK(MSDState, (obj), TYPE_USB_STORAGE)
90 static const USBDescStrings desc_strings
= {
91 [STR_MANUFACTURER
] = "QEMU",
92 [STR_PRODUCT
] = "QEMU USB HARDDRIVE",
93 [STR_SERIALNUMBER
] = "1",
94 [STR_CONFIG_FULL
] = "Full speed config (usb 1.1)",
95 [STR_CONFIG_HIGH
] = "High speed config (usb 2.0)",
96 [STR_CONFIG_SUPER
] = "Super speed config (usb 3.0)",
99 static const USBDescIface desc_iface_full
= {
100 .bInterfaceNumber
= 0,
102 .bInterfaceClass
= USB_CLASS_MASS_STORAGE
,
103 .bInterfaceSubClass
= 0x06, /* SCSI */
104 .bInterfaceProtocol
= 0x50, /* Bulk */
105 .eps
= (USBDescEndpoint
[]) {
107 .bEndpointAddress
= USB_DIR_IN
| 0x01,
108 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
109 .wMaxPacketSize
= 64,
111 .bEndpointAddress
= USB_DIR_OUT
| 0x02,
112 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
113 .wMaxPacketSize
= 64,
118 static const USBDescDevice desc_device_full
= {
120 .bMaxPacketSize0
= 8,
121 .bNumConfigurations
= 1,
122 .confs
= (USBDescConfig
[]) {
125 .bConfigurationValue
= 1,
126 .iConfiguration
= STR_CONFIG_FULL
,
127 .bmAttributes
= USB_CFG_ATT_ONE
| USB_CFG_ATT_SELFPOWER
,
129 .ifs
= &desc_iface_full
,
134 static const USBDescIface desc_iface_high
= {
135 .bInterfaceNumber
= 0,
137 .bInterfaceClass
= USB_CLASS_MASS_STORAGE
,
138 .bInterfaceSubClass
= 0x06, /* SCSI */
139 .bInterfaceProtocol
= 0x50, /* Bulk */
140 .eps
= (USBDescEndpoint
[]) {
142 .bEndpointAddress
= USB_DIR_IN
| 0x01,
143 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
144 .wMaxPacketSize
= 512,
146 .bEndpointAddress
= USB_DIR_OUT
| 0x02,
147 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
148 .wMaxPacketSize
= 512,
153 static const USBDescDevice desc_device_high
= {
155 .bMaxPacketSize0
= 64,
156 .bNumConfigurations
= 1,
157 .confs
= (USBDescConfig
[]) {
160 .bConfigurationValue
= 1,
161 .iConfiguration
= STR_CONFIG_HIGH
,
162 .bmAttributes
= USB_CFG_ATT_ONE
| USB_CFG_ATT_SELFPOWER
,
164 .ifs
= &desc_iface_high
,
169 static const USBDescIface desc_iface_super
= {
170 .bInterfaceNumber
= 0,
172 .bInterfaceClass
= USB_CLASS_MASS_STORAGE
,
173 .bInterfaceSubClass
= 0x06, /* SCSI */
174 .bInterfaceProtocol
= 0x50, /* Bulk */
175 .eps
= (USBDescEndpoint
[]) {
177 .bEndpointAddress
= USB_DIR_IN
| 0x01,
178 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
179 .wMaxPacketSize
= 1024,
182 .bEndpointAddress
= USB_DIR_OUT
| 0x02,
183 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
184 .wMaxPacketSize
= 1024,
190 static const USBDescDevice desc_device_super
= {
192 .bMaxPacketSize0
= 9,
193 .bNumConfigurations
= 1,
194 .confs
= (USBDescConfig
[]) {
197 .bConfigurationValue
= 1,
198 .iConfiguration
= STR_CONFIG_SUPER
,
199 .bmAttributes
= USB_CFG_ATT_ONE
| USB_CFG_ATT_SELFPOWER
,
201 .ifs
= &desc_iface_super
,
206 static const USBDesc desc
= {
208 .idVendor
= 0x46f4, /* CRC16() of "QEMU" */
211 .iManufacturer
= STR_MANUFACTURER
,
212 .iProduct
= STR_PRODUCT
,
213 .iSerialNumber
= STR_SERIALNUMBER
,
215 .full
= &desc_device_full
,
216 .high
= &desc_device_high
,
217 .super
= &desc_device_super
,
221 static void usb_msd_copy_data(MSDState
*s
, USBPacket
*p
)
224 len
= p
->iov
.size
- p
->actual_length
;
225 if (len
> s
->scsi_len
)
227 usb_packet_copy(p
, scsi_req_get_buf(s
->req
) + s
->scsi_off
, len
);
231 if (s
->scsi_len
== 0 || s
->data_len
== 0) {
232 scsi_req_continue(s
->req
);
236 static void usb_msd_send_status(MSDState
*s
, USBPacket
*p
)
240 DPRINTF("Command status %d tag 0x%x, len %zd\n",
241 s
->csw
.status
, le32_to_cpu(s
->csw
.tag
), p
->iov
.size
);
243 assert(s
->csw
.sig
== cpu_to_le32(0x53425355));
244 len
= MIN(sizeof(s
->csw
), p
->iov
.size
);
245 usb_packet_copy(p
, &s
->csw
, len
);
246 memset(&s
->csw
, 0, sizeof(s
->csw
));
249 static void usb_msd_packet_complete(MSDState
*s
)
251 USBPacket
*p
= s
->packet
;
253 /* Set s->packet to NULL before calling usb_packet_complete
254 because another request may be issued before
255 usb_packet_complete returns. */
256 DPRINTF("Packet complete %p\n", p
);
258 usb_packet_complete(&s
->dev
, p
);
261 static void usb_msd_transfer_data(SCSIRequest
*req
, uint32_t len
)
263 MSDState
*s
= DO_UPCAST(MSDState
, dev
.qdev
, req
->bus
->qbus
.parent
);
264 USBPacket
*p
= s
->packet
;
266 assert((s
->mode
== USB_MSDM_DATAOUT
) == (req
->cmd
.mode
== SCSI_XFER_TO_DEV
));
270 usb_msd_copy_data(s
, p
);
272 if (p
&& p
->actual_length
== p
->iov
.size
) {
273 p
->status
= USB_RET_SUCCESS
; /* Clear previous ASYNC status */
274 usb_msd_packet_complete(s
);
279 static void usb_msd_command_complete(SCSIRequest
*req
, uint32_t status
, size_t resid
)
281 MSDState
*s
= DO_UPCAST(MSDState
, dev
.qdev
, req
->bus
->qbus
.parent
);
282 USBPacket
*p
= s
->packet
;
284 DPRINTF("Command complete %d tag 0x%x\n", status
, req
->tag
);
286 s
->csw
.sig
= cpu_to_le32(0x53425355);
287 s
->csw
.tag
= cpu_to_le32(req
->tag
);
288 s
->csw
.residue
= cpu_to_le32(s
->data_len
);
289 s
->csw
.status
= status
!= 0;
292 if (s
->data_len
== 0 && s
->mode
== USB_MSDM_DATAOUT
) {
293 /* A deferred packet with no write data remaining must be
294 the status read packet. */
295 usb_msd_send_status(s
, p
);
296 s
->mode
= USB_MSDM_CBW
;
297 } else if (s
->mode
== USB_MSDM_CSW
) {
298 usb_msd_send_status(s
, p
);
299 s
->mode
= USB_MSDM_CBW
;
302 int len
= (p
->iov
.size
- p
->actual_length
);
303 usb_packet_skip(p
, len
);
306 if (s
->data_len
== 0) {
307 s
->mode
= USB_MSDM_CSW
;
310 p
->status
= USB_RET_SUCCESS
; /* Clear previous ASYNC status */
311 usb_msd_packet_complete(s
);
312 } else if (s
->data_len
== 0) {
313 s
->mode
= USB_MSDM_CSW
;
319 static void usb_msd_request_cancelled(SCSIRequest
*req
)
321 MSDState
*s
= DO_UPCAST(MSDState
, dev
.qdev
, req
->bus
->qbus
.parent
);
324 scsi_req_unref(s
->req
);
330 static void usb_msd_handle_reset(USBDevice
*dev
)
332 MSDState
*s
= (MSDState
*)dev
;
336 scsi_req_cancel(s
->req
);
338 assert(s
->req
== NULL
);
341 s
->packet
->status
= USB_RET_STALL
;
342 usb_msd_packet_complete(s
);
345 s
->mode
= USB_MSDM_CBW
;
348 static void usb_msd_handle_control(USBDevice
*dev
, USBPacket
*p
,
349 int request
, int value
, int index
, int length
, uint8_t *data
)
351 MSDState
*s
= (MSDState
*)dev
;
352 SCSIDevice
*scsi_dev
;
355 ret
= usb_desc_handle_control(dev
, p
, request
, value
, index
, length
, data
);
361 case EndpointOutRequest
| USB_REQ_CLEAR_FEATURE
:
363 /* Class specific requests. */
364 case ClassInterfaceOutRequest
| MassStorageReset
:
365 /* Reset state ready for the next CBW. */
366 s
->mode
= USB_MSDM_CBW
;
368 case ClassInterfaceRequest
| GetMaxLun
:
371 scsi_dev
= scsi_device_find(&s
->bus
, 0, 0, maxlun
+1);
372 if (scsi_dev
== NULL
) {
375 if (scsi_dev
->lun
!= maxlun
+1) {
380 DPRINTF("MaxLun %d\n", maxlun
);
382 p
->actual_length
= 1;
385 p
->status
= USB_RET_STALL
;
390 static void usb_msd_cancel_io(USBDevice
*dev
, USBPacket
*p
)
392 MSDState
*s
= USB_STORAGE_DEV(dev
);
394 assert(s
->packet
== p
);
398 scsi_req_cancel(s
->req
);
402 static void usb_msd_handle_data(USBDevice
*dev
, USBPacket
*p
)
404 MSDState
*s
= (MSDState
*)dev
;
406 struct usb_msd_cbw cbw
;
407 uint8_t devep
= p
->ep
->nr
;
408 SCSIDevice
*scsi_dev
;
418 if (p
->iov
.size
!= 31) {
419 error_report("usb-msd: Bad CBW size");
422 usb_packet_copy(p
, &cbw
, 31);
423 if (le32_to_cpu(cbw
.sig
) != 0x43425355) {
424 error_report("usb-msd: Bad signature %08x",
425 le32_to_cpu(cbw
.sig
));
428 DPRINTF("Command on LUN %d\n", cbw
.lun
);
429 scsi_dev
= scsi_device_find(&s
->bus
, 0, 0, cbw
.lun
);
430 if (scsi_dev
== NULL
) {
431 error_report("usb-msd: Bad LUN %d", cbw
.lun
);
434 tag
= le32_to_cpu(cbw
.tag
);
435 s
->data_len
= le32_to_cpu(cbw
.data_len
);
436 if (s
->data_len
== 0) {
437 s
->mode
= USB_MSDM_CSW
;
438 } else if (cbw
.flags
& 0x80) {
439 s
->mode
= USB_MSDM_DATAIN
;
441 s
->mode
= USB_MSDM_DATAOUT
;
443 DPRINTF("Command tag 0x%x flags %08x len %d data %d\n",
444 tag
, cbw
.flags
, cbw
.cmd_len
, s
->data_len
);
445 assert(le32_to_cpu(s
->csw
.residue
) == 0);
447 s
->req
= scsi_req_new(scsi_dev
, tag
, cbw
.lun
, cbw
.cmd
, NULL
);
449 scsi_req_print(s
->req
);
451 len
= scsi_req_enqueue(s
->req
);
453 scsi_req_continue(s
->req
);
457 case USB_MSDM_DATAOUT
:
458 DPRINTF("Data out %zd/%d\n", p
->iov
.size
, s
->data_len
);
459 if (p
->iov
.size
> s
->data_len
) {
464 usb_msd_copy_data(s
, p
);
466 if (le32_to_cpu(s
->csw
.residue
)) {
467 int len
= p
->iov
.size
- p
->actual_length
;
469 usb_packet_skip(p
, len
);
471 if (s
->data_len
== 0) {
472 s
->mode
= USB_MSDM_CSW
;
476 if (p
->actual_length
< p
->iov
.size
) {
477 DPRINTF("Deferring packet %p [wait data-out]\n", p
);
479 p
->status
= USB_RET_ASYNC
;
484 DPRINTF("Unexpected write (len %zd)\n", p
->iov
.size
);
494 case USB_MSDM_DATAOUT
:
495 if (s
->data_len
!= 0 || p
->iov
.size
< 13) {
498 /* Waiting for SCSI write to complete. */
500 p
->status
= USB_RET_ASYNC
;
504 if (p
->iov
.size
< 13) {
509 /* still in flight */
510 DPRINTF("Deferring packet %p [wait status]\n", p
);
512 p
->status
= USB_RET_ASYNC
;
514 usb_msd_send_status(s
, p
);
515 s
->mode
= USB_MSDM_CBW
;
519 case USB_MSDM_DATAIN
:
520 DPRINTF("Data in %zd/%d, scsi_len %d\n",
521 p
->iov
.size
, s
->data_len
, s
->scsi_len
);
523 usb_msd_copy_data(s
, p
);
525 if (le32_to_cpu(s
->csw
.residue
)) {
526 int len
= p
->iov
.size
- p
->actual_length
;
528 usb_packet_skip(p
, len
);
530 if (s
->data_len
== 0) {
531 s
->mode
= USB_MSDM_CSW
;
535 if (p
->actual_length
< p
->iov
.size
) {
536 DPRINTF("Deferring packet %p [wait data-in]\n", p
);
538 p
->status
= USB_RET_ASYNC
;
543 DPRINTF("Unexpected read (len %zd)\n", p
->iov
.size
);
549 DPRINTF("Bad token\n");
551 p
->status
= USB_RET_STALL
;
556 static void usb_msd_password_cb(void *opaque
, int err
)
558 MSDState
*s
= opaque
;
559 Error
*local_err
= NULL
;
562 usb_device_attach(&s
->dev
, &local_err
);
566 error_report_err(local_err
);
567 qdev_unplug(&s
->dev
.qdev
, NULL
);
571 static void *usb_msd_load_request(QEMUFile
*f
, SCSIRequest
*req
)
573 MSDState
*s
= DO_UPCAST(MSDState
, dev
.qdev
, req
->bus
->qbus
.parent
);
575 /* nothing to load, just store req in our state struct */
576 assert(s
->req
== NULL
);
582 static const struct SCSIBusInfo usb_msd_scsi_info_storage
= {
587 .transfer_data
= usb_msd_transfer_data
,
588 .complete
= usb_msd_command_complete
,
589 .cancel
= usb_msd_request_cancelled
,
590 .load_request
= usb_msd_load_request
,
593 static const struct SCSIBusInfo usb_msd_scsi_info_bot
= {
598 .transfer_data
= usb_msd_transfer_data
,
599 .complete
= usb_msd_command_complete
,
600 .cancel
= usb_msd_request_cancelled
,
601 .load_request
= usb_msd_load_request
,
604 static void usb_msd_realize_storage(USBDevice
*dev
, Error
**errp
)
606 MSDState
*s
= USB_STORAGE_DEV(dev
);
607 BlockBackend
*blk
= s
->conf
.blk
;
608 SCSIDevice
*scsi_dev
;
612 error_setg(errp
, "drive property not set");
617 bdrv_add_key(blk_bs(blk
), NULL
, &err
);
619 if (monitor_cur_is_qmp()) {
620 error_propagate(errp
, err
);
626 monitor_read_bdrv_key_start(cur_mon
, blk_bs(blk
),
627 usb_msd_password_cb
, s
);
628 s
->dev
.auto_attach
= 0;
635 blkconf_serial(&s
->conf
, &dev
->serial
);
636 blkconf_blocksizes(&s
->conf
);
639 * Hack alert: this pretends to be a block device, but it's really
640 * a SCSI bus that can serve only a single device, which it
641 * creates automatically. But first it needs to detach from its
642 * blockdev, or else scsi_bus_legacy_add_drive() dies when it
645 * The hack is probably a bad idea.
647 blk_detach_dev(blk
, &s
->dev
.qdev
);
650 usb_desc_create_serial(dev
);
652 scsi_bus_new(&s
->bus
, sizeof(s
->bus
), DEVICE(dev
),
653 &usb_msd_scsi_info_storage
, NULL
);
654 scsi_dev
= scsi_bus_legacy_add_drive(&s
->bus
, blk
, 0, !!s
->removable
,
655 s
->conf
.bootindex
, dev
->serial
,
658 error_propagate(errp
, err
);
661 usb_msd_handle_reset(dev
);
662 s
->scsi_dev
= scsi_dev
;
665 static void usb_msd_realize_bot(USBDevice
*dev
, Error
**errp
)
667 MSDState
*s
= USB_STORAGE_DEV(dev
);
669 usb_desc_create_serial(dev
);
671 scsi_bus_new(&s
->bus
, sizeof(s
->bus
), DEVICE(dev
),
672 &usb_msd_scsi_info_bot
, NULL
);
673 usb_msd_handle_reset(dev
);
676 static USBDevice
*usb_msd_init(USBBus
*bus
, const char *filename
)
687 /* parse -usbdevice disk: syntax into drive opts */
689 snprintf(id
, sizeof(id
), "usb%d", nr
++);
690 opts
= qemu_opts_create(qemu_find_opts("drive"), id
, 1, NULL
);
693 p1
= strchr(filename
, ':');
697 if (strstart(filename
, "format=", &p2
)) {
698 int len
= MIN(p1
- p2
, sizeof(fmt
));
699 pstrcpy(fmt
, len
, p2
);
700 qemu_opt_set(opts
, "format", fmt
, &error_abort
);
701 } else if (*filename
!= ':') {
702 error_report("unrecognized USB mass-storage option %s", filename
);
708 error_report("block device specification needed");
711 qemu_opt_set(opts
, "file", filename
, &error_abort
);
712 qemu_opt_set(opts
, "if", "none", &error_abort
);
714 /* create host drive */
715 dinfo
= drive_new(opts
, 0);
721 /* create guest device */
722 dev
= usb_create(bus
, "usb-storage");
723 qdev_prop_set_drive(&dev
->qdev
, "drive", blk_by_legacy_dinfo(dinfo
),
726 error_report_err(err
);
727 object_unparent(OBJECT(dev
));
733 static const VMStateDescription vmstate_usb_msd
= {
734 .name
= "usb-storage",
736 .minimum_version_id
= 1,
737 .fields
= (VMStateField
[]) {
738 VMSTATE_USB_DEVICE(dev
, MSDState
),
739 VMSTATE_UINT32(mode
, MSDState
),
740 VMSTATE_UINT32(scsi_len
, MSDState
),
741 VMSTATE_UINT32(scsi_off
, MSDState
),
742 VMSTATE_UINT32(data_len
, MSDState
),
743 VMSTATE_UINT32(csw
.sig
, MSDState
),
744 VMSTATE_UINT32(csw
.tag
, MSDState
),
745 VMSTATE_UINT32(csw
.residue
, MSDState
),
746 VMSTATE_UINT8(csw
.status
, MSDState
),
747 VMSTATE_END_OF_LIST()
751 static Property msd_properties
[] = {
752 DEFINE_BLOCK_PROPERTIES(MSDState
, conf
),
753 DEFINE_PROP_BIT("removable", MSDState
, removable
, 0, false),
754 DEFINE_PROP_END_OF_LIST(),
757 static void usb_msd_class_initfn_common(ObjectClass
*klass
, void *data
)
759 DeviceClass
*dc
= DEVICE_CLASS(klass
);
760 USBDeviceClass
*uc
= USB_DEVICE_CLASS(klass
);
762 uc
->product_desc
= "QEMU USB MSD";
763 uc
->usb_desc
= &desc
;
764 uc
->cancel_packet
= usb_msd_cancel_io
;
765 uc
->handle_attach
= usb_desc_attach
;
766 uc
->handle_reset
= usb_msd_handle_reset
;
767 uc
->handle_control
= usb_msd_handle_control
;
768 uc
->handle_data
= usb_msd_handle_data
;
769 set_bit(DEVICE_CATEGORY_STORAGE
, dc
->categories
);
770 dc
->fw_name
= "storage";
771 dc
->vmsd
= &vmstate_usb_msd
;
774 static void usb_msd_class_initfn_storage(ObjectClass
*klass
, void *data
)
776 DeviceClass
*dc
= DEVICE_CLASS(klass
);
777 USBDeviceClass
*uc
= USB_DEVICE_CLASS(klass
);
779 uc
->realize
= usb_msd_realize_storage
;
780 dc
->props
= msd_properties
;
783 static void usb_msd_get_bootindex(Object
*obj
, Visitor
*v
, void *opaque
,
784 const char *name
, Error
**errp
)
786 USBDevice
*dev
= USB_DEVICE(obj
);
787 MSDState
*s
= USB_STORAGE_DEV(dev
);
789 visit_type_int32(v
, &s
->conf
.bootindex
, name
, errp
);
792 static void usb_msd_set_bootindex(Object
*obj
, Visitor
*v
, void *opaque
,
793 const char *name
, Error
**errp
)
795 USBDevice
*dev
= USB_DEVICE(obj
);
796 MSDState
*s
= USB_STORAGE_DEV(dev
);
798 Error
*local_err
= NULL
;
800 visit_type_int32(v
, &boot_index
, name
, &local_err
);
804 /* check whether bootindex is present in fw_boot_order list */
805 check_boot_index(boot_index
, &local_err
);
809 /* change bootindex to a new one */
810 s
->conf
.bootindex
= boot_index
;
813 object_property_set_int(OBJECT(s
->scsi_dev
), boot_index
, "bootindex",
819 error_propagate(errp
, local_err
);
823 static const TypeInfo usb_storage_dev_type_info
= {
824 .name
= TYPE_USB_STORAGE
,
825 .parent
= TYPE_USB_DEVICE
,
826 .instance_size
= sizeof(MSDState
),
828 .class_init
= usb_msd_class_initfn_common
,
831 static void usb_msd_instance_init(Object
*obj
)
833 object_property_add(obj
, "bootindex", "int32",
834 usb_msd_get_bootindex
,
835 usb_msd_set_bootindex
, NULL
, NULL
, NULL
);
836 object_property_set_int(obj
, -1, "bootindex", NULL
);
839 static void usb_msd_class_initfn_bot(ObjectClass
*klass
, void *data
)
841 USBDeviceClass
*uc
= USB_DEVICE_CLASS(klass
);
842 DeviceClass
*dc
= DEVICE_CLASS(klass
);
844 uc
->realize
= usb_msd_realize_bot
;
845 dc
->hotpluggable
= false;
848 static const TypeInfo msd_info
= {
849 .name
= "usb-storage",
850 .parent
= TYPE_USB_STORAGE
,
851 .class_init
= usb_msd_class_initfn_storage
,
852 .instance_init
= usb_msd_instance_init
,
855 static const TypeInfo bot_info
= {
857 .parent
= TYPE_USB_STORAGE
,
858 .class_init
= usb_msd_class_initfn_bot
,
861 static void usb_msd_register_types(void)
863 type_register_static(&usb_storage_dev_type_info
);
864 type_register_static(&msd_info
);
865 type_register_static(&bot_info
);
866 usb_legacy_register("usb-storage", "disk", usb_msd_init
);
869 type_init(usb_msd_register_types
)