Bug 14228

Summary: EHCI dont recognize USB card reader Alcor 058f:6366
Product: Drivers Reporter: Alexey (dencorpos)
Component: USBAssignee: Greg Kroah-Hartman (greg)
Status: RESOLVED INVALID    
Severity: normal CC: bugzilla.kernel.org
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.31.1 Subsystem:
Regression: No Bisected commit-id:

Description Alexey 2009-09-25 15:10:12 UTC
There is a bug in ehci-hcd module.

System don't recognize SD flash card when I insert it into Alcor 058f:6366 USB card reader (it presents in Samsung Q210 notebook). There is nothing appears in dmesg.

I found a solution but that's not good: insert flash card and type `rmmod ehci-hcd && modprobe ehci-hcd`
Comment 1 Andrew Morton 2009-09-30 21:25:52 UTC
(switched to email.  Please respond via emailed reply-to-all, not via the
bugzilla web interface).

On Fri, 25 Sep 2009 15:10:13 GMT
bugzilla-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=14228
> 
>            Summary: EHCI dont recognize USB card reader Alcor 058f:6366
>            Product: Drivers
>            Version: 2.5
>     Kernel Version: 2.6.31.1
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: USB
>         AssignedTo: greg@kroah.com
>         ReportedBy: dencorpos@gmail.com
>         Regression: No
> 
> 
> There is a bug in ehci-hcd module.
> 
> System don't recognize SD flash card when I insert it into Alcor 058f:6366
> USB
> card reader (it presents in Samsung Q210 notebook). There is nothing appears
> in
> dmesg.
> 
> I found a solution but that's not good: insert flash card and type `rmmod
> ehci-hcd && modprobe ehci-hcd`
Comment 2 Alan Stern 2009-10-01 18:53:45 UTC
On Wed, 30 Sep 2009, Andrew Morton wrote:

> > http://bugzilla.kernel.org/show_bug.cgi?id=14228
> > 
> >            Summary: EHCI dont recognize USB card reader Alcor 058f:6366

> > There is a bug in ehci-hcd module.

Why do you think that's where the bug is?  And why do you think there 
is a bug in the first place?

> > System don't recognize SD flash card when I insert it into Alcor 058f:6366
> USB
> > card reader (it presents in Samsung Q210 notebook). There is nothing
> appears in
> > dmesg.

Why should there be anything in dmesg?  Are you running a program like 
hal which will constantly probe the card reader to see if a card has 
been inserted?

> > I found a solution but that's not good: insert flash card and type `rmmod
> > ehci-hcd && modprobe ehci-hcd`

Probably all you have to do is insert the card and then run (as root):

	blockdev --rereadpt /dev/sdN

where you replace N with the actual drive letter for the card reader.

However if you think this should happen automatically and you want to 
find out why it doesn't, then you should use usbmon to trace the USB 
communications.  Instructions are in the kernel source file 
Documentation/usb/usbmon.txt.

Alan Stern
Comment 3 Alexey 2009-10-04 11:11:09 UTC
Alan Stern wrote:
> On Wed, 30 Sep 2009, Andrew Morton wrote:
>
>   
>>> http://bugzilla.kernel.org/show_bug.cgi?id=14228
>>>
>>>            Summary: EHCI dont recognize USB card reader Alcor 058f:6366
>>>       
>
>   
>>> There is a bug in ehci-hcd module.
>>>       
>
> Why do you think that's where the bug is?  And why do you think there 
> is a bug in the first place?
>
>   
>>> System don't recognize SD flash card when I insert it into Alcor 058f:6366
>>> USB
>>> card reader (it presents in Samsung Q210 notebook). There is nothing
>>> appears in
>>> dmesg.
>>>       
>
> Why should there be anything in dmesg?  Are you running a program like 
> hal which will constantly probe the card reader to see if a card has 
> been inserted?
>
>   
Today I try to insert a card after typing 'rmmod ehci-hcd'. But it
hasn't result.
Then it shouldn't be bug in ehci-hcd, but where?

Yes, I'm running hal and if I insert a simple USB flash then message
about it appears in dmesg.

>>> I found a solution but that's not good: insert flash card and type `rmmod
>>> ehci-hcd && modprobe ehci-hcd`
>>>       
>
> Probably all you have to do is insert the card and then run (as root):
>
>       blockdev --rereadpt /dev/sdN
>
> where you replace N with the actual drive letter for the card reader.
>
> However if you think this should happen automatically and you want to 
> find out why it doesn't, then you should use usbmon to trace the USB 
> communications.  Instructions are in the kernel source file 
> Documentation/usb/usbmon.txt.
>
> Alan Stern
>
>
>   
I tried to "blockdev --rereadpt /dev/sdb" but it says that "/dev/sdb: no
storage found".

This is part of 'dmesg' that describes card reader (only uhci-hcd loaded):

usb-storage: device scan complete
scsi 7:0:0:0: Direct-Access     Multi    Flash Reader     1.00 PQ: 0 ANSI: 0
sd 7:0:0:0: Attached scsi generic sg2 type 0
sd 7:0:0:0: [sdb] Attached SCSI removable disk

This is part of 'dmesg' that describes card reader (both uhci-hcd and
ehci-hcd loaded):
usb-storage: device scan complete
scsi 8:0:0:0: Direct-Access     Multi    Flash Reader     1.00 PQ: 0 ANSI: 0
sd 8:0:0:0: Attached scsi generic sg2 type 0
sd 8:0:0:0: [sdb] Attached SCSI removable disk
-------------------------------------------------------------------------------------------------------
This is part of 'lsusb -vvv' that describes card reader (both ehci-hcd
and uhci-hcd loaded):
Bus 001 Device 003: ID 058f:6366 Alcor Micro Corp.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x058f Alcor Micro Corp.
  idProduct          0x6366
  bcdDevice            1.00
  iManufacturer           1 Generic
  iProduct                2 Mass Storage Device
  iSerial                 3 058F0O1111B1
  bNumConfigurations      1
Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)

--------------------------------------------------------------------------------------------

P.S. I'm sorry for my English.
Comment 4 Alan Stern 2009-10-04 15:51:06 UTC
On Sun, 4 Oct 2009, Alexey wrote:

> Today I try to insert a card after typing 'rmmod ehci-hcd'. But it
> hasn't result.
> Then it shouldn't be bug in ehci-hcd, but where?

Maybe a bug in the card reader.

> Yes, I'm running hal and if I insert a simple USB flash then message
> about it appears in dmesg.

You should collect a usbmon trace showing what happens when the card 
reader is plugged in, as I suggested earlier.

Alan Stern
Comment 5 Alexey 2009-10-09 15:48:15 UTC
I made traces with usbmon.
I can't found a bus with card reader and I got data from
/sys/kernel/debug/usb/usbmon/0u
Before that I unload all modules of my usb devices (and blacklist it):
uvcvideo
videodev
v4l1_compat
usbhid
hid
btusb
usb-storage

`cat /sys/kernel/debug/usb/usbmon/0u > 0u.out` was give no data at all.
It's normal because all modules uses usb unloaded.
After that I did `modprobe usb-storage` and `cat
/sys/kernel/debug/usb/usbmon/0u > new_0u.out`. The card reader had empty
slot at the moment. Still 5 sec I stopped logging.
Then I did `cat /sys/kernel/debug/usb/usbmon/0u > new_0u_pl_ej.out` and
inserted card and ejected it. After that stopped logging.
And after that I inserted card and did `cat
/sys/kernel/debug/usb/usbmon/0u > new_0u_rel_pl_ej.out` and in other
console `rmmod ehci-hcd && modprobe ehci-hcd`. Still 10 secs I ejected
flash card and stopped logging.

I attached files new_0u.out, new_0u_pl_ej.out, new_0u_rel_pl_ej.out to
the message.


Can I do anything else to help to resolve that problem?


P.S. I'm sorry for my English.
Comment 6 Alan Stern 2009-10-13 15:21:26 UTC
On Fri, 9 Oct 2009, Alexey wrote:

> I made traces with usbmon.
> I can't found a bus with card reader and I got data from
> /sys/kernel/debug/usb/usbmon/0u
> Before that I unload all modules of my usb devices (and blacklist it):
> uvcvideo
> videodev
> v4l1_compat
> usbhid
> hid
> btusb
> usb-storage

Sorry it took a while to get back to you.

> `cat /sys/kernel/debug/usb/usbmon/0u > 0u.out` was give no data at all.
> It's normal because all modules uses usb unloaded.
> After that I did `modprobe usb-storage` and `cat
> /sys/kernel/debug/usb/usbmon/0u > new_0u.out`. The card reader had empty
> slot at the moment. Still 5 sec I stopped logging.
> Then I did `cat /sys/kernel/debug/usb/usbmon/0u > new_0u_pl_ej.out` and
> inserted card and ejected it. After that stopped logging.

You should leave the card in the slot for at least 10 seconds or so.  
hal checks every two seconds to see if a card has been inserted.  The 
usbmon trace shows that no card was detected.

> And after that I inserted card and did `cat
> /sys/kernel/debug/usb/usbmon/0u > new_0u_rel_pl_ej.out` and in other
> console `rmmod ehci-hcd && modprobe ehci-hcd`. Still 10 secs I ejected
> flash card and stopped logging.

This file shows that the card was detected and was working correctly.  
There should have been a message about it in the dmesg log.  The usbmon 
trace shows that the card claims to hold about 7.8 GB.

> I attached files new_0u.out, new_0u_pl_ej.out, new_0u_rel_pl_ej.out to
> the message.

Alan Stern
Comment 7 Alexey 2009-10-13 18:23:55 UTC
Alan Stern wrote:
> You should leave the card in the slot for at least 10 seconds or so.  
> hal checks every two seconds to see if a card has been inserted.  The 
> usbmon trace shows that no card was detected.
>
>   
I has made a new trace.
I started logging and insert the card. Still 20 secs or so I ejected the
card and stopped logging.
I attached this log to the message. But it contains records that
presents in the first and the second logs only.
> This file shows that the card was detected and was working correctly.  
> There should have been a message about it in the dmesg log.  The usbmon 
> trace shows that the card claims to hold about 7.8 GB.
>
>   
Yes, there is info about the card in dmesg. It's capacity was determined
correctly.

P.S.  I'm sorry for my English.
Comment 8 Alexey 2009-10-13 18:24:58 UTC
Alan Stern wrote:
> You should leave the card in the slot for at least 10 seconds or so.  
> hal checks every two seconds to see if a card has been inserted.  The 
> usbmon trace shows that no card was detected.
>
>   
I has made a new trace.
I started logging and insert the card. Still 20 secs or so I ejected the
card and stopped logging.
I attached this log to the message. But it contains records that
presents in the first and the second logs only.
> This file shows that the card was detected and was working correctly.  
> There should have been a message about it in the dmesg log.  The usbmon 
> trace shows that the card claims to hold about 7.8 GB.
>
>   
Yes, there is info about the card in dmesg. It's capacity was determined
correctly.

P.S.  I'm sorry for my English.
Comment 9 Alan Stern 2009-10-13 18:55:14 UTC
On Tue, 13 Oct 2009, Alexey wrote:

> I has made a new trace.
> I started logging and insert the card. Still 20 secs or so I ejected the
> card and stopped logging.
> I attached this log to the message. But it contains records that
> presents in the first and the second logs only.

Try doing this: First, rmmod ehci-hcd, rmmod uhci-hcd, and rmmod
ohci-hcd.  Insert a card in the reader and start usbmon.  Then modprobe
ehci-hcd.  After 20 seconds or so, remove the card.  Then after another
10 seconds, insert the card again.  20 seconds after that, stop usbmon.  
Let's see what that shows.

Alan Stern
Comment 10 Alexey 2009-10-14 14:35:07 UTC
Alan Stern wrote:
> Try doing this: First, rmmod ehci-hcd, rmmod uhci-hcd, and rmmod
> ohci-hcd.  Insert a card in the reader and start usbmon.  Then modprobe
> ehci-hcd.  After 20 seconds or so, remove the card.  Then after another
> 10 seconds, insert the card again.  20 seconds after that, stop usbmon.  
> Let's see what that shows.
>
>   

I did that. The log is attached to the message.
Comment 11 Alan Stern 2009-10-14 15:13:40 UTC
On Wed, 14 Oct 2009, Alexey wrote:

> Alan Stern wrote:
> > Try doing this: First, rmmod ehci-hcd, rmmod uhci-hcd, and rmmod
> > ohci-hcd.  Insert a card in the reader and start usbmon.  Then modprobe
> > ehci-hcd.  After 20 seconds or so, remove the card.  Then after another
> > 10 seconds, insert the card again.  20 seconds after that, stop usbmon.  
> > Let's see what that shows.
> >
> >   
> 
> I did that. The log is attached to the message.

Exactly what did you do when removing the card?  Did you click on an 
"Eject" button or run an eject program, as opposed to simply taking the 
card out of the reader?

If that's the case then you may need to run a corresponding "load" 
program to load a new card.  Simply inserting the card in the reader 
might not be enough.

Alternatively, instead of using an "Eject" program, you could unmount
any filesystems on the card and just take it out of the reader.  Then
there shouldn't be any need to run a "load" program.

Alan Stern
Comment 12 Alexey 2009-10-14 15:58:49 UTC
Alan Stern wrote:
> Exactly what did you do when removing the card?  Did you click on an 
> "Eject" button or run an eject program, as opposed to simply taking the 
> card out of the reader?
>
>   
I use the KDE kicker's applet "Disk applet" to eject any portable disk.
The card reader doesn't have any buttons like "Eject" or "Load".
This is  a simple aperture on the side of the notebook Samsung Q210 FS-02.
> If that's the case then you may need to run a corresponding "load" 
> program to load a new card.  Simply inserting the card in the reader 
> might not be enough.
>
> Alternatively, instead of using an "Eject" program, you could unmount
> any filesystems on the card and just take it out of the reader.  Then
> there shouldn't be any need to run a "load" program.
>   
I tried to unmount volume and take the flash card out but the card reader
didn't recognize the card when I secondarily insert it.

P.S. I'm sorry for my English.
Comment 13 Alan Stern 2009-10-14 20:39:11 UTC
On Wed, 14 Oct 2009, Alexey wrote:

> Alan Stern wrote:
> > Exactly what did you do when removing the card?  Did you click on an 
> > "Eject" button or run an eject program, as opposed to simply taking the 
> > card out of the reader?
> >
> >   
> I use the KDE kicker's applet "Disk applet" to eject any portable disk.
> The card reader doesn't have any buttons like "Eject" or "Load".
> This is  a simple aperture on the side of the notebook Samsung Q210 FS-02.
> > If that's the case then you may need to run a corresponding "load" 
> > program to load a new card.  Simply inserting the card in the reader 
> > might not be enough.
> >
> > Alternatively, instead of using an "Eject" program, you could unmount
> > any filesystems on the card and just take it out of the reader.  Then
> > there shouldn't be any need to run a "load" program.
> >   
> I tried to unmount volume and take the flash card out but the card reader
> didn't recognize the card when I secondarily insert it.

Then maybe the reader does want to receive a "load" command.  You 
can use the sg_start program from the sg3_utils package to send this 
command.

You should start usbmon, then insert the card, then run

	sg_start -l /dev/sdb

The load command should show up in the usbmon log.  Let's see if it
convinces the reader to look for the card.

If it doesn't work then there's a good possibility your card reader is 
simply broken.

Alan Stern
Comment 14 Alexey 2009-10-14 22:20:02 UTC
Alan Stern wrote:
> Then maybe the reader does want to receive a "load" command.  You 
> can use the sg_start program from the sg3_utils package to send this 
> command.
>
> You should start usbmon, then insert the card, then run
>
>       sg_start -l /dev/sdb
>
> The load command should show up in the usbmon log.  Let's see if it
> convinces the reader to look for the card.
>
>   
I tried to `sg_start -l /dev/sdb` after I inserted the card into the
card reader but it doesn't work.
The trace of the usbmon contains only records that repeats all time.
I also tried `sg_start -s -l /dev/sdb` and a lot of other options of
sg_start but with no effect.

> If it doesn't work then there's a good possibility your card reader is 
> simply broken.
>   
But it works with `rmmod ehci_hcd` (if ehci-hcd loaded) or with
`modprobe ehci-hcd` (if it wasn't loaded).
And with the same commands for uhci-hcd.
And the card reader normal works in the Windows OS.


P.S. I'm sorry for my English.
Comment 15 Alan Stern 2009-10-15 02:21:50 UTC
On Thu, 15 Oct 2009, Alexey wrote:

> I tried to `sg_start -l /dev/sdb` after I inserted the card into the
> card reader but it doesn't work.
> The trace of the usbmon contains only records that repeats all time.

Can you post the usbmon trace?  It should have at least one other
command, from the sg_start program.

> I also tried `sg_start -s -l /dev/sdb` and a lot of other options of
> sg_start but with no effect.
> 
> > If it doesn't work then there's a good possibility your card reader is 
> > simply broken.
> >   
> But it works with `rmmod ehci_hcd` (if ehci-hcd loaded) or with
> `modprobe ehci-hcd` (if it wasn't loaded).
> And with the same commands for uhci-hcd.

However it _should_ work without unloading and reloading those modules.  
The fact that it doesn't indicates something is wrong with it.

> And the card reader normal works in the Windows OS.

So we should find out what commands Windows sends to the reader.  You
can do this using the SnoopyPro program.

Alan Stern
Comment 16 Alexey 2009-10-18 15:59:32 UTC
> However it _should_ work without unloading and reloading those modules.  
> The fact that it doesn't indicates something is wrong with it.
>   
I found that sg_start needs a scsi device to manipulate. It's /dev/sg2
but not /dev/sdb as I tested before.
And the only way to detect media in the card reader I found is to:
    `sg_reset -b /dev/sg2`
And the eject command runs as well:
    `sg_start -e /dev/sg2`
But if I try to `sg_start -l /dev/sg2` then it not works.
>> And the card reader normal works in the Windows OS.
>>     
>
> So we should find out what commands Windows sends to the reader.  You
> can do this using the SnoopyPro program.
>   

I tested the device in Windows XP about a year ago. And when I tried to
test it yeasterday then... the device didn't work.
I can initialize the current inserted media with "Restart device" option
in SnoopyPro only.
Then you was right about the broken device.

 I'm so sorry for the disturbing.
Comment 17 Greg Kroah-Hartman 2009-10-18 19:08:30 UTC
Thanks for letting us know it was a hardware problem.
Comment 18 Alan Stern 2009-10-18 20:52:08 UTC
On Sun, 18 Oct 2009, Alexey wrote:

> I found that sg_start needs a scsi device to manipulate. It's /dev/sg2
> but not /dev/sdb as I tested before.

Some commands can use either device, and some need to use the sg 
device.

> And the only way to detect media in the card reader I found is to:
>     `sg_reset -b /dev/sg2`
> And the eject command runs as well:
>     `sg_start -e /dev/sg2`
> But if I try to `sg_start -l /dev/sg2` then it not works.

That's not what one would expect, but it makes sense if the device 
isn't working right.

> I tested the device in Windows XP about a year ago. And when I tried to
> test it yeasterday then... the device didn't work.
> I can initialize the current inserted media with "Restart device" option
> in SnoopyPro only.
> Then you was right about the broken device.

Then you're all set: You know how to make the device detect a new card 
and you know that this isn't a bug in the kernel.  So you can close out 
the bug report.

Alan Stern
Comment 19 Alexey 2009-10-19 13:40:45 UTC
Alan Stern wrote:
> Then you're all set: You know how to make the device detect a new card 
> and you know that this isn't a bug in the kernel.  So you can close out 
> the bug report
>   
Thank you for helping.
Comment 20 Moritz Naumann 2010-01-07 18:52:18 UTC
While this bug is a non kernel issue for Alex, it is a a real issue for several other people: https://bugs.launchpad.net/ubuntu/+bug/366478

I have a brand new Asus UL30A with this device
  Bus 002 Device 002: ID 058f:6366 Alcor Micro Corp. 
running Linux 2.6.31. It fails to detect any media inserts and ejects.

  sg_start -l /dev/sdb
does not help it detecting the SD HC media I inserted.