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

udev access to SD card after using USBStorageDriver.write_image() #1539

Open
csf-k opened this issue Nov 6, 2024 · 1 comment
Open

udev access to SD card after using USBStorageDriver.write_image() #1539

csf-k opened this issue Nov 6, 2024 · 1 comment

Comments

@csf-k
Copy link

csf-k commented Nov 6, 2024

If I set the mode of a SDMux from “host” to “dut” directly after using the write_image() method of labgrid.driver.usbsdmuxdriver, I get the following error message in dmesg:

[426904.365303] sdb: detected capacity change from 0 to 15704064
[426904.365817]  sdb: sdb1 sdb2
[426922.583978]  sdb: sdb1 sdb2
[426922.841343] sd 1:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=DRIVER_OK cmd_age=0s
[426922.841360] sd 1:0:0:0: [sdb] tag#0 Sense Key : 0x3 [current] 
[426922.841364] sd 1:0:0:0: [sdb] tag#0 ASC=0x11 ASCQ=0x0 
[426922.841370] sd 1:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 00 00 03 08 00 00 f0 00
[426922.841374] critical medium error, dev sdb, sector 776 op 0x0:(READ) flags 0x84700 phys_seg 30 prio class 2
[426922.842150] sd 1:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=DRIVER_OK cmd_age=0s
[426922.842155] sd 1:0:0:0: [sdb] tag#0 Sense Key : 0x2 [current] 
[426922.842159] sd 1:0:0:0: [sdb] tag#0 ASC=0x3a ASCQ=0x0 
[426922.842163] sd 1:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 00 00 03 f8 00 00 08 00
[426922.842166] I/O error, dev sdb, sector 1016 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 2
[426922.843641] sd 1:0:0:0: [sdb] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x00 driverbyte=DRIVER_OK cmd_age=0s
[426922.843652] sd 1:0:0:0: [sdb] tag#0 Sense Key : 0x2 [current] 
[426922.843656] sd 1:0:0:0: [sdb] tag#0 ASC=0x3a ASCQ=0x0 
[426922.843661] sd 1:0:0:0: [sdb] tag#0 CDB: opcode=0x28 28 00 00 00 03 08 00 00 08 00
[426922.843664] I/O error, dev sdb, sector 776 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
[426922.843671] Buffer I/O error on dev sdb, logical block 97, async page read
[426922.849734] sdb: detected capacity change from 15704064 to 0

When investigating the cause of the error, I noticed that after write_image() the SD card is idle for approx. 100ms before it is used by udev for approx. 200ms. After that the SD card remains idle.

What is the recommended procedure to ensure that after executing write_image() the SD card is no longer used and it is safe to set the mode of the SDMux from "host" to "dut"?

@Emantor
Copy link
Member

Emantor commented Dec 2, 2024

I wonder if this depends on the SD card or the SDMux. This should be fixed either in kernel (which shouldn't make the device available to userspace before it is usable) or the hardware itself if this is a hardware issue.

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

No branches or pull requests

2 participants