Expand description
§cotton-scsi
Part of the Cotton project.
Actual SCSI hardware is rarely seen these days. But the command protocols live on, and are important for USB mass-storage class (USB storage devices) when tunnelled over USB and for CD-ROM when tunnelled over ATAPI.
This crate so far implements only those commands important for “direct storage access devices” (disks and flash-drives), but the mechanisms should be generic to all SCSI commands, such as for optical drives.
The most accessible reference for SCSI commands for disks (or other direct storage) is the “Seagate SCSI Commands Reference Manual” found at https://www.seagate.com/files/staticfiles/support/docs/manual/Interface%20manuals/100293068j.pdf
§Using cotton-scsi
Firstly you need to get hold of an implementation of the trait
ScsiTransport – either the implementation of USB mass-storage
class provided by the cotton-usb-host-msc crate, or your own new one.
Then, construct a ScsiDevice from your ScsiTransport. You can then
call ScsiDevice::inquiry to determine what sort of SCSI device you
have. If it’s of type PeripheralType::Disk then you’re in luck: you
can construct a ScsiBlockDevice from your ScsiDevice and start reading
and writing sectors.
If your device isn’t a PeripheralType::Disk – perhaps it’s a
PeripheralType::Optical or something else – then you’ll need to
send and receive SCSI commands more manually, using
ScsiDevice::command_response; you can examine the implementation
of methods such as ScsiDevice::read_capacity_10 to see what that
needs to look like.
Re-exports§
pub use scsi_device::PeripheralType;pub use scsi_device::ScsiDevice;pub use scsi_transport::Error;pub use scsi_transport::ScsiTransport;pub use async_block_device::AsyncBlockDevice;pub use async_block_device::DeviceInfo;pub use scsi_block_device::ScsiBlockDevice;
Modules§
- async_
block_ device - A generic asynchronous block device with a “read/write blocks” interface
- scsi_
block_ device - Implementing AsyncBlockDevice in terms of ScsiDevice
- scsi_
device - A generic SCSI device
- scsi_
transport - An abstract communication channel with a SCSI device