Instead of bailing at the first NULL child (i.e., the first non-
connected port), go through all ports and simply skip any NULL
children. This condition occurs in the Cintiq Companion Hybrid
when trying to locate the other "half" (i.e. pen or touch device)
of the tablet.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 2.6.38/wacom_sys.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/2.6.38/wacom_sys.c b/2.6.38/wacom_sys.c
index 177efd8..6848717 100644
--- a/2.6.38/wacom_sys.c
+++ b/2.6.38/wacom_sys.c
@@ -622,7 +622,7 @@ static DEFINE_MUTEX(wacom_udev_list_lock);
 
 static struct usb_device *wacom_get_sibling(struct usb_device *dev, int 
vendor, int product)
 {
-       struct usb_device **sibling;
+       int i;
 
        if (vendor == 0 && product == 0)
                return dev;
@@ -630,14 +630,17 @@ static struct usb_device *wacom_get_sibling(struct 
usb_device *dev, int vendor,
        if (dev->parent == NULL)
                return NULL;
 
-       sibling = dev->parent->children;
-       while (sibling != NULL && *sibling != NULL) {
-               struct usb_device_descriptor d = (*sibling)->descriptor;
+       for (i = 0 ; i < dev->parent->maxchild; i++) {
+               struct usb_device *sibling = dev->parent->children[i];
+               struct usb_device_descriptor d;
 
-               if (d.idVendor == vendor && d.idProduct == product)
-                       return *sibling;
+               if (sibling == NULL)
+                       continue;
+
+               d = sibling->descriptor;
 
-               sibling++;
+               if (d.idVendor == vendor && d.idProduct == product)
+                       return sibling;
        }
 
        return NULL;
-- 
1.8.4


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to