USBh-SCSI
A userspace library for sending SCSI commands to USB Mass Storage devices via the Bulk-Only Transport (BOT) protocol.
Unlike traditional approaches, this crate does not depend on the operating
system’s block device or filesystem layers. Instead, it provides a pure-Rust
API for constructing and executing standard SCSI command blocks directly over
USB, making it portable across all platforms supported by rusb.
Goals
- Cross-platform support (Linux, macOS, Windows, etc. via
rusb). - Easy construction and execution of SCSI commands such as
INQUIRY,READ CAPACITY (10),READ(10), andWRITE(10). - Clean abstractions for both raw transport and block-level access.
Core Modules
commands— strongly-typed definitions of SCSI commands and theCommandBlocktrait for generating Command Descriptor Blocks (CDBs).storage— device discovery, opening/closing devices, bulk I/O, and SCSI command execution over USB BOT. IncludesUsbBlockDevicefor sector-oriented reads/writes.
Usage
Add to your Cargo.toml:
Example
use UsbMassStorage;
use InquiryCommand;
use Direction;
use Error;
When to Use
- Use
usbh-scsiif you want raw SCSI access to USB devices (e.g. discovering capacity, issuing reads/writes, or building custom tooling). - Use
usbh-fatfsif you want a filesystem-aware interface for working directly with FAT partitions on USB devices.
Supported Platforms
Works on any platform supported by rusb.