Hi,

I'm running linux 2.6.11 (vanilla) on a custom board, with a
Sharp LH7A404.

.config:
  CONFIG_ARCH_LH7A40X=y
  CONFIG_ARCH_LH7A404=y

I've been having problems with a USB storage chip connected to the
USB host interface (ST72F65, soldered on to the board).

To detect media presence, I have a program that polls /dev/sd[abcde]
once every 2 seconds or so, and reads a sector's worth of data, roughly
equivalent to,

  $ dd if=/dev/sdc of=/dev/null bs=512 count=1 \
     && echo 'Media present' || echo 'No media'
    
Way down, this calls, from drivers/usb/host/ohci.h:

  static u32 roothub_portstatus (struct ohci_hcd *hc, int i)
        { return read_roothub (hc, portstatus [i], 0xffe0fce0); }

and typically this returns 0x103,

       00000100=RH_PS_PPS (port power status)
       00000002=RH_PS_PES (port enable status)
       00000001=RH_PS_CCS (current connect status)

but after a minute or two of polling (once a second or so), I get 0x30101,

       00020000=RH_PS_PESC (port enable status change)
       00010000=RH_PS_CSC (connect status change)
       00000100=RH_PS_PPS (port power status)
       00000001=RH_PS_CCS (current connect status)

which bubbles up through the calling code in the usb layer and triggers
a disconnect cycle due to PESC and CSC,

  ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
  {
        ...

        for (i = 0; i < ports; i++) {
                u32     status = roothub_portstatus (ohci, i);
                if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC
                                | RH_PS_OCIC | RH_PS_PRSC)) {
                        changed = 1;


Now my questions:

  1) Is there a better way to poll for media presence than reading
     /dev/sd[a..e] ?

  2) Does the 0x30101 look like a sane response? I'm seeing 0x30100
     when I remove an IOGEAR media reader connected through via a
     standard USB TypeA port.

Any other insights/tips are welcome.

This might come down to a board-layout or electrical problem, I know.

Thanks,
-Jamie

p.s. I got the 0x30101/etc numbers by saving the result of
roothub_portstatus() in a huge buffer in the kernel, then downloading 
the buffer through a /proc file.  Its an embarassingly ugly hack, but 
it was the only way I could avoid messing with USB timing.


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to