[Trimmed down the CC list]

On Mon, 18 Sep 2006, Rafael J. Wysocki wrote:

> On Monday, 18 September 2006 17:07, Alan Stern wrote:
> > On Mon, 18 Sep 2006, Rafael J. Wysocki wrote:
> > 
> > > > Actually, the problem is ohci_hcd doesn't seem to recognize devices 
> > > > plugged
> > > > into the USB ports.
> > > > 
> > > > For example, if I unplug and replug a mouse (that worked before 
> > > > unplugging),
> > > > it doesn't work any more.  I have to reload ohci_hcd to make it work 
> > > > again.
> > > > 
> > > > This is 100% reproducible and occurs on the two boxes above.
> > > 
> > > I have carried out a binary search and found that the problem is caused by
> > > 
> > > gregkh-usb-usbcore-remove-usb_suspend_root_hub.patch
> > 
> > Tell me, what happens if you leave that patch installed, and you use 
> > the patch I sent last week (the one that removes a chunk of code from 
> > ohci-hub.c), and you also set CONFIG_USB_SUSPEND?
> 
> The problem continues to happen.
> 
> Moreover, if I revert the above patch and apply the patch removing code
> from ohci-hub.c, the problem reappears.

I'm working on this, but it's slow going because I'm not very familiar 
with ohci-hcd.  One of my computers does have OHCI controllers but I can't 
reproduce your problem.

In the meantime, let's make sure I understand the symptoms properly.  
Let's say you start with pure 2.6.18-rc6-mm2 and apply the patch below.  
(Two of the parts have already been submitted and the third is for 
testing.)  Let's also say you start with a clean boot and don't do any 
suspends.  Finally, let's say you leave the mouse unplugged while you boot 
and then plug it in afterward.  Does it work?  If it does, what happens if 
you unplug it and then replug it several seconds later?

Do you see the problem is CONFIG_USB_SUSPEND isn't set?  What about if it
is set?  What do the kernel logs show?

Assuming the symptoms do not appear, if you do suspend-to-disk do they 
appear afterward?

Alan Stern


Index: mm/drivers/usb/core/hub.c
===================================================================
--- mm.orig/drivers/usb/core/hub.c
+++ mm/drivers/usb/core/hub.c
@@ -1063,6 +1063,12 @@ void usb_root_hub_lost_power(struct usb_
        unsigned long flags;
 
        dev_warn(&rhdev->dev, "root hub lost power or was reset\n");
+
+       /* Make sure no potential wakeup events get lost,
+        * by forcing the root hub to be resumed.
+        */
+       rhdev->dev.power.prev_state.event = PM_EVENT_ON;
+
        spin_lock_irqsave(&device_state_lock, flags);
        hub = hdev_to_hub(rhdev);
        for (port1 = 1; port1 <= rhdev->maxchild; ++port1) {
Index: mm/drivers/usb/core/driver.c
===================================================================
--- mm.orig/drivers/usb/core/driver.c
+++ mm/drivers/usb/core/driver.c
@@ -1079,11 +1079,12 @@ int usb_resume_both(struct usb_device *u
                                        PM_EVENT_ON)
                                status = -EHOSTUNREACH;
                }
-               if (status == 0 && udev->state == USB_STATE_SUSPENDED)
+               if (status == 0)
                        status = resume_device(udev);
                if (parent)
                        mutex_unlock(&parent->pm_mutex);
-       }
+       } else
+               status = resume_device(udev);
 
        /* Now the parent won't suspend until we are finished */
 
Index: mm/drivers/usb/host/ohci-hub.c
===================================================================
--- mm.orig/drivers/usb/host/ohci-hub.c
+++ mm/drivers/usb/host/ohci-hub.c
@@ -391,17 +391,6 @@ ohci_hub_status_data (struct usb_hcd *hc
 done:
        spin_unlock_irqrestore (&ohci->lock, flags);
 
-#ifdef CONFIG_PM
-       /* save power by autosuspending idle root hubs;
-        * INTR_RD wakes us when there's work
-        */
-       if (can_suspend && usb_trylock_device (hcd->self.root_hub) == 0) {
-               ohci_vdbg (ohci, "autosuspend\n");
-               (void) ohci_bus_suspend (hcd);
-               usb_unlock_device (hcd->self.root_hub);
-       }
-#endif
-
        return changed ? length : 0;
 }
 
@@ -572,9 +561,6 @@ static int ohci_hub_control (
                        break;
                case USB_PORT_FEAT_SUSPEND:
                        temp = RH_PS_POCI;
-                       if ((ohci->hc_control & OHCI_CTRL_HCFS)
-                                       != OHCI_USB_OPER)
-                               usb_hcd_resume_root_hub(hcd);
                        break;
                case USB_PORT_FEAT_C_SUSPEND:
                        temp = RH_PS_PSSC;
Index: mm/drivers/usb/host/ohci-hcd.c
===================================================================
--- mm.orig/drivers/usb/host/ohci-hcd.c
+++ mm/drivers/usb/host/ohci-hcd.c
@@ -107,7 +107,7 @@
 
 /*-------------------------------------------------------------------------*/
 
-#undef OHCI_VERBOSE_DEBUG      /* not always helpful */
+#define OHCI_VERBOSE_DEBUG     /* not always helpful */
 
 /* For initializing controller (mask in an HCFS mode too) */
 #define        OHCI_CONTROL_INIT       OHCI_CTRL_CBSR


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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