Supported Operating Systems of FT_GetDeviceInfoList

Mac OS X (10.4 and later)
Windows (2000 and later)
Windows CE (4.2 and later)

内置天猫精灵系统 花一台机器钱 当两台用! | 月销量1003件



Summary of FT_GetDeviceInfoList

This function returns a device information list and the number of D2XX devices in the list.

Definition of FT_GetDeviceInfoList

LPDWORD lpdwNumDevs)

Parameters of FT_GetDeviceInfoList

*pDest        Pointer to an array of FT_DEVICE_LIST_INFO_NODE structures.
lpdwNumDevs      Pointer to the number of elements in the array.

Return Value of FT_GetDeviceInfoList

FT_OK if successful, otherwise the return value is an FT error code.

Remarks about  FT_GetDeviceInfoList

This function should only be called after calling FT_CreateDeviceInfoList. If the devices connected to the
system change, the device info list will not be updated until FT_CreateDeviceInfoList is called again.
Location ID information is not returned for devices that are open when FT_CreateDeviceInfoList is called.
Information is not available for devices which are open in other processes. In this case, the Flags
parameter of the FT_DEVICE_LIST_INFO_NODE will indicate that the device is open, but other fields will
be unpopulated.
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.
The array of FT_DEVICE_LIST_INFO_NODES contains all available data on each device. The structure of
FT_DEVICE_LIST_INFO_NODES is given in the Appendix. The storage for the list must be allocated by
the application. The number of devices returned by FT_CreateDeviceInfoList can be used to do this.
When programming in Visual Basic, LabVIEW or similar languages, FT_GetDeviceInfoDetail may be
required instead of this function.
Please note that Linux, Mac OS X and Windows CE do not support location IDs. As such, the Location ID
parameter in the structure will be empty under these operating systems.

Example of FT_GetDeviceInfoList

FT_STATUS ftStatus;
DWORD numDevs;
// create the device information list
ftStatus = FT_CreateDeviceInfoList(&numDevs);
if (ftStatus == FT_OK) {
printf(“Number of devices is %d\n”,numDevs);
if (numDevs > 0) {
// allocate storage for list based on numDevs
devInfo =
// get the device information list
ftStatus = FT_GetDeviceInfoList(devInfo,&numDevs);
if (ftStatus == FT_OK) {
for (int i = 0; i < numDevs; i++) {
printf(“Dev %d:\n”,i);
printf(” Flags=0x%x\n”,devInfo[i].Flags);
printf(” Type=0x%x\n”,devInfo[i].Type);
printf(” ID=0x%x\n”,devInfo[i].ID);
printf(” LocId=0x%x\n”,devInfo[i].LocId);
printf(” SerialNumber=%s\n”,devInfo[i].SerialNumber);
printf(”  Description=%s\n”,devInfo[i].Description);
printf(” ftHandle=0x%x\n”,devInfo[i].ftHandle);

© 版权声明
评论 抢沙发