|
The DevicePath in WinUSB typically shows
\\?\usb#vid_0f0f&pid_2000#5&14223e91&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed} The only part I don't understand is "5&14223e91"(is it called ParentID Prefix?) Do I need it along with the bus number and device address to distinguish the usb location where the device is connected on a machine? If necessary, is it possible to get this using LibUSB-1.0 API? |
|
quile wrote:
> The DevicePath in WinUSB typically shows > > \\?\usb#vid_0f0f&pid_2000#5&14223e91&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed} > > The only part I don't understand is "5&14223e91"(is it called ParentID > Prefix?) Do I need it along with the bus number and device address to > distinguish the usb location where the device is connected on a machine? If > necessary, is it possible to get this using LibUSB-1.0 API? That is the file name you pass to CreateFile in order to send requests to the device. Formally, the format of that string is undocumented; you are supposed to treat it as opaque. The 5&14223e91&0&1 part does have some meaning. The "5" indicates how many "layers" away from the processor you are. I believe the host controller is 4, ports connected directly to the HC are 5, the first hub is 6, and so on. The14223e91 is a unique identifier for the hub you are plugged into. The 0&1 tell you which "port number" you are, for some ill-defined meaning of the phrase "port number". Why do you need to parse this? -- Tim Roberts, [hidden email] Providenza & Boekelheide, Inc. ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
As Tim points out, because libusb implements it's own equivalent of a
unique USB path identifier, and because the DevicePath is Windows specific, it seems unlikely that you should have to parse a Windows DevicePath to be able to access your device in libusb. Typically, device access in libusb is done using the VID and PID for a specific device, and if multiple devices share the same VID&PID, by checking other properties like serial number, etc. Now, we are getting a few requests to be able to find out the geographical "location" of an USB device in the USB tree (port# on the hub, hub location...), which I assume is the information you actually require. At least on Windows, we have this information internally, and it is likely that we'll implement a new API call to provide such data in the future, but for the time being, you cannot get the geographical location from libusb. Regards, /Pete ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
In reply to this post by Tim Roberts
I'm using libusbdotnet with libusb-1.0 windows backend.
I have a setup that have multiple devices with the same "everything" for their own purpose: VID, PID, Serial Number connected to the same machine and I want to distinguish these devices apart using bus number and device address while they are being used and hot plugged. I was just curious what the "5&14223e91" part mean since I didn't see it in libusb-1.0 API. Thanks for the info. |
|
On Thu, Aug 19, 2010 at 7:48 AM, quile <[hidden email]> wrote:
> > I'm using libusbdotnet with libusb-1.0 windows backend. > > I have a setup that have multiple devices with the same "everything" for > their own purpose: VID, PID, Serial Number connected to the same machine and > I want to distinguish these devices apart using bus number and device > address while they are being used and hot plugged. I was just curious what > the "5&14223e91" part mean since I didn't see it in libusb-1.0 API. Thanks > for the info. Does the device has valid serial number? If yes, then they need to be unique. If not, you may encounter unexpected results under Windows, including BSODs. http://blogs.msdn.com/b/oldnewthing/archive/2004/11/10/255047.aspx Also for some class of USB device, like the USB mass storage device, the serial number is needed by the spec. If your device has no serial number, then that is another thing. -- Xiaofan ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
The device uses custom communication. It is not a USB mass storage device. It doesn't have serial number for its own purpose, so the only unique thing between one from another when they are connected is the bus number and device address.
|
|
On Thu, Aug 19, 2010 at 8:10 AM, quile <[hidden email]> wrote:
> > The device uses custom communication. It is not a USB mass storage device. It > doesn't have serial number for its own purpose, so the only unique thing > between one from another when they are connected is the bus number and > device address. > -- I see. In that case, the device has no serial number and that is generally accepted. On the other hand, if you can add the serial number to your firmware it will make your life easier. Somehow I believe you have the control of your firmware since I remember you said that you developed the firmware for your own device. -- Xiaofan ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
Since libusb cannot currently return the geographical location of a device, what do the bus number and device address in the current API mean and differ from the bus number and device address from winusb? |
|
On 2010.08.20 00:18, quile wrote:
> Since libusb cannot currently return the geographical location of a device, > what do the bus number and device address in the current API mean and differ > from the bus number and device address from winusb? For Windows, the bus number is just a sequential number for the order in which HCDs were detected on the system. As to the device address, it is a sequential number that is increased for each additional device detected on the bus. I'm afraid it is not possible to find the geographical location of a device from these numbers alone. Regards, /Pete ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
With a suggestion from Travis Robinson on his libusbdotnet source and some modifications to the source itself to match with the current structures in libusb-1.0, I'm able to accomplish what I wanted to do leaving the libusb-1.0 windows backend intact. So far the changes seem to work, with or without hubs.
|
|
> quile wrote:
> With a suggestion from Travis Robinson on his libusbdotnet source and some > modifications to the source itself to match with the current structures in > libusb-1.0, I'm able to accomplish what I wanted to do leaving the > libusb-1.0 windows backend intact. So far the changes seem to work, with > or > without hubs. Nice.. If you can send these changes my way I'll apply as much as I can to the ludn svn branch for the next release. Unfortunately, there is no libusb-1.0 api call to check the version so digging into these private (priv) structures is obviously a bit dangerous. ;) Regards, Travis ------------------------------------------------------------------------------ Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
Hi, Is that solution worked? i have the same issue: identical devices w/o serialnumberCan i ask for some idea or code? thanks Sandor Otvos
2010/8/27 Travis <[hidden email]>
------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
On 2011.01.18 15:57, Sandor Otvos wrote:
> Hi, > Is that solution worked? i have the same issue: identical devices w/o > serialnumber > Can i ask for some idea or code? Well, I can easily add an API call for you in my branch (that also has a non official API to report the libusb version), since I have all the geolocation numbers available, but I can't guarantee that, when official finally gets around implementing it, they're not gonna have a completely different idea for how they want to do it. What would be reported from my API would be: - bus number (which is already available as a whole in libusb) - distance to root hub/HCD, in number of hubs to go through. - port number, as indicated by the OS, for the hub onto which the device is plugged. - parent libusb device Is that something you can work with? Regards, /Pete ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
Thanks,Â
Yes at least the port number provided by OS ( SetupAPI ) is good for me. And all extra info will be useful as well. This is your repo, which i can use?
http://git.libusb.org/?p=libusb-pbatard.git;a=summary;js=1 Regards Sandor 2011/1/18 Pete Batard <[hidden email]>
------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
On 2011.01.18 17:31, Sandor Otvos wrote:
> Yes at least the port number provided by OS ( SetupAPI ) is good for me. > And all extra info will be useful as well. > This is your repo, which i can use? > http://git.libusb.org/?p=libusb-pbatard.git;a=summary;js=1 Yes. Will likely be a couple of days before I add the API however. Regards, /Pete ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
As promised. pbr327 now includes the libusb_get_device_topology call,
which is defined as follows: int libusb_get_device_topology(libusb_device *dev, struct libusb_device_topology* topology) /** \ingroup dev * Returns topology information for a device * * \param dev the device to get topology properties from * \param topology the libusb_device_topology structure to be populated. * \returns 0 on success * \returns LIBUSB_ERROR_INVALID_PARAM if dev or topology are invalid * \returns LIBUSB_ERROR_NOT_SUPPORTED on platforms where the functionality * is not available * \returns another LIBUSB_ERROR code on other failure */ As to the libusb_device_topology struct, it is defined as follows. struct libusb_device_topology { /** Opaque device handle to the USB parent (a Hub or a HCD) */ libusb_device* parent_dev; /** Bus number to which the device is connected, as seen by the OS */ uint8_t bus; /** Depth to HCD for this bus (0 depth means the HCD device) */ uint8_t depth; /** Hub port onto which the device is plugged in, as seen by the OS */ uint8_t port; }; Regards, /Pete ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
Can be perused here:
http://git.libusb.org/?p=libusb-pbatard.git;a=commitdiff;h=c34d9497f31a5a4279b328bd89b99f212578fe73;js=1 Obviously I picked what made sense to me, as per the Windows backend implementation. Feel free to discuss. Regards, /Pete ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
In reply to this post by Pete Batard
On Thu, 20 Jan 2011, Pete Batard wrote:
> As promised. pbr327 now includes the libusb_get_device_topology call, > which is defined as follows: > > int libusb_get_device_topology(libusb_device *dev, > struct libusb_device_topology* topology) > > /** \ingroup dev > * Returns topology information for a device > * > * \param dev the device to get topology properties from > * \param topology the libusb_device_topology structure to be populated. > * \returns 0 on success > * \returns LIBUSB_ERROR_INVALID_PARAM if dev or topology are invalid > * \returns LIBUSB_ERROR_NOT_SUPPORTED on platforms where the functionality > * is not available > * \returns another LIBUSB_ERROR code on other failure > */ > > As to the libusb_device_topology struct, it is defined as follows. > > struct libusb_device_topology { > /** Opaque device handle to the USB parent (a Hub or a HCD) */ > libusb_device* parent_dev; > /** Bus number to which the device is connected, as seen by the OS */ > uint8_t bus; > /** Depth to HCD for this bus (0 depth means the HCD device) */ > uint8_t depth; > /** Hub port onto which the device is plugged in, as seen by the OS */ > uint8_t port; > }; Although this duplicates the Windows API, it seems that a more general approach would be better. What good does it do to know the port number on the parent hub, if you don't also know the port number on the hub's parent? I suggest passing an array of libusb_device_topology structures, where each member of the array contains: libusb_device *dev; /* Pointer to the device at this level */ unsigned bus; /* Bus number */ unsigned depth; /* Distance from the root hub */ unsigned port; /* Port number for the upstream connection */ Obviously the bus field will be the same in all members of the array, so in theory it could be returned separately. (Indeed, why isn't there a libusb_get_device_bus() function?) The depth field could be omitted if the array elements are stored in a standard order, such as by increasing depth. The port value for the root hub will naturally be 0 whereas for all others it will be positive. The number of array elements can be limited, since USB devices are not allowed to be connected more than 7 layers deep (counting the root hub). Alan Stern ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
On 2011.01.20 15:21, Alan Stern wrote:
> Although this duplicates the Windows API, it seems that a more general > approach would be better. What good does it do to know the port number > on the parent hub, if you don't also know the port number on the hub's > parent? That's what the parent_dev from the topology struct is for. issue a libusb_get_device_topology(parent_dev, ...) and you get the port number from the HUB's parent. > I suggest passing an array of libusb_device_topology structures, where > each member of the array contains: > > libusb_device *dev; /* Pointer to the device at this level */ > unsigned bus; /* Bus number */ > unsigned depth; /* Distance from the root hub */ > unsigned port; /* Port number for the upstream connection */ The thing that bothers me about this is that it probably returns more information than a user needs (but I'd like to see how topology is actually used to see if that assertion is true). I think the requirement to have the whole branch topology up to the HCD is only part of what the get_topology call will be used for, and as such, I think that users who want to build a whole branch (or tree) topology should issue multiple calls instead. For now, the cautious approach would be to keep it simple, see how it's used in real life, and then reassert. My guess is that, for most of our users, the primary use they'll have for topology is read the port number on the hub or just compare the topology values return from different devices using the same VID:PID, and little else. I don't think obtaining the whole branch/tree structure in one go would be the prime use. But again, I'd like to find out if that's true. The fact that it's being introduced in an experimental branch means we should be able to find out what's needed, before introducing it into official. How do you see the topology call being used in real life, outside of the one use of displaying a diagram of the USB tree? Regards, /Pete ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
|
On Thu, 20 Jan 2011, Pete Batard wrote:
> The thing that bothers me about this is that it probably returns more > information than a user needs (but I'd like to see how topology is > actually used to see if that assertion is true). I think the requirement > to have the whole branch topology up to the HCD is only part of what the > get_topology call will be used for, and as such, I think that users who > want to build a whole branch (or tree) topology should issue multiple > calls instead. > > For now, the cautious approach would be to keep it simple, see how it's > used in real life, and then reassert. My guess is that, for most of our > users, the primary use they'll have for topology is read the port number > on the hub or just compare the topology values return from different > devices using the same VID:PID, and little else. That makes no sense. Why would you want to compare just the port numbers? The only reason I can think of is to see whether or not a device is plugged into the same location now as at some time in the past. But how can you tell if all you know is that at both times, it was plugged into port 2? You also have to know if the parent hub was the same at both times, which means knowing what port _it_ was plugged into. And so on, all the way to the root hub. > I don't think obtaining > the whole branch/tree structure in one go would be the prime use. But > again, I'd like to find out if that's true. The fact that it's being > introduced in an experimental branch means we should be able to find out > what's needed, before introducing it into official. > > How do you see the topology call being used in real life, outside of the > one use of displaying a diagram of the USB tree? I can think of only two uses. The first is described above. The second is simply to replicate the Windows API -- for no good reason other than it's what the programmer is used to (as opposed to being what the programmer actually needs). Alan Stern ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Libusb-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/libusb-devel |
| Powered by Nabble | Edit this page |
