Subject: USB doesn't survive suspend/resume on laptop
To: None <port-i386@netbsd.org>
From: Steve Woodford <steve@mctavish.co.uk>
List: port-i386
Date: 12/29/2000 18:29:00
Hi,

I have a Compaq Armada 1598 laptop running NetBSD/i386-1.5 which has an
onboard USB controller/hub:

ohci0 at pci0 dev 16 function 0: vendor 0x0e11 product 0xa0f8 (rev. 0x06)
ohci0: interrupting at irq 11
ohci0: OHCI version 1.0, legacy support
usb0 at ohci0: USB revision 1.0
uhub0 at usb0
uhub0: vendor 0x0e11 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered

I also have a Canon Powershot S20 which I've persuaded to work with gphoto
over USB. Until, that is, I suspend the laptop. On resume, the USB driver
doesn't seem to recover and fails to recognise the camera being plugged in:

Here are some debug messages dumped by the USB code, with USB_DEBUG
defined, and the relevant debug levels set in source:

Plugging in the Camera *Before* a Suspend
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ohci_rhsc: sc=0xc042e000 xfer=0xc0423d00 hstatus=0x00000000
ohci_rhsc: change=0x02
uhub_explore: status change hub=1 port=1
ohci_rhsc: sc=0xc042e000 xfer=0xc0423d00 hstatus=0x00000000
ohci_rhsc: change=0x02
ohci_open: pipe=0xc0491e00, addr=0, endpt=0 (1)
ohci_alloc_std: allocating chunk
ohci_alloc_std_chain: start len=8
ohci_alloc_std_chain: start len=18
ohci_alloc_std_chain: start len=1
ohci_alloc_std_chain: start len=4
ohci_alloc_std_chain: start len=1
ohci_alloc_std_chain: start len=22
ohci_alloc_std_chain: start len=1
ohci_alloc_std_chain: start len=28
ohci_alloc_std_chain: start len=9
ohci_alloc_std_chain: start len=39
ugen0 at uhub0 port 1ohci_alloc_std_chain: start len=1
ohci_alloc_std_chain: start len=22
ohci_alloc_std_chain: start len=1
ohci_alloc_std_chain: start len=28

ugen0: Canon Inc. PowerShot S20, rev 1.00/0.01, addr 2
ohci_alloc_std_chain: start len=9
ohci_alloc_std_chain: start len=39


Removing camera before suspend
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ohci_rhsc: sc=0xc042e000 xfer=0xc0423d00 hstatus=0x00000000
ohci_rhsc: change=0x02
uhub_explore: C_PORT_ENABLED
uhub0: port error, restarting port 1
uhub_explore: device addr=2 disappeared on port 1
ugen0: at uhub0 port 1 (addr 2) disconnected
ugen0 detached
ohci_alloc_std_chain: start len=1
ohci_alloc_std_chain: start len=1
ohci_device_ctrl_close: pipe=0xc0491e00


The Suspend and Resume
~~~~~~~~~~~~~~~~~~~~~~
ohci_power: sc=0xc042e000, why=1
ohci_dumpregs: rev=0x00000110 control=0x000000bf command=0x00000000
               intrstat=0x00000004 intre=0x8000004b intrd=0x8000004b
               hcca=0x00003000 percur=0x00000000 ctrlhd=0x00004fe0
               ctrlcur=0x00000000 bulkhd=0x00004fc0 bulkcur=0x00000000
               done=0x00000000 fmival=0xa7782edf fmrem=0x800024cf
               fmnum=0x0000e266 perst=0x00002a2f lsthrs=0x00000628
               desca=0x01000002 descb=0x00000000 stat=0x00000000
               port1=0x00000100 port2=0x00000100
         HCCA: frame_number=0xe266 done_head=0x00000000
NMI port 61 70, port 70 35
ohci0: scheduling overrun
ohci_power: sc=0xc042e000, why=0
ohci_dumpregs: rev=0x00000110 control=0x000000bf command=0x00010000
               intrstat=0x00000000 intre=0x8000004b intrd=0x8000004b
               hcca=0x00003000 percur=0x00000000 ctrlhd=0x00004fe0
               ctrlcur=0x00000000 bulkhd=0x00004fc0 bulkcur=0x00000000
               done=0x00000000 fmival=0xa7782edf fmrem=0x8000210d
               fmnum=0x0000fb3f perst=0x00002a2f lsthrs=0x00000628
               desca=0x01000002 descb=0x00000000 stat=0x00000000
               port1=0x00000100 port2=0x00000100
         HCCA: frame_number=0xe75f done_head=0x00000000


Plugging in the camera after resuming
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ohci_rhsc: sc=0xc042e000 xfer=0xc0423d00 hstatus=0x00000000
ohci_rhsc: change=0x02
uhub_explore: status change hub=1 port=1
ohci_rhsc: sc=0xc042e000 xfer=0xc0423d00 hstatus=0x00000000
ohci_rhsc: change=0x02
ohci_open: pipe=0xc0491000, addr=0, endpt=0 (1)
ohci_alloc_std_chain: start len=8
ohci_timeout: xfer=0xc0423b80
ohci_abort_xfer: xfer=0xc0423b80 pipe=0xc0491000
ohci_abort_xfer: stop ed=0xc52b47a0
ohci_abort_xfer: set hd=7740, tl=7740
ohci_alloc_std_chain: start len=8
ohci_timeout: xfer=0xc0423b80
ohci_abort_xfer: xfer=0xc0423b80 pipe=0xc0491000
ohci_abort_xfer: stop ed=0xc52b47a0
ohci_abort_xfer: set hd=7770, tl=7770
ohci_alloc_std_chain: start len=8
ohci_timeout: xfer=0xc0423b80
ohci_abort_xfer: xfer=0xc0423b80 pipe=0xc0491000
ohci_abort_xfer: stop ed=0xc52b47a0
ohci_abort_xfer: set hd=77d0, tl=77d0
usbd_new_device: addr=2, getting first desc failed
ohci_device_ctrl_close: pipe=0xc0491000
uhub_explore: usb_new_device failed, error=TIMEOUT
uhub0: device problem, disabling port 1


Any ideas? Anyone seen this before?

Cheers, Steve