09-08-2009 08:14 AM
Hi all,
This is likely one of those really obvious things that I've somehow just missed, but I was wondering if anyone knew of a way to programmatically determine whether a device I'm communicating with is using USB 1.0 or 2.0? I'm working on a VISA driver for an USB instrument that returns a data set in a completely different format depending on what kind of USB port it is plugged into. The instrument itself automatically determine which format it will use - and there doesn't appear to be any obvious status/data type indicator I can read off the instrument. I could pull the data in and analyze it to determine the format, but that seems clumsy. It would be much better if I could just detect the type and parse the data based on the type...
Any help at all would be appreciated!
Thanks,
Jason
09-08-2009 09:14 AM
I'm currently doing some programming with the FTDI chipset of USB devices. The FT_GetDeviceInfoList query contains information regarding the speed. The D2XX_Programmer's Guide descriptions lists:
The flag value is a 4-byte bit map containing miscellaneous data as defined Appendix A – Type Definitions. Bit 0 (least significant bit) of this number indicates if the port is open (1) or closed (0). Bit 1 indicates if the device is enumerated as a high-speed USB device (2) or a full-speed USB device (0). The remaining bits (2 - 31) are reserved.
I also believe the information is stored in the EEPROM (again, depending upon the chip). There is a BCD field that is either 0x0110 or 0x0200 depending upon the speed.
Jason
09-08-2009 09:25 AM
Thanks for the reply! I don't know what chipset my device is using, but it seemed to me this had to be a normal, commonly available function. After seeing your reply, I went through the datasheet line-by-line (again), and I finally found a reference to a query status command that looks like it might include a byte for USB speed...
Thanks,
Jason