Re: how to detect SD card under linux

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Mon, 9 Jul 2007, jian tao wrote:

> Hi pals,
> 
> I am a new guy of linux usb driver. I met a problem with detecting SD
> card under linux2.6.11. My developing board: MPC8349 EHCI host -->
> ISP1505 (usb PHY) --->USB2227 (SMSC Flash card Reader chip). When
> linux booting, i would success to detect usb2227 see below log.
>  Then i plug in SD card, nothing could happen, it fail to find scsi
> device. I know there would be three kernel threads to polling current
> usb status. One is "hub_thread" to polling port status; one is
> "usb_stor_control_thread" to dealing with scsi cmd; another is
> "usb_stor_scan_thread" to scan scsi devie.
> 
>  Question1:
>  when i plug SD card in USB2227 card reader, which thread would
> responsible such event? i guess it must be the "usb_stor_scan_thread".

No.  None of the threads you listed is responsible.  In practice the 
detection is done by HAL, a userspace daemon.

>  Question2:
> The function sd_probe would be called when a new scsi device attached.
> What is the relationship between daemon process and this function?

Which daemon process are you talking about?  In general there is no
connection between any daemons and sd_probe.

>  Question3:
>  What may the main cause of such issue? (suppose no hardware issue)

Your question isn't clear.  Are you asking why the kernel does not 
detect the SCSI device?  But it _does_ detect the SCSI device, as you 
can see from your own log:

>  LOG:
>  Initializing USB Mass Storage driver...
>  usb 1-1: new high speed USB device using fsl-usb2-mph and address 2
>  usb 1-1: Product: Flash Card Reader
>  usb 1-1: Manufacturer: Generic
>  usb 1-1: SerialNumber: 000022272228
>  Begain run the storage_probe function
>  USB Mass Storage device detected
>  scsi1 : SCSI emulation for USB Mass Storage devices
>  usbcore: registered new driver usb-storage
>  USB Mass Storage support registered.
>  .....
>    Vendor: Generic   Model: Flash HS-CF       Rev: 3.95
>    Type:   Direct-Access                      ANSI SCSI revision: 00
>  Attached scsi removable disk sdb at scsi1, channel 0, id 0, lun 0

The last line shows that the kernel has detected a SCSI disk.

Are you asking why the SD card wasn't detected when you put in in the 
reader?  Probably because you weren't running HAL.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.