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

SCSI Read Capacity reports wrong capacity when used with USB Mass storage device #77175

Closed
ademers-axceta opened this issue Aug 16, 2024 · 1 comment · Fixed by #77173
Closed
Assignees
Labels
area: USB Universal Serial Bus bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@ademers-axceta
Copy link
Contributor

ademers-axceta commented Aug 16, 2024

Describe the bug
When a device is configured as a USB Mass Storage device, is sometimes report a wrong capacity to the host computer through
the SCSI Read Capacity command.

To Reproduce
Steps to reproduce the behavior:

  1. Configure a development board using STM32U585 CPU with USB Mass Storage function
  2. Connect that development kit to a host computer running Linux
  3. The computer may not see the device, or see it with a capacity that does not match what is expected (see dmesg output)
  4. If you are using a Linux computer, the following command will show the reported capacity of the mass storage device: 'sudo sg_readcap /dev/sdX'. You should be able to see the wrong capacity reported there.

Expected behavior
We expect the host computer to obtain valid capacity values for USB mass storages devices that are connected

Impact
It renders the USB mass storage litteraly unusable

Logs
Dmesg output on the host computer:

[61240.809883] sd 2:0:0:0: Attached scsi generic sg1 type 0
[61240.810439] sd 2:0:0:0: [sdb] Unsupported sector size 263520264.
[61240.812816] sd 2:0:0:0: [sdb] 0 512-byte logical blocks: (0 B/0 B)
[61240.812825] sd 2:0:0:0: [sdb] 263520264-byte physical blocks
[61240.813034] sd 2:0:0:0: [sdb] Write Protect is off
[61240.813040] sd 2:0:0:0: [sdb] Mode Sense: 0f b5 00 08
[61240.813250] sd 2:0:0:0: [sdb] No Caching mode page found
[61240.813256] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[61240.813645] sd 2:0:0:0: [sdb] Attached SCSI removable disk

Environment

  • OS: Linux
  • Zephyr SDK
  • Commit SHA: 0d56a3c
@ademers-axceta ademers-axceta added the bug The issue is a bug, or the PR is fixing a bug label Aug 16, 2024
Copy link

Hi @ademers-axceta! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: USB Universal Serial Bus bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants