
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:
- Configure a development board using STM32U585 CPU with USB Mass Storage function
- Connect that development kit to a host computer running Linux
- The computer may not see the device, or see it with a capacity that does not match what is expected (see
dmesg
output) - 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