Re: how to detect SD card under linux

"jian tao" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On 7/9/07, Alan Stern <[email protected]> wrote:
> 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.

Yes, the SD card wasn't detected even i plug SD card in reader first
and then boot up linux kernel. From dmesg, it seems to me SD fail to
reply host TEST_UNIT_READY command. Maybe it is the problem between
USB2227 and SD card.
You mentioned HAL (hardware abstract layer, right?), how can get more
detail about it?

usb-storage: *** thread awakened.
usb-storage: Command TEST_UNIT_READY (6 bytes)
usb-storage:  00 00 00 00 00 00
usb-storage: Bulk Command S 0x43425355 T 0x11 L 0 F 0 Trg 0 LUN 0 CL 6
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0x11 R 0 Stat 0x1
usb-storage: -- transport indicates command failure
usb-storage: Issuing auto-REQUEST_SENSE
usb-storage: Bulk Command S 0x43425355 T 0x80000011 L 18 F 128 Trg 0 LUN 0 CL 6
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes
usb-storage: Status code 0; transferred 31/31
usb-storage: -- transfer complete
usb-storage: Bulk command transfer result=0
usb-storage: usb_stor_bulk_transfer_buf: xfer 18 bytes
usb-storage: Status code 0; transferred 18/18
usb-storage: -- transfer complete
usb-storage: Bulk data transfer result 0x0
usb-storage: Attempting to get CSW...
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes
usb-storage: Status code 0; transferred 13/13
usb-storage: -- transfer complete
usb-storage: Bulk status result = 0
usb-storage: Bulk Status S 0x53425355 T 0x80000011 R 0 Stat 0x0
usb-storage: -- Result from auto-sense is 0
usb-storage: -- code: 0x70, key: 0x2, ASC: 0x3a, ASCQ: 0x0
usb-storage: Not Ready: Medium not present
usb-storage: scsi cmd done, result=0x2
usb-storage: *** thread sleeping.

Paul

-------------------------------------------------------------------------
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.