11-20-2005 09:23 PM
11-20-2005 10:31 PM
11-20-2005 10:35 PM
11-20-2005 11:48 PM
Hi,
Thanks for the information. I tried to read the PID/VID from the regedit, ENUM but the problem is, the regedit can't tell is the usb pen driver already plug in or not as the registry already there all the time. I wish i can find the API (something like Device Manager) or the registry that can tell the the USB alreayd plug in or not. Please kindly help and advise.
11-21-2005 12:13 AM
11-21-2005 02:50 AM
Unfortunately there is no easy-drive API functions, which can acuire USB device information so easily. Instead, you must use Configuration Manager API, which is declared and implemented in SETUPAPI.H/DLL. Probably it will be very hard to call them from LabVIEW. Then you must use
SetupDiGetClassDevs() - retrieve HDEVINFO handle from the GUID, which is associated with your device or hosted device driver.
SetupDiEnumDeviceInterface() - enumerate active USB devices from the above-acquired HDEVINFO resulting SP_INTERFACE_DEVICE_DATA
SetupDiGetInterfaceDeviceDetail() - acquire detail info from SP_INTERFACE_DEVICE_DATA resulting SP_DEVINFO_DATA
SetupDiGetDeviceInstanceId() - acquire the "device path name" from SP_DEVINFO_DATA, resulting a NULL-terminated string, which will include the USB VID/PID values in hex-format, such as including "USB\VID_xxxx&PID_xxxx\..." string.
You can loop above API calls for each enumeration, until the destinate VID and PID are found.
11-21-2005 04:22 AM
11-21-2005 04:35 AM
Rebecca,
What is your true object for the device?
1) Are you just trying to acquire the device VID and PID values programatically? or,
2) Are you trying to control the device through the device-driver, which is already provided for the device without using NI-VISA USB RAW layer? or,
3) Any others?
11-21-2005 05:08 AM
Hi,
I am using WinXP.
I am actually need to develop a test program for a USB device, eg: Pen drive. My application is actually test the USB functionality of the device. So when I plug the USB drive, the program need to detect the USB device and read the PID/VID of the product.
1. I want to read the PID/VID programmatically, I also want to detect whether the USB is plugged to the PC. I also want to do a write/read file to the Pen drive.
2. I know I can detect a NI VISA driver to read the device. However, if it's a USB pen drive, the windows will automatically load the Windows driver for the USB, the PC will bypass the NI driver. So, I can't use the NI Visa driver wizard.
I will look into API methods that have suggested. at the same time, we don't have other methods that suit my application, right? Thanks a lot.
11-21-2005 05:36 AM