|
FT_STATUS
|
FT_GetDeviceInfo
|
(FT_HANDLE ftHandle, FT_DEVICE *pftType, LPDWORD lpdwID, PCHAR pcSerialNumber, PCHAR pcDescription, PVOID pvDummy)
|
Parameters
ftHandle
|
Handle of the device.
|
pftType
|
Pointer to unsigned long to store device type.
|
lpdwId
|
Pointer to unsigned long to store device 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 string.
|
pvDummy
|
Reserved for future use - should be set to NULL.
|
Return Value
FT_OK if successful, otherwise the return value is an FT error code.
Remarks
This function is used to return the device type, device ID, device description and serial number.
The device ID is encoded in a DWORD - the most significant word contains the vendor ID, and the least significant word contains the product ID. So the returned ID 0x04036001 corresponds to the device ID VID_0403&PID_6001.
Example
This example shows how to get information about a device.
FT_HANDLE ftHandle;
FT_DEVICE ftDevice;
FT_STATUS ftStatus;
DWORD deviceID;
char SerialNumber[16];
char Description[64];
ftStatus = FT_Open(0, &ftHandle);
if(ftStatus != FT_OK) {
// FT_Open failed
return;
}
ftStatus = FT_GetDeviceInfo(
ftHandle,
&ftDevice,
&deviceID,
SerialNumber,
Description,
NULL
);
if (ftStatus == FT_OK) {
if (ftDevice == FT_DEVICE_2232C)
; // device is FT2232C
else if (ftDevice == FT_DEVICE_BM)
; // device is FTU232BM
else if (ftDevice == FT_DEVICE_AM)
; // device is FT8U232AM
else
; // unknown device (this should not happen!)
// deviceID contains encoded device ID
// SerialNumber, Description contain 0-terminated strings
}
else {
// FT_GetDeviceType FAILED!
}
FT_Close(ftHandle);