how to use the function FT_GetDeviceInfoDetail?

Supported Operating Systems of FT_GetDeviceInfoDetail

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

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



Summary  of FT_GetDeviceInfoDetail

This function returns an entry from the device information list.

Definition of FT_GetDeviceInfoDetail

FT_STATUS FT_GetDeviceInfoDetail (DWORD dwIndex, LPDWORD lpdwFlags, LPDWORD lpdwType,LPDWORD lpdwID, LPDWORD lpdwLocId,PCHAR pcSerialNumber, PCHAR pcDescription,FT_HANDLE *ftHandle)

Parameters of FT_GetDeviceInfoDetail

dwIndex      Index of the entry in the device info list.
lpdwFlags      Pointer to unsigned long to store the flag value.
lpdwType      Pointer to unsigned long to store device type.

lpdwID        Pointer to unsigned long to store device ID.
lpdwLocId      Pointer to unsigned long to store the device location ID.
pcSerialNumber    Pointer to buffer to store device serial number as a null-terminated string.
pcDescription      Pointer to buffer to store device description as a null-terminated
*ftHandle      Pointer to a variable of type FT_HANDLE where the handle will be

Return Value of FT_GetDeviceInfoDetail

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

Remarks about FT_GetDeviceInfoDetail

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.
The index value is zero-based.
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.
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 lpdwFlags
parameter will indicate that the device is open, but other fields will be unpopulated.
To return the whole device info list as an array of FT_DEVICE_LIST_INFO_NODE structures, use
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_GetDeviceInfoDetail

FT_STATUS ftStatus;
FT_HANDLE ftHandleTemp;
DWORD numDevs;
DWORD Flags;
char SerialNumber[16];
char Description[64];
// create the device information list
ftStatus = FT_CreateDeviceInfoList(&numDevs);
if (ftStatus == FT_OK) {
printf(“Number of devices is %d\n”,numDevs);
if (numDevs > 0) {
// get information for device 0
ftStatus = FT_GetDeviceInfoDetail(0, &Flags, &Type, &ID, &LocId, SerialNumber,
Description,           &ftHandleTemp);
if (ftStatus == FT_OK) {
printf(“Dev 0:\n”);
printf(” Flags=0x%x\n”,Flags);
printf(” Type=0x%x\n”,Type);

printf(” ID=0x%x\n”,ID);
printf(”  LocId=0x%x\n”,LocId);
printf(” SerialNumber=%s\n”,SerialNumber);
printf(” Description=%s\n”,Description);
printf(” ftHandle=0x%x\n”,ftHandleTemp);

© 版权声明
评论 抢沙发