Crates.io | cotton-scsi |
lib.rs | cotton-scsi |
version | |
source | src |
created_at | 2024-12-02 13:14:30.055285 |
updated_at | 2024-12-02 13:14:30.055285 |
description | SCSI commands and abstractions |
homepage | https://github.com/pdh11/cotton |
repository | https://github.com/pdh11/cotton |
max_upload_size | |
id | 1468629 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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
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.