Test code:
#include <ftdi.hpp>
#include <string>
#include <fmt/core.h>
int main(int argc, char **argv)
{
int vid = 0x0403, pid = 0x6010;
Ftdi::Context ftdi_context;
std::string ftdi_description("Lattice FTUSB Interface Cable");
if (ftdi_context.open(vid, pid, ftdi_description) != 0)
{
fmt::print("Failed to open \"{:s}\" \"{:s}\"\n", ftdi_description, ftdi_context.error_string());
}
else
{
auto vendor = ftdi_context.vendor();
auto description = ftdi_context.description();
auto serial = ftdi_context.serial();
fmt::print("Vendor \"{:s}\", Description \"{:s}\", Serial \"{:s}\"\n", vendor, description, serial);
}
return EXIT_SUCCESS;
}
I was hoping that my test code would return the following:
Vendor "Lattice", Description "Lattice FTUSB Interface Cable", Serial ""
Instead I get the following:
Vendor "�U���", Description "Lattice FTUSB Interface Cable", Serial "@"
Is there something else that needs to be done for ftdi_context.vendor() and ftdi_context.serial() to be populated?