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/osdep.h"
11 #include "qemu-common.h"
12 #include "qemu/error-report.h"
13 #include "qemu/option.h"
14 #include "qemu/config-file.h"
16 #include "hw/usb/desc.h"
17 #include "hw/scsi/scsi.h"
18 #include "ui/console.h"
19 #include "monitor/monitor.h"
20 #include "sysemu/sysemu.h"
21 #include "sysemu/block-backend.h"
22 #include "sysemu/blockdev.h"
23 #include "qapi/visitor.h"
28 #define DPRINTF(fmt, ...) \
29 do { printf("usb-msd: " fmt , ## __VA_ARGS__); } while (0)
31 #define DPRINTF(fmt, ...) do {} while(0)
35 #define MassStorageReset 0xff
36 #define GetMaxLun 0xfe
39 USB_MSDM_CBW
, /* Command Block. */
40 USB_MSDM_DATAOUT
, /* Transfer data to device. */
41 USB_MSDM_DATAIN
, /* Transfer data from device. */
42 USB_MSDM_CSW
/* Command Status. */
58 struct usb_msd_csw csw
;
61 /* For async completion. */
63 /* usb-storage only */
69 #define TYPE_USB_STORAGE "usb-storage-dev"
70 #define USB_STORAGE_DEV(obj) OBJECT_CHECK(MSDState, (obj), TYPE_USB_STORAGE)
91 static const USBDescStrings desc_strings
= {
92 [STR_MANUFACTURER
] = "QEMU",
93 [STR_PRODUCT
] = "QEMU USB HARDDRIVE",
94 [STR_SERIALNUMBER
] = "1",
95 [STR_CONFIG_FULL
] = "Full speed config (usb 1.1)",
96 [STR_CONFIG_HIGH
] = "High speed config (usb 2.0)",
97 [STR_CONFIG_SUPER
] = "Super speed config (usb 3.0)",
100 static const USBDescIface desc_iface_full
= {
101 .bInterfaceNumber
= 0,
103 .bInterfaceClass
= USB_CLASS_MASS_STORAGE
,
104 .bInterfaceSubClass
= 0x06, /* SCSI */
105 .bInterfaceProtocol
= 0x50, /* Bulk */
106 .eps
= (USBDescEndpoint
[]) {
108 .bEndpointAddress
= USB_DIR_IN
| 0x01,
109 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
110 .wMaxPacketSize
= 64,
112 .bEndpointAddress
= USB_DIR_OUT
| 0x02,
113 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
114 .wMaxPacketSize
= 64,
119 static const USBDescDevice desc_device_full
= {
121 .bMaxPacketSize0
= 8,
122 .bNumConfigurations
= 1,
123 .confs
= (USBDescConfig
[]) {
126 .bConfigurationValue
= 1,
127 .iConfiguration
= STR_CONFIG_FULL
,
128 .bmAttributes
= USB_CFG_ATT_ONE
| USB_CFG_ATT_SELFPOWER
,
130 .ifs
= &desc_iface_full
,
135 static const USBDescIface desc_iface_high
= {
136 .bInterfaceNumber
= 0,
138 .bInterfaceClass
= USB_CLASS_MASS_STORAGE
,
139 .bInterfaceSubClass
= 0x06, /* SCSI */
140 .bInterfaceProtocol
= 0x50, /* Bulk */
141 .eps
= (USBDescEndpoint
[]) {
143 .bEndpointAddress
= USB_DIR_IN
| 0x01,
144 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
145 .wMaxPacketSize
= 512,
147 .bEndpointAddress
= USB_DIR_OUT
| 0x02,
148 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
149 .wMaxPacketSize
= 512,
154 static const USBDescDevice desc_device_high
= {
156 .bMaxPacketSize0
= 64,
157 .bNumConfigurations
= 1,
158 .confs
= (USBDescConfig
[]) {
161 .bConfigurationValue
= 1,
162 .iConfiguration
= STR_CONFIG_HIGH
,
163 .bmAttributes
= USB_CFG_ATT_ONE
| USB_CFG_ATT_SELFPOWER
,
165 .ifs
= &desc_iface_high
,
170 static const USBDescIface desc_iface_super
= {
171 .bInterfaceNumber
= 0,
173 .bInterfaceClass
= USB_CLASS_MASS_STORAGE
,
174 .bInterfaceSubClass
= 0x06, /* SCSI */
175 .bInterfaceProtocol
= 0x50, /* Bulk */
176 .eps
= (USBDescEndpoint
[]) {
178 .bEndpointAddress
= USB_DIR_IN
| 0x01,
179 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
180 .wMaxPacketSize
= 1024,
183 .bEndpointAddress
= USB_DIR_OUT
| 0x02,
184 .bmAttributes
= USB_ENDPOINT_XFER_BULK
,
185 .wMaxPacketSize
= 1024,
191 static const USBDescDevice desc_device_super
= {
193 .bMaxPacketSize0
= 9,
194 .bNumConfigurations
= 1,
195 .confs
= (USBDescConfig
[]) {
198 .bConfigurationValue
= 1,
199 .iConfiguration
= STR_CONFIG_SUPER
,
200 .bmAttributes
= USB_CFG_ATT_ONE
| USB_CFG_ATT_SELFPOWER
,
202 .ifs
= &desc_iface_super
,
207 static const USBDesc desc
= {
209 .idVendor
= 0x46f4, /* CRC16() of "QEMU" */
212 .iManufacturer
= STR_MANUFACTURER
,
213 .iProduct
= STR_PRODUCT
,
214 .iSerialNumber
= STR_SERIALNUMBER
,
216 .full
= &desc_device_full
,
217 .high
= &desc_device_high
,
218 .super
= &desc_device_super
,
222 static void usb_msd_copy_data(MSDState
*s
, USBPacket
*p
)
225 len
= p
->iov
.size
- p
->actual_length
;
226 if (len
> s
->scsi_len
)
228 usb_packet_copy(p
, scsi_req_get_buf(s
->req
) + s
->scsi_off
, len
);
232 if (s
->scsi_len
== 0 || s
->data_len
== 0) {
233 scsi_req_continue(s
->req
);
237 static void usb_msd_send_status(MSDState
*s
, USBPacket
*p
)
241 DPRINTF("Command status %d tag 0x%x, len %zd\n",
242 s
->csw
.status
, le32_to_cpu(s
->csw
.tag
), p
->iov
.size
);
244 assert(s
->csw
.sig
== cpu_to_le32(0x53425355));
245 len
= MIN(sizeof(s
->csw
), p
->iov
.size
);
246 usb_packet_copy(p
, &s
->csw
, len
);
247 memset(&s
->csw
, 0, sizeof(s
->csw
));
250 static void usb_msd_packet_complete(MSDState
*s
)
252 USBPacket
*p
= s
->packet
;
254 /* Set s->packet to NULL before calling usb_packet_complete
255 because another request may be issued before
256 usb_packet_complete returns. */
257 DPRINTF("Packet complete %p\n", p
);
259 usb_packet_complete(&s
->dev
, p
);
262 static void usb_msd_transfer_data(SCSIRequest
*req
, uint32_t len
)
264 MSDState
*s
= DO_UPCAST(MSDState
, dev
.qdev
, req
->bus
->qbus
.parent
);
265 USBPacket
*p
= s
->packet
;
267 assert((s
->mode
== USB_MSDM_DATAOUT
) == (req
->cmd
.mode
== SCSI_XFER_TO_DEV
));
271 usb_msd_copy_data(s
, p
);
273 if (p
&& p
->actual_length
== p
->iov
.size
) {
274 p
->status
= USB_RET_SUCCESS
; /* Clear previous ASYNC status */
275 usb_msd_packet_complete(s
);
280 static void usb_msd_command_complete(SCSIRequest
*req
, uint32_t status
, size_t resid
)
282 MSDState
*s
= DO_UPCAST(MSDState
, dev
.qdev
, req
->bus
->qbus
.parent
);
283 USBPacket
*p
= s
->packet
;
285 DPRINTF("Command complete %d tag 0x%x\n", status
, req
->tag
);
287 s
->csw
.sig
= cpu_to_le32(0x53425355);
288 s
->csw
.tag
= cpu_to_le32(req
->tag
);
289 s
->csw
.residue
= cpu_to_le32(s
->data_len
);
290 s
->csw
.status
= status
!= 0;
293 if (s
->data_len
== 0 && s
->mode
== USB_MSDM_DATAOUT
) {
294 /* A deferred packet with no write data remaining must be
295 the status read packet. */
296 usb_msd_send_status(s
, p
);
297 s
->mode
= USB_MSDM_CBW
;
298 } else if (s
->mode
== USB_MSDM_CSW
) {
299 usb_msd_send_status(s
, p
);
300 s
->mode
= USB_MSDM_CBW
;
303 int len
= (p
->iov
.size
- p
->actual_length
);
304 usb_packet_skip(p
, len
);
307 if (s
->data_len
== 0) {
308 s
->mode
= USB_MSDM_CSW
;
311 p
->status
= USB_RET_SUCCESS
; /* Clear previous ASYNC status */
312 usb_msd_packet_complete(s
);
313 } else if (s
->data_len
== 0) {
314 s
->mode
= USB_MSDM_CSW
;
320 static void usb_msd_request_cancelled(SCSIRequest
*req
)
322 MSDState
*s
= DO_UPCAST(MSDState
, dev
.qdev
, req
->bus
->qbus
.parent
);
325 scsi_req_unref(s
->req
);
331 static void usb_msd_handle_reset(USBDevice
*dev
)
333 MSDState
*s
= (MSDState
*)dev
;
337 scsi_req_cancel(s
->req
);
339 assert(s
->req
== NULL
);
342 s
->packet
->status
= USB_RET_STALL
;
343 usb_msd_packet_complete(s
);
346 s
->mode
= USB_MSDM_CBW
;
349 static void usb_msd_handle_control(USBDevice
*dev
, USBPacket
*p
,
350 int request
, int value
, int index
, int length
, uint8_t *data
)
352 MSDState
*s
= (MSDState
*)dev
;
353 SCSIDevice
*scsi_dev
;
356 ret
= usb_desc_handle_control(dev
, p
, request
, value
, index
, length
, data
);
362 case EndpointOutRequest
| USB_REQ_CLEAR_FEATURE
:
364 /* Class specific requests. */
365 case ClassInterfaceOutRequest
| MassStorageReset
:
366 /* Reset state ready for the next CBW. */
367 s
->mode
= USB_MSDM_CBW
;
369 case ClassInterfaceRequest
| GetMaxLun
:
372 scsi_dev
= scsi_device_find(&s
->bus
, 0, 0, maxlun
+1);
373 if (scsi_dev
== NULL
) {
376 if (scsi_dev
->lun
!= maxlun
+1) {
381 DPRINTF("MaxLun %d\n", maxlun
);
383 p
->actual_length
= 1;
386 p
->status
= USB_RET_STALL
;
391 static void usb_msd_cancel_io(USBDevice
*dev
, USBPacket
*p
)
393 MSDState
*s
= USB_STORAGE_DEV(dev
);
395 assert(s
->packet
== p
);
399 scsi_req_cancel(s
->req
);
403 static void usb_msd_handle_data(USBDevice
*dev
, USBPacket
*p
)
405 MSDState
*s
= (MSDState
*)dev
;
407 struct usb_msd_cbw cbw
;
408 uint8_t devep
= p
->ep
->nr
;
409 SCSIDevice
*scsi_dev
;
419 if (p
->iov
.size
!= 31) {
420 error_report("usb-msd: Bad CBW size");
423 usb_packet_copy(p
, &cbw
, 31);
424 if (le32_to_cpu(cbw
.sig
) != 0x43425355) {
425 error_report("usb-msd: Bad signature %08x",
426 le32_to_cpu(cbw
.sig
));
429 DPRINTF("Command on LUN %d\n", cbw
.lun
);
430 scsi_dev
= scsi_device_find(&s
->bus
, 0, 0, cbw
.lun
);
431 if (scsi_dev
== NULL
) {
432 error_report("usb-msd: Bad LUN %d", cbw
.lun
);
435 tag
= le32_to_cpu(cbw
.tag
);
436 s
->data_len
= le32_to_cpu(cbw
.data_len
);
437 if (s
->data_len
== 0) {
438 s
->mode
= USB_MSDM_CSW
;
439 } else if (cbw
.flags
& 0x80) {
440 s
->mode
= USB_MSDM_DATAIN
;
442 s
->mode
= USB_MSDM_DATAOUT
;
444 DPRINTF("Command tag 0x%x flags %08x len %d data %d\n",
445 tag
, cbw
.flags
, cbw
.cmd_len
, s
->data_len
);
446 assert(le32_to_cpu(s
->csw
.residue
) == 0);
448 s
->req
= scsi_req_new(scsi_dev
, tag
, cbw
.lun
, cbw
.cmd
, NULL
);
450 scsi_req_print(s
->req
);
452 len
= scsi_req_enqueue(s
->req
);
454 scsi_req_continue(s
->req
);
458 case USB_MSDM_DATAOUT
:
459 DPRINTF("Data out %zd/%d\n", p
->iov
.size
, s
->data_len
);
460 if (p
->iov
.size
> s
->data_len
) {
465 usb_msd_copy_data(s
, p
);
467 if (le32_to_cpu(s
->csw
.residue
)) {
468 int len
= p
->iov
.size
- p
->actual_length
;
470 usb_packet_skip(p
, len
);
472 if (s
->data_len
== 0) {
473 s
->mode
= USB_MSDM_CSW
;
477 if (p
->actual_length
< p
->iov
.size
) {
478 DPRINTF("Deferring packet %p [wait data-out]\n", p
);
480 p
->status
= USB_RET_ASYNC
;
485 DPRINTF("Unexpected write (len %zd)\n", p
->iov
.size
);
495 case USB_MSDM_DATAOUT
:
496 if (s
->data_len
!= 0 || p
->iov
.size
< 13) {
499 /* Waiting for SCSI write to complete. */
501 p
->status
= USB_RET_ASYNC
;
505 if (p
->iov
.size
< 13) {
510 /* still in flight */
511 DPRINTF("Deferring packet %p [wait status]\n", p
);
513 p
->status
= USB_RET_ASYNC
;
515 usb_msd_send_status(s
, p
);
516 s
->mode
= USB_MSDM_CBW
;
520 case USB_MSDM_DATAIN
:
521 DPRINTF("Data in %zd/%d, scsi_len %d\n",
522 p
->iov
.size
, s
->data_len
, s
->scsi_len
);
524 usb_msd_copy_data(s
, p
);
526 if (le32_to_cpu(s
->csw
.residue
)) {
527 int len
= p
->iov
.size
- p
->actual_length
;
529 usb_packet_skip(p
, len
);
531 if (s
->data_len
== 0) {
532 s
->mode
= USB_MSDM_CSW
;
536 if (p
->actual_length
< p
->iov
.size
) {
537 DPRINTF("Deferring packet %p [wait data-in]\n", p
);
539 p
->status
= USB_RET_ASYNC
;
544 DPRINTF("Unexpected read (len %zd)\n", p
->iov
.size
);
550 DPRINTF("Bad token\n");
552 p
->status
= USB_RET_STALL
;
557 static void usb_msd_password_cb(void *opaque
, int err
)
559 MSDState
*s
= opaque
;
560 Error
*local_err
= NULL
;
563 usb_device_attach(&s
->dev
, &local_err
);
567 error_report_err(local_err
);
568 qdev_unplug(&s
->dev
.qdev
, NULL
);
572 static void *usb_msd_load_request(QEMUFile
*f
, SCSIRequest
*req
)
574 MSDState
*s
= DO_UPCAST(MSDState
, dev
.qdev
, req
->bus
->qbus
.parent
);
576 /* nothing to load, just store req in our state struct */
577 assert(s
->req
== NULL
);
583 static const struct SCSIBusInfo usb_msd_scsi_info_storage
= {
588 .transfer_data
= usb_msd_transfer_data
,
589 .complete
= usb_msd_command_complete
,
590 .cancel
= usb_msd_request_cancelled
,
591 .load_request
= usb_msd_load_request
,
594 static const struct SCSIBusInfo usb_msd_scsi_info_bot
= {
599 .transfer_data
= usb_msd_transfer_data
,
600 .complete
= usb_msd_command_complete
,
601 .cancel
= usb_msd_request_cancelled
,
602 .load_request
= usb_msd_load_request
,
605 static void usb_msd_realize_storage(USBDevice
*dev
, Error
**errp
)
607 MSDState
*s
= USB_STORAGE_DEV(dev
);
608 BlockBackend
*blk
= s
->conf
.blk
;
609 SCSIDevice
*scsi_dev
;
613 error_setg(errp
, "drive property not set");
618 bdrv_add_key(blk_bs(blk
), NULL
, &err
);
620 if (monitor_cur_is_qmp()) {
621 error_propagate(errp
, err
);
627 monitor_read_bdrv_key_start(cur_mon
, blk_bs(blk
),
628 usb_msd_password_cb
, s
);
629 s
->dev
.auto_attach
= 0;
636 blkconf_serial(&s
->conf
, &dev
->serial
);
637 blkconf_blocksizes(&s
->conf
);
640 * Hack alert: this pretends to be a block device, but it's really
641 * a SCSI bus that can serve only a single device, which it
642 * creates automatically. But first it needs to detach from its
643 * blockdev, or else scsi_bus_legacy_add_drive() dies when it
646 * The hack is probably a bad idea.
648 blk_detach_dev(blk
, &s
->dev
.qdev
);
651 usb_desc_create_serial(dev
);
653 scsi_bus_new(&s
->bus
, sizeof(s
->bus
), DEVICE(dev
),
654 &usb_msd_scsi_info_storage
, NULL
);
655 scsi_dev
= scsi_bus_legacy_add_drive(&s
->bus
, blk
, 0, !!s
->removable
,
656 s
->conf
.bootindex
, dev
->serial
,
659 error_propagate(errp
, err
);
662 usb_msd_handle_reset(dev
);
663 s
->scsi_dev
= scsi_dev
;
666 static void usb_msd_realize_bot(USBDevice
*dev
, Error
**errp
)
668 MSDState
*s
= USB_STORAGE_DEV(dev
);
670 usb_desc_create_serial(dev
);
672 scsi_bus_new(&s
->bus
, sizeof(s
->bus
), DEVICE(dev
),
673 &usb_msd_scsi_info_bot
, NULL
);
674 usb_msd_handle_reset(dev
);
677 static USBDevice
*usb_msd_init(USBBus
*bus
, const char *filename
)
688 /* parse -usbdevice disk: syntax into drive opts */
690 snprintf(id
, sizeof(id
), "usb%d", nr
++);
691 opts
= qemu_opts_create(qemu_find_opts("drive"), id
, 1, NULL
);
694 p1
= strchr(filename
, ':');
698 if (strstart(filename
, "format=", &p2
)) {
699 int len
= MIN(p1
- p2
, sizeof(fmt
));
700 pstrcpy(fmt
, len
, p2
);
701 qemu_opt_set(opts
, "format", fmt
, &error_abort
);
702 } else if (*filename
!= ':') {
703 error_report("unrecognized USB mass-storage option %s", filename
);
709 error_report("block device specification needed");
712 qemu_opt_set(opts
, "file", filename
, &error_abort
);
713 qemu_opt_set(opts
, "if", "none", &error_abort
);
715 /* create host drive */
716 dinfo
= drive_new(opts
, 0);
722 /* create guest device */
723 dev
= usb_create(bus
, "usb-storage");
724 qdev_prop_set_drive(&dev
->qdev
, "drive", blk_by_legacy_dinfo(dinfo
),
727 error_report_err(err
);
728 object_unparent(OBJECT(dev
));
734 static const VMStateDescription vmstate_usb_msd
= {
735 .name
= "usb-storage",
737 .minimum_version_id
= 1,
738 .fields
= (VMStateField
[]) {
739 VMSTATE_USB_DEVICE(dev
, MSDState
),
740 VMSTATE_UINT32(mode
, MSDState
),
741 VMSTATE_UINT32(scsi_len
, MSDState
),
742 VMSTATE_UINT32(scsi_off
, MSDState
),
743 VMSTATE_UINT32(data_len
, MSDState
),
744 VMSTATE_UINT32(csw
.sig
, MSDState
),
745 VMSTATE_UINT32(csw
.tag
, MSDState
),
746 VMSTATE_UINT32(csw
.residue
, MSDState
),
747 VMSTATE_UINT8(csw
.status
, MSDState
),
748 VMSTATE_END_OF_LIST()
752 static Property msd_properties
[] = {
753 DEFINE_BLOCK_PROPERTIES(MSDState
, conf
),
754 DEFINE_PROP_BIT("removable", MSDState
, removable
, 0, false),
755 DEFINE_PROP_END_OF_LIST(),
758 static void usb_msd_class_initfn_common(ObjectClass
*klass
, void *data
)
760 DeviceClass
*dc
= DEVICE_CLASS(klass
);
761 USBDeviceClass
*uc
= USB_DEVICE_CLASS(klass
);
763 uc
->product_desc
= "QEMU USB MSD";
764 uc
->usb_desc
= &desc
;
765 uc
->cancel_packet
= usb_msd_cancel_io
;
766 uc
->handle_attach
= usb_desc_attach
;
767 uc
->handle_reset
= usb_msd_handle_reset
;
768 uc
->handle_control
= usb_msd_handle_control
;
769 uc
->handle_data
= usb_msd_handle_data
;
770 set_bit(DEVICE_CATEGORY_STORAGE
, dc
->categories
);
771 dc
->fw_name
= "storage";
772 dc
->vmsd
= &vmstate_usb_msd
;
775 static void usb_msd_class_initfn_storage(ObjectClass
*klass
, void *data
)
777 DeviceClass
*dc
= DEVICE_CLASS(klass
);
778 USBDeviceClass
*uc
= USB_DEVICE_CLASS(klass
);
780 uc
->realize
= usb_msd_realize_storage
;
781 dc
->props
= msd_properties
;
784 static void usb_msd_get_bootindex(Object
*obj
, Visitor
*v
, const char *name
,
785 void *opaque
, Error
**errp
)
787 USBDevice
*dev
= USB_DEVICE(obj
);
788 MSDState
*s
= USB_STORAGE_DEV(dev
);
790 visit_type_int32(v
, name
, &s
->conf
.bootindex
, errp
);
793 static void usb_msd_set_bootindex(Object
*obj
, Visitor
*v
, const char *name
,
794 void *opaque
, Error
**errp
)
796 USBDevice
*dev
= USB_DEVICE(obj
);
797 MSDState
*s
= USB_STORAGE_DEV(dev
);
799 Error
*local_err
= NULL
;
801 visit_type_int32(v
, name
, &boot_index
, &local_err
);
805 /* check whether bootindex is present in fw_boot_order list */
806 check_boot_index(boot_index
, &local_err
);
810 /* change bootindex to a new one */
811 s
->conf
.bootindex
= boot_index
;
814 object_property_set_int(OBJECT(s
->scsi_dev
), boot_index
, "bootindex",
820 error_propagate(errp
, local_err
);
824 static const TypeInfo usb_storage_dev_type_info
= {
825 .name
= TYPE_USB_STORAGE
,
826 .parent
= TYPE_USB_DEVICE
,
827 .instance_size
= sizeof(MSDState
),
829 .class_init
= usb_msd_class_initfn_common
,
832 static void usb_msd_instance_init(Object
*obj
)
834 object_property_add(obj
, "bootindex", "int32",
835 usb_msd_get_bootindex
,
836 usb_msd_set_bootindex
, NULL
, NULL
, NULL
);
837 object_property_set_int(obj
, -1, "bootindex", NULL
);
840 static void usb_msd_class_initfn_bot(ObjectClass
*klass
, void *data
)
842 USBDeviceClass
*uc
= USB_DEVICE_CLASS(klass
);
843 DeviceClass
*dc
= DEVICE_CLASS(klass
);
845 uc
->realize
= usb_msd_realize_bot
;
846 dc
->hotpluggable
= false;
849 static const TypeInfo msd_info
= {
850 .name
= "usb-storage",
851 .parent
= TYPE_USB_STORAGE
,
852 .class_init
= usb_msd_class_initfn_storage
,
853 .instance_init
= usb_msd_instance_init
,
856 static const TypeInfo bot_info
= {
858 .parent
= TYPE_USB_STORAGE
,
859 .class_init
= usb_msd_class_initfn_bot
,
862 static void usb_msd_register_types(void)
864 type_register_static(&usb_storage_dev_type_info
);
865 type_register_static(&msd_info
);
866 type_register_static(&bot_info
);
867 usb_legacy_register("usb-storage", "disk", usb_msd_init
);
870 type_init(usb_msd_register_types
)