Skip to content

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

Closed
@ghost

Description

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

Metadata

Metadata

Assignees

Labels

area: USBUniversal Serial BusbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions