From: Xiaofan C. <xia...@gm...> - 2012-12-14 06:21:49
|
On Tue, Dec 11, 2012 at 7:01 AM, Alex Sheh <as...@ja...> wrote: > - The current code, iterates through all possible lisbub0 symbolic index > paths (i.e. “\\.\libusb0-0001” to “\\.\libusb0-0256”), and attempts to open > the libusb0 symbolic index path, by calling CreateFile(). 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). > It seems to me libusbK's klist has this capacibilty to list both symbolic link name the device path (the names are kind of reversed in klist, probably it should be changed). So you might get some help from libusbK codes as well. http://code.google.com/p/usb-travis/source/checkout C:\libusbK-dev-kit>klist Loading USB ID's maintained by Stephen J. Gowdy <lin...@gm...>.. 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 Select device (1-1) :1 Loading driver api.. Getting descriptors.. -Device: bLength :18 bDescriptorType :0x01 bcdUSB :0x0200 bDeviceClass :0x00 (Defined at Interface level) bDeviceSubClass :0x00 bDeviceProtocol :0x00 bMaxPacketSize0 :64 idVendor :0x0483 (SGS Thomson Microelectronics) idProduct :0x3748 bcdDevice :0x0100 iManufacturer :1 (STMicroelectronics) iProduct :2 (STM32 STLink) iSerialNumber :3 (V m♠IqTI‼ç) bNumConfigurations :1 !End Device -Configuration: bLength :9 bDescriptorType :0x02 wTotalLength :39 bNumInterfaces :1 bConfigurationValue :0x01 iConfiguration :0 bmAttributes :0x80 MaxPower :50 (100ma) -Interface: bLength :9 bDescriptorType :0x04 bInterfaceNumber :0x00 bAlternateSetting :0x00 bNumEndpoints :3 bInterfaceClass :0xFF (Vendor Specific Class) bInterfaceSubClass :0xFF (Vendor Specific Subclass) bInterfaceProtocol :0xFF (Vendor Specific Protocol) iInterface :4 (ST Link) -Endpoint: bLength :7 bDescriptorType :0x05 bEndpointAddress :0x81 bmAttributes :0x02 (Bulk) wMaxPacketSize :64 bInterval :0x00 !End Endpoint -Endpoint: bLength :7 bDescriptorType :0x05 bEndpointAddress :0x02 bmAttributes :0x02 (Bulk) wMaxPacketSize :64 bInterval :0x00 !End Endpoint -Endpoint: bLength :7 bDescriptorType :0x05 bEndpointAddress :0x83 bmAttributes :0x02 (Bulk) wMaxPacketSize :64 bInterval :0x00 !End Endpoint !End Interface !End Configuration -- Xiaofan |