Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve USB MSC initiator support #496

Merged
merged 6 commits into from
Jan 9, 2025
Merged

Improve USB MSC initiator support #496

merged 6 commits into from
Jan 9, 2025

Conversation

PetteriAimonen
Copy link
Collaborator

Made the USB MSC initiator mode more robust.

Tested against ST-296N drive that has a large amount of bad blocks with ddrescue.
Reading is slow because of a lot of medium errors reported by the drive, but is able to correctly handle the error statuses and transfer progresses.

Early exit all functions when no drives have been found.
This avoids watchdog timeouts when USB host keeps polling.
SCSI spec allows CD/MSG/IO signals to change state between
byte transfers. Previously this would cause initiator mode
to abort transfer.

On Seagate ST-296N it was observed that 6 µs long glitches on
IO signal occur when the drive is trying to perform bad sector
recovery.

This commit uses a combination of methods to tolerate glitches
on these signals, while still aborting the transfer if it hangs.
There is no need to fail a read when the drive reports RECOVERED_ERROR.
Was running out of RAM.
Moved initiator mode main loop to flash, it doesn't really affect performance.
Convert sense key to textual description.
For example:

-- SCSI Initiator read on target 0 failed with status -1 and sense_key 0x03 (MEDIUM_ERROR)

for drive reported medium errors.
@aperezbios aperezbios merged commit 82b157d into main Jan 9, 2025
2 checks passed
@aperezbios aperezbios deleted the dev_usb_msc_init2 branch January 9, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants