add device port number, usb_device
"Alexander Stohr" <[email protected]> Mon, 16 Mar 2015 10:48:20 +0100
| Newsgroups | gmane.comp.lib.libusb.devel.windows |
|---|---|
| Message-ID | <trinity-9fb79d74-cf9f-47e4-bdbf-895b42f98470-1426499300268@3capp-gmx-bs69> |
refering to this old topic: https://sourceforge.net/p/libusb-win32/mailman/libusb-win32-devel/thread/[email protected]/ the creator of the topic wrote: > If I could translate a libusb0 symbolic index path to an interface’s DevicePath > (i.e. SP_DEVICE_INTERFACE_DETAIL.DevicePath, ex. > \\?\usb#vid_[VID]&pid_[PID]#[serialNumber]#{[GUID]}), > then I could use the DevicePath to get its SPDRP_ADDRESS property > (which is the port number). a participant responded: > BTW, take note the format of DevicePath is not fixed since some USB device may not have a serial number. in fact the Windows OS demands that the DevicePath is unique. in case there is no serial number then the OS decides to use the (still unique but not "moveable") connetor path. this path is dependent on the topology and can for USB devices include the hub and port numbers plus a bit more. if looking to the dumps from a later on added posting in that thread then you will see a real world example: C:\libusbK-dev-kit>klist Loading USB ID's maintained by Stephen J. Gowdy <linux.usb.ids@...>.. 1. STMicroelectronics STLink dongle (SGS Thomson Microelectronics) [Connected] Service : libusb0 ClassGUID : {EB781AAF-9C70-4523-A5DF-642A87ECA567} DeviceID : USB\VID_0483&PID_3748\8&23117AA8&0&1 DeviceInterfaceGUID : {47C9C148-9738-1A9B-2CB6-86C13FA48892} SymbolicLink : \\?\usb#vid_0483&pid_3748#8&23117aa8&0&1#{47c9c148-97 38-1a9b-2cb6-86c13fa48892} DevicePath : \\.\libusb0-0001 SerialNumber : 8&23117AA8&0&1 BusNumber : 0 DeviceAddress : 1 as you can see the serial number is not really something a USB device would typically export (probably it's device stored and provided string constant is just an empty property) but it is rather a concataneted sequence of hub and port numbers. conclusion: there is (in theory) always a string that forms a valid (and hopefully unique) serial number. the contents of the OS used serial number entry is never empty/missing even if the low-level physical device layer does not provide one. BTW there are some USB-JTAG debugger devices from a certain vendor around that all have the same serial. with this setup at least the Windows OS will only allow to access one of these devices at a certain time. it can be guessed that the vendor wanted this unit to be for some single-target demo use only. (and production might be a bit cheaper...) the professional fully featured debuggers for that vendor can be optained from third parties at a noticeably higher price. (the sales volum is low compared to the numbers of units on consumer markets.) -Alex. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Libusb-win32-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel