This patch enables the USB stack to recognize WUSB devices (from a
WUSB HCD) and assigns them the proper speed setting
(USB_SPEED_VARIABLE).

1. Introduce usb_hcd->wireless to mark a host controller instance as
   being wireless, and thus having wireless 'fake' ports. 

   [discarded previous model of using a reserved bit in the port_stat
   struct to do this; thanks to Alan Stern for indicating the
   proper way to do it].

2. Introduce hub.c:hub_is_wusb() that tests if a hub is a WUSB root
   hub (WUSB doesn't have non-root hubs).

New code being pushed to linuxuwb.org requires this patch to connect WUSB
devices.

Signed-off-by: Inaky Perez-Gonzalez <[EMAIL PROTECTED]>

---
 drivers/usb/core/hcd.h |    1 +
 drivers/usb/core/hub.c |   18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

Index: drivers/usb/core/hub.c
===================================================================
--- drivers/usb/core/hub.c.orig 2006-08-25 18:50:58.000000000 -0700
+++ drivers/usb/core/hub.c      2006-08-25 19:00:32.000000000 -0700
@@ -1366,6 +1366,18 @@
        return ret;
 }
 
+
+/* Returns 1 if @hub is a WUSB root hub, 0 otherwise */
+static unsigned hub_is_wusb(struct usb_hub *hub) 
+{
+       struct usb_hcd *hcd;
+       if (hub->hdev->parent != NULL)  /* not a root hub? */
+               return 0;
+       hcd = container_of(hub->hdev->bus, struct usb_hcd, self);
+       return hcd->wireless;
+}
+
+
 #define PORT_RESET_TRIES       5
 #define SET_ADDRESS_TRIES      2
 #define GET_DESCRIPTOR_TRIES   2
@@ -1406,7 +1418,9 @@
                /* if we`ve finished resetting, then break out of the loop */
                if (!(portstatus & USB_PORT_STAT_RESET) &&
                    (portstatus & USB_PORT_STAT_ENABLE)) {
-                       if (portstatus & USB_PORT_STAT_HIGH_SPEED)
+                       if (hub_is_wusb(hub))
+                               udev->speed = USB_SPEED_VARIABLE;
+                       else if (portstatus & USB_PORT_STAT_HIGH_SPEED)
                                udev->speed = USB_SPEED_HIGH;
                        else if (portstatus & USB_PORT_STAT_LOW_SPEED)
                                udev->speed = USB_SPEED_LOW;
Index: drivers/usb/core/hcd.h
===================================================================
--- drivers/usb/core/hcd.h.orig 2006-08-25 18:50:58.000000000 -0700
+++ drivers/usb/core/hcd.h      2006-08-25 18:58:08.000000000 -0700
@@ -85,6 +85,7 @@
        unsigned                uses_new_polling:1;
        unsigned                poll_rh:1;      /* poll for rh status? */
        unsigned                poll_pending:1; /* status has changed? */
+       unsigned                wireless:1;     /* Wireless USB HCD */
 
        int                     irq;            /* irq allocated */
        void __iomem            *regs;          /* device memory/io */

--

Inaky

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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