Re: [linux-usb-devel] how to detect SD card under linux

2007-07-09 Thread Alan Stern
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: 22272228
  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/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] how to detect SD card under linux

2007-07-09 Thread Pete Zaitcev
On Mon, 9 Jul 2007 10:52:05 -0400 (EDT), Alan Stern [EMAIL PROTECTED] wrote:

   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.

Actually, HAL is entirely optional. It provides the interfaces needed
for the GUI. So, the events follow thus:
 - khubd polls hub status and knows the state change
 - khubd isses hotplug request (used to be an exec, netlink now)
 - udev listens and gets the add event with arguments including
   the alias string
 - udev runs modprobe with alias string
 - modprobe loads the driver; its context runs module init, which
   usually registers something and this walks pre-scanned buses and
   registers things (if ub); forks threads for usb-storage.
 - SCSI scans add SCSI buses then
 - There's one more round of add events, which add sd/sg/st in the
   same fashion

Now you can run mount or dd. This is the point where HAL gets involved.
It polls for new leaf devices (e.g. storage volumes, webcams, etc.),
builds the tree with properties, and posts updates to D-bus where
Nautilus/Tomboy/etc. can fetch them.

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

That's right. Partitions are scanned when the whole device is open.
HAL substitutes for that on a typical desktop.

This is actually something that udev sort of broke. The kernel code
would scan partitions for you even if you tried to open a slice.
However, you cannot do it on dynamic /dev because udev hasn't created
the slice nodes, and it won't do it until partitions are scanned.
Embedded devices usually just run static /dev for that purpose.
Heck, some even use ub with static /dev. The fewer threads, the better.

-- Pete

-
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/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] how to detect SD card under linux

2007-07-09 Thread jian tao
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: 22272228
   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 0x8011 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 0x8011 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/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] how to detect SD card under linux

2007-07-09 Thread Alan Stern
On Tue, 10 Jul 2007, jian tao wrote:

 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.

Maybe.

 You mentioned HAL (hardware abstract layer, right?), how can get more
 detail about it?

http://www.freedesktop.org/wiki/Software/hal

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

This log shows that LUN 0 has no media present.  Probably your reader 
puts SD cards on a higher LUN.  Make sure you have set 
CONFIG_SCSI_MULTI_LUN to Y.

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/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] how to detect SD card under linux

2007-07-09 Thread jian tao
On 7/10/07, Alan Stern [EMAIL PROTECTED] wrote:
 On Tue, 10 Jul 2007, jian tao wrote:

  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.

 Maybe.

  You mentioned HAL (hardware abstract layer, right?), how can get more
  detail about it?

 http://www.freedesktop.org/wiki/Software/hal

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

 This log shows that LUN 0 has no media present.  Probably your reader
 puts SD cards on a higher LUN.  Make sure you have set
 CONFIG_SCSI_MULTI_LUN to Y.

Thanks, the problem is solved.

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/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] how to detect SD card under linux

2007-07-08 Thread jian tao
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.

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

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

 Thanks
 Paul.Tao

 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: 22272228
 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

-
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/
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel