[Libusbx-devel] [libusbx] [Windows] ASMedia XHCI enumeration issues. (#147)

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Libusbx-devel] [libusbx] [Windows] ASMedia XHCI enumeration issues. (#147)

daves0

I've only seen this issue on ASMedia XHCI's (tested with latest fw/driver) but the call that uses SPDRP_ADDRESS to query the port number a device is on yields incorrect information. That information is later used by the IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX iotcl to get information about the device. however since the port_nr is wrong, the hub driver correctly reports back 'no device connected' causing the device to be unavailable from libusb.

CHAR DevLocation[256];
.
.
.
// The SPDRP_ADDRESS for USB devices is the device port number on the hub
            port_nr = 0;
            if ((pass >= HUB_PASS) && (pass <= GEN_PASS)) {
                if ( (!pSetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_ADDRESS,
                    &reg_type, (BYTE*)&port_nr, 4, &size))
                  || (size != 4) ) {
                    usbi_warn(ctx, "could not retrieve port number for device '%s', skipping: %s",
                        dev_id_path, windows_error_str(0));
                    continue;
                }
            }
            if (pSetupDiGetDeviceRegistryPropertyA(dev_info, &dev_info_data, SPDRP_LOCATION_INFORMATION  , &reg_type, (BYTE*)&DevLocation, sizeof(DevLocation), &size)) {
              if ( (size>=6) && (strncmp(DevLocation,"Port_#",6)==0) )
              {
                    port_nr = strtol(DevLocation+6,NULL,10);
                }
            }

This works around the issue by querying SPDRP_LOCATION_INFORMATION see if it's in Port_#xxxx_Hub_#yyyy format and parses the correct port from there.


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] [Windows] ASMedia XHCI enumeration issues. (#147)

daves0

And what happens if it's not in the Port_#xxxx_Hub_#yyyy format? Do we set all the ports from that hub as port 0?
Also, what exactly does the ASMedia driver return as a string for this query?

From what I'm seeing, your intent is to set the port number to zero, which is invalid, in the case of poking anything on an ASMedia connected hub, and pretend that everything's copacetic.

Well, with the code less than 5 lines above pretty much saying "if we can't retrieve valid port data, then we eliminate the device", it kind of looks like you are trying to hide your ASMedia annoyance (most likely a driver bug that ASMedia should be the ones to fix) under the rug. As such, I don't think this is something we can really go with: displacing the problem, rather than solving it, will only end up impacting other users. This may sound like an acceptable solution to you, but for everyone who expects consistency with how we assign port numbers, and/or uniquely identify a device, not so much...

My other questions to you then are:

  • Have you contacted ASMedia support and asked them if they are aware that their driver is not compliant with Microsoft's API and breaks USB applications? What did they say?
  • Have you tried upgrading your ASMedia drivers to the latest version?

/Pete


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] [Windows] ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

And what happens if it's not in the Port_#xxxx_Hub_#yyyy format? Do we set all the ports from that hub as port 0?

No I kept the SPDRP_ADDRESS call, however if the SPDRP_LOCATION_INFORMATION is in the right format it will override that (possibly wrong) value.

Also, what exactly does the ASMedia driver return as a string for this query?

Port_#0007.Hub_#0001. (while the SPDRP_ADDRESS call returns 0, usbview confirms 7 IS the right value. extra annoying is that the SPDRP_ADDRESS isn't always wrong, hell it's right most of the time. but most of the time isn't really cutting it )

From what I'm seeing, your intent is to set the port number to zero, which is invalid, in the case of poking anything on an ASMedia connected hub, and pretend that everything's copacetic.

Wrong, I'm parsing out the 7 from the above string the replace the wrong address the SPDRP_ADDRESS call gave me.

Well, with the code less than 5 lines above pretty much saying "if we can't retrieve valid port data, then we eliminate the device"

It's more, hey double check the value out of SPDRP_ADDRESS and patch up the value with the right information if you can. The device was already getting eliminated due to the wrong address, i'm trying to un-eliminate it cause i want to talk to it.

it kind of looks like you are trying to hide your ASMedia annoyance.
Correct.

(most likely a driver bug that ASMedia should be the ones to fix) under the rug.
Correct.

As such, I don't think this is something we can really go with: displacing the problem, rather than solving it, will only end up impacting other users.
Your call, not happy about it but I understand where you are coming from.

This may sound like an acceptable solution to you, but for everyone who expects consistency with how we assign port numbers, and/or uniquely identify a device, not so much...
Fair enough, on the other hand, usbview is perfectly able to figure out the device is actually on port 7. if they can so should you.

Have you tried upgrading your ASMedia drivers to the latest version?

ASMedia is somewhat annoying in this regard, they offer no downloads on their website, so you'll end up on creepy forum links where someone keeps a collection of fishy links. I have installed what i think is the latest driver+fw (and newer than what asus is offering me for my motherboard) but if it's really the latest? who knows. Which is also the main reason i tried sweeping it under the rug in libusbx instead of contacting the vendor, even if they did fix it, how do end users that code? asmedia isn't publishing it on their website, and asus doesn't post updates (given i was able to find newer stuff, months old so they had plenty of time) by the looks of it.

My other questions to you then are:
Have you contacted ASMedia support and asked them if they are aware that their driver is not compliant with Microsoft's API and breaks USB applications? What did they say?

No, not yet, given the hard to get nature of the ASMedia FW/Drivers,i figured offering a work around was more productive us of my time.

But in the end yeah ideally ASMedia fixes this bug and makes a new driver+fw available for all, I'm pretty sure i don't live in an ideal world though.

Your call if/what you want do do about it. I've seen this problem many many times with people with RTL-SDR sticks which usually end up plugging their sticks in usb2 ports to make the problem go away, That however was not a solution for my usb3 device.

I'll contact asmedia but in all honesty i'm not expecting much there.


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] [Windows] ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

OK, my bad, I looked at your code too fast (piece of advice though - a diff or a patch works a lot better than a code snippet). There are still a few issues:

  1. Using both SPDRP_ADDRESS and SPDRP_LOCATION_INFORMATION seems quite redundant. If the latter works all the time, we might as well use that always. But now of course, we need to prove that SPDRP_LOCATION_INFORMATION can be used as a replacement for SPDRP_ADDRESS and doesn't introduce a regression, which will take some testing.
  2. At the very least, I think you want to issue the SPDRP_LOCATION_INFORMATION call within the if ((pass >= HUB_PASS) && (pass <= GEN_PASS)) block. Else you're going to try to fetch a port number for HCDs and other stuff which (provided the port_nr = 0; is from existing code, which I can't tell without looking since you didn't provide a diff), will be unused anyway.
  3. I see no reference whatsoever to SPDRP_LOCATION_INFORMATION in the usbview source I have (which I think is the latest). I do see references to SPDRP_ADDRESS, which is what i think I traced back at the time as the API call to use to fetch the port number. If usbview displays the right port from your ASMedia, but apparently without using SPDRP_LOCATION_INFORMATION, can you find out how they do it?


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] [Windows] ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0
  1. Who knows, detailed docs are hard to come by, msdn usually has some generic description for them. Hence i played it safe, start with SPDRP_ADDRESS cause we know it's good 'most' of the time, then query SPDRP_LOCATION_INFORMATION verify it's in a format i expect, and parse it.

2) I didn't, but I agree that test should be there.

3) I haven't checked the source yet, i kinda assumed they would just find the hubs and just go though all ports 'hey anything there?' but i admit that's nothing more than assumptions at this time.


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] [Windows] ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

Just want to copy the comments on top of enum.c here.

 The enumeration process goes like this: 

    (1) Enumerate Host Controllers and Root Hubs 
    EnumerateHostControllers() 
    EnumerateHostController() 
    Host controllers currently have symbolic link names of the form HCDx, 
    where x starts at 0.  Use CreateFile() to open each host controller 
    symbolic link.  Create a node in the TreeView to represent each host 
    controller. 

    GetRootHubName() 
    After a host controller has been opened, send the host controller an 
    IOCTL_USB_GET_ROOT_HUB_NAME request to get the symbolic link name of 
    the root hub that is part of the host controller. 

    (2) Enumerate Hubs (Root Hubs and External Hubs) 
    EnumerateHub() 
    Given the name of a hub, use CreateFile() to map the hub.  Send the 
    hub an IOCTL_USB_GET_NODE_INFORMATION request to get info about the 
    hub, such as the number of downstream ports.  Create a node in the 
    TreeView to represent each hub. 

    (3) Enumerate Downstream Ports 
    EnumerateHubPorts() 
    Given an handle to an open hub and the number of downstream ports on 
    the hub, send the hub an IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX 
    request for each downstream port of the hub to get info about the 
    device (if any) attached to each port.  If there is a device attached 
    to a port, send the hub an IOCTL_USB_GET_NODE_CONNECTION_NAME request 
    to get the symbolic link name of the hub attached to the downstream 
    port.  If there is a hub attached to the downstream port, recurse to 
    step (2).   

    GetAllStringDescriptors() 
    GetConfigDescriptor() 
    Create a node in the TreeView to represent each hub port 
    and attached device. 


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

Got a response from ASMedia, which used a lot of polite words to tell me 'We don't talk to end users, go away'


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

Got a response from ASMedia, which used a lot of polite words to tell me 'We don't talk to end users, go away'

Glad we could publicly establish that ASMedia doesn't seem to care about their actual customers. Hopefully this will help potential buyers of ASMedia-based hardware decide whether they want to use products from a company which, if your report is correct, appears to have little interest in receiving feedback from end users, in order to improve their products.

/Pete


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

Just want to copy the comments on top of enum.c here.

Yeah, I can read code and comments too, when I have the time.
I was simply hoping that you could speed up things by doing the analysis and tell us exactly what process is used by usbview to compute the port number (NB: the rest of the process is fairly close to what we do for our enum, if you look at what each pass accomplishes. As a matter of fact, usbview was used as a reference when crafting our enumeration)

As long as it requires 2 different API calls, that each essentially return the same element we are interested in, albeit in a slightly different form, I don't see how we can integrate this patch. Now, you're of course free to decide whether you want to help us and ASMedia users further, by doing the analysis work above, or just leave that to whichever libusb developer will get a chance to do it, when/if they get a chance to do it.

/Pete


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

Glad we could publicly establish that ASMedia doesn't seem to care about their actual customers. Hopefully this will help potential buyers of ASMedia-based hardware decide whether they want to use products from a company which, if your report is correct, appears to have little interest in receiving feedback from end users, in order to improve their products.

I think you're being a little harsh on them here. They are an IC design house, they sell to OEM's, that's what they see as their customers, and that's who they chose to support. It's a common business model, it's not like they are unique in this regard (go check the linux kernel for instance for reverse engineered vs vendor supported drivers). Sure you don't have to like it (and I'm with you on that one) but going down the path of 'i hope people see this and don't buy products' seems a little... harsh?

On a more positive note, if/when time permits i'll see what i can do about redoing the enumeration code but given the patch in my opening post already scratches most of my itch, it'll be rather low on my todo list .


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

but going down the path of 'i hope people see this and don't buy products' seems a little... harsh?

How about Renesas then? Pretty much the same business model, except, and I speak from experience here, users can actually reach out to their developers when they encounter an issue.
I was able to have a technical discussion, with their developers, fairly easily, with regards to an issue we had with regards to root hubs not being listed through Renesas hardware.

Some companies get customer care. Other don't. It's just not a buzz word to throw around.
Final users are your customers, always. If you do everything in your power so that your developers never hear from them, then I will be reluctant to use your hardware or software, and, what's more, I will not shy away from encouraging others not to do either, because endorsing the practice of ignoring end users or having them jump through hoops in order to speak to a physical person with the capability to help is not doing anybody any favour, including the company itself.

In the age of the Internet, and as consumers and users, we have the power to render that one sided practice obsolete. Let's.

/Pete


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

While digging around in usbview, i came up with an elegant patch that doesn't rely on strings being in the right format. In windows_get_device_list we already query for SPDRP_DRIVER which gets us the DriverKey, you can query each of the ports on the USB hub as well for this DriverKey, If we do the following

1) Modify init_device to take this DriverKey instead of a port number.
2) Add a function that takes a devicepath to the parent hub device and the driverkey to search for that loops over all ports on the hub and locates the proper port.
3) Set this port number in init_device.

This should get us the proper port without having to worry about parsing some creepy string.

Index: libusb/os/windows_usb.c
===================================================================
--- libusb/os/windows_usb.c (revision 1153)
+++ libusb/os/windows_usb.c (working copy)
@@ -1070,11 +1070,46 @@
    return LIBUSB_SUCCESS;
 }

+ static int find_port(struct libusb_context *ctx,char* hubDevicePath, char* deviceKey, uint8_t *port_number)
+ {
+    USB_NODE_INFORMATION node_information;
+    USB_NODE_CONNECTION_NAME_FIXED driver_key;
+    char driverKey[MAX_PATH_LENGTH];
+    HANDLE handle;
+    DWORD bytes_read;
+    int curPort;
+    int Result = LIBUSB_ERROR_IO;
+    handle = CreateFileA(hubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING,FILE_FLAG_OVERLAPPED, NULL);
+    if (handle == INVALID_HANDLE_VALUE) {
+           usbi_warn(ctx, "could not open hub %s: %s", hubDevicePath, windows_error_str(0));
+           return LIBUSB_ERROR_ACCESS;
+       }
+    
+    node_information.NodeType = UsbHub ;
+    if (DeviceIoControl(handle,  IOCTL_USB_GET_NODE_INFORMATION, &node_information,sizeof(node_information),  &node_information,sizeof(node_information), &bytes_read,NULL)) {
+        for (curPort=1; curPort <= node_information.u.HubInformation.HubDescriptor.bNumberOfPorts; curPort++)
+        {
+            driver_key.ConnectionIndex = curPort;
+            if (DeviceIoControl(handle,  IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, &driver_key,sizeof(driver_key),  &driver_key,sizeof(driver_key), &bytes_read,NULL)) { 
+                wchar_to_utf8_ms(driver_key.NodeName, driverKey,sizeof(driverKey));
+                if (strcmp(driverKey, deviceKey) == 0) {
+                    *port_number=(uint8_t) curPort;
+                    Result = LIBUSB_SUCCESS;
+                    break;
+                }
+            }
+        }
+    }
+        
+    CloseHandle(handle);
+    return Result;
+ }
+
 /*
  * Populate a libusbx device structure
  */
 static int init_device(struct libusb_device* dev, struct libusb_device* parent_dev,
-                      uint8_t port_number, char* device_id, DWORD devinst)
+                      char* deviceKey, char* device_id, DWORD devinst)
 {
    HANDLE handle;
    DWORD size;
@@ -1083,17 +1118,19 @@
    struct libusb_context *ctx = DEVICE_CTX(dev);
    struct libusb_device* tmp_dev;
    unsigned i;
+   uint8_t port_number=0;

    if ((dev == NULL) || (parent_dev == NULL)) {
        return LIBUSB_ERROR_NOT_FOUND;
    }
    priv = _device_priv(dev);
    parent_priv = _device_priv(parent_dev);
+
    if (parent_priv->apib->id != USB_API_HUB) {
        usbi_warn(ctx, "parent for device '%s' is not a hub", device_id);
        return LIBUSB_ERROR_NOT_FOUND;
    }
-
+    
    // It is possible for the parent hub not to have been initialized yet
    // If that's the case, lookup the ancestors to set the bus number
    if (parent_dev->bus_number == 0) {
@@ -1113,10 +1150,20 @@
        usbi_err(ctx, "program assertion failed: unable to find ancestor bus number for '%s'", device_id);
        return LIBUSB_ERROR_NOT_FOUND;
    }
+
+   priv->depth = parent_priv->depth + 1;
+
+   if (priv->depth != 0) {
+       if (find_port(ctx,parent_priv->path, deviceKey,&port_number) != LIBUSB_SUCCESS) {
+           usbi_err(ctx, "program assertion failed: unable to find port number number for '%s'", device_id);
+           return LIBUSB_ERROR_NOT_FOUND;
+       }
+   }
+
    dev->bus_number = parent_dev->bus_number;
    priv->port = port_number;
    dev->port_number = port_number;
-   priv->depth = parent_priv->depth + 1;
+   
    priv->parent_dev = parent_dev;
    dev->parent_dev = parent_dev;

@@ -1347,6 +1394,7 @@
    size_t class_index = 0;
    unsigned int nb_guids, pass, i, j, ancestor;
    char path[MAX_PATH_LENGTH];
+   
    char strbuf[MAX_PATH_LENGTH];
    struct libusb_device *dev, *parent_dev;
    struct windows_device_priv *priv, *parent_priv;
@@ -1627,7 +1675,7 @@
                }
                break;
            case GEN_PASS:
-               r = init_device(dev, parent_dev, (uint8_t)port_nr, dev_id_path, dev_info_data.DevInst);
+               r = init_device(dev, parent_dev, strbuf, dev_id_path, dev_info_data.DevInst);
                if (r == LIBUSB_SUCCESS) {
                    // Append device to the list of discovered devices
                    discdevs = discovered_devs_append(*_discdevs, dev);
Index: libusb/os/windows_usb.h
===================================================================
--- libusb/os/windows_usb.h (revision 1153)
+++ libusb/os/windows_usb.h (working copy)
@@ -352,6 +352,7 @@
 #define USB_GET_NODE_INFORMATION                258
 #define USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION 260
 #define USB_GET_NODE_CONNECTION_NAME            261
+#define USB_GET_NODE_CONNECTION_DRIVERKEY_NAME  264
 #define USB_GET_HUB_CAPABILITIES                271
 #if !defined(USB_GET_NODE_CONNECTION_INFORMATION_EX)
 #define USB_GET_NODE_CONNECTION_INFORMATION_EX  274
@@ -425,6 +426,12 @@
 #define IOCTL_USB_GET_NODE_CONNECTION_NAME \
   CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)

+#define IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME \
+  CTL_CODE(FILE_DEVICE_USB, USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+
+
+
 // Most of the structures below need to be packed
 #pragma pack(push, 1)


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

Thanks. I don't mind the idea of not using APIs that seem to be flaky (or rather, that hardware manufacturers appear to have overlooked) to figure out the port number, but on the other hand, this adds a lot of code for something that we used to get with a single API call, and for something as elementary as getting the OS tell us which port a device is connected to. If we find that SPDRP_LOCATION_INFORMATION works all the time, it would drastically simplify the change we need to make to get a port number.
Also, we need to be careful about issuing IOCTLs to hubs. Some of these may generate bus traffic, and we have a bunch of people who get very annoyed about traffic being issued to the bus during enum, as it may disrupt ongoing time-critical transfers.

I'll try to take a closer look at your proposal when I get a chance. Thanks again for taking the time to investigate and submit it.

/Pete


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

http://www.osronline.com/showthread.cfm?link=239512

mentions differences between vendors/implementations already, So yeah the extra bus traffic isn't ideal but at-least it doesn't rely on strings beyond our control being in a specific format we expect.


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
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
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

Poke, and updates on getting this fixed? Telling rtl-sdr and bladerf users 'try a different physical usb port, yeah makes no sense, do it anyway' is kinda losing it's charm.


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

Thanks for reminding me. I'll try to look at it soon...ish.

/Pete


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Libusbx-devel] [libusbx] Windows: ASMedia XHCI enumeration issues. (#147)

daves0
In reply to this post by daves0

Initial testing of your patch indicates that this seems to fail for both composite and driverless devices. Composite seems to be due to not processing the usbccgpp, but its children, and driverless seems to be due to driverless devices not providing a software key/driver key in the first place (which indeed is confirmed by our existing message The following device has no driver, libusb will not be able to access it, which is only triggered if the driver key was not found)...

/Pete


Reply to this email directly or view it on GitHub.


------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
libusbx-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel
Loading...