AnsweredAssumed Answered

How a SD card is mounted over a USB bus as SCSI device

Question asked by mrigendra chaubey on Feb 22, 2019
Latest reply on Feb 24, 2019 by igorpadykov

I have a sd card which is connected on a microchip usb224x controller on im6qp processor based board.

SD signals are going to be converted in a USB dp and dm signal.
Now there are two use cases,


use case1: SD card is already inserted before power on,

sd 0:0:0:0: [sda] 249737216 512-byte logical blocks: (128 GB/119 GiB)

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] No Caching mode page found

sd 0:0:0:0: [sda] Assuming drive cache: write through

sda: sda1

sd 0:0:0:0: [sda] Attached SCSI removable disk

 

Now if I remove SD card I don't get any kernel print which says that card is removed.

 

usecase2: SD card is inserted at running kernel.
No print comes that says that SD card is detected as sda.

 

In case 1, I can mount this SD card and access its contents.In case2 I cannot.

I have this question/confusion

1. Is user space responsible such as udev to tell if a device is present or not? I tried putting prints in many usb core files and none prints anything. However at the same time I am able to get interrupts on touch device that is using same usb bus but another channel.

 

I tried getting prints in usb functions in drivers/usb,storage and scsi subsysystem, but no observable prints came.

 

I tried enabling debugfs prints but I am getting no log even then and thats another issue which I am unable to resolve.

 

Main problem is I am getting no idea how and who initiates this change of removal and insertion, is it a low level kernel driver which looks for an interrupt and initiate the whole thing or udev such as /sbin/hotplug?

 

Kindly help as I am getting no clue and clarity here of prerequisites to make it work. Any debug pointers will be helpful.

Outcomes