This is probably a pretty basic question, but it is giving me a problem. I have an FTDI USB3 development board that I want to drive by pressing buttons on a Qt form. The FTDI interface examples are all static functions, so that the generated values can be used elsewhere. Here is what I hoped would work, but pressing the button on the Qt form does not seem to call the FTDI static function (no visible response in the Qt debug). Any suggestions are welcome!
//Click button on Qt form
void StarLight::on_pushBtnFind_clicked()
{
FT_STATUS displayDevicesMethod2(void);
QApplication::processEvents();
}
// Method 2 for displaying the list of devices connected.
static FT_STATUS displayDevicesMethod2(void)
{
FT_STATUS ftStatus;
FT_HANDLE ftHandle = NULL;
// Get and display the list of devices connected
// First call FT_CreateDeviceInfoList to get the number of connected devices.
// Then call FT_GetDeviceInfoList or FT_GetDeviceInfoDetail to display device info.
// Device info: Flags (usb speed), device type (600 e.g.), device ID (vendor, product),
handle for subsequent data access.
DWORD numDevs = 0;
ftStatus = FT_CreateDeviceInfoList(&numDevs); // Build a list and return number
connected.
if (FT_FAILED(ftStatus))
{
printf("Failed to create a device list, status = %lu\n", ftStatus);
}
printf("Successfully created a device list.\n\tNumber of connected devices: %lu\n",
numDevs);
// Method 2: using FT_GetDeviceInfoDetail
if (!FT_FAILED(ftStatus) && numDevs > 0)
{
ftHandle = NULL;
DWORD Flags = 0;
DWORD Type = 0;
DWORD ID = 0;
char SerialNumber[16] = { 0 };
char Description[32] = { 0 };
for(DWORD i = 0; i <numDevs; i++)
{
ftStatus = FT_GetDeviceInfoDetail(i, &Flags, &Type, &ID, NULL, SerialNumber,
Description, &ftHandle);
if (!FT_FAILED(ftStatus))
{
printf("Device[%lu] (using FT_GetDeviceInfoDetail)\n", i);
printf("\tFlags: 0x%lx %s | Type: %lu | ID: 0x%08lX | ftHandle=0x%p\n",
Flags,
Flags & FT_FLAGS_SUPERSPEED? "[USB 3]":
Flags & FT_FLAGS_HISPEED? "[USB 2]":
Flags & FT_FLAGS_OPENED? "[OPENED]": "",
Type,
ID,
ftHandle);
printf("\tSerialNumber=%s\n", SerialNumber);
printf("\tDescription=%s\n", Description);
}
}
}
return ftStatus;
}