libftdi Archives
|
From: | David Walton <dwaltoneng@xxxxxxxxx> |
---|---|
To: | libftdi@xxxxxxxxxxxxxxxxxxxxxxx |
Date: | Thu, 18 Jul 2024 10:37:59 +1000 |
The cpp wrapper also has problems when the device does not have a serial number. The following code was run with a single usb device attached. The device does not have a serial number: #include <iostream> #include <iomanip> int main(int argc, char **argv) { int vid = 0x0403, pid = 0x6010; Ftdi::Context context; Ftdi::List *list = Ftdi::List::find_all(context, vid, pid); for (Ftdi::List::iterator it = list->begin(); it != list->end(); it++) { std::cout << "Test1 " << it->vendor() << ", " << it->description() << std::endl; std::cout << "Test2 " << it->vendor() << ", " << it->description() << std::endl; std::cout << "Test3 " << it->vendor() << ", " << it->description() << ", " << it->serial() << std::endl; std::cout << "Test4 " << it->vendor() << ", " << it->description() << ", " << it->serial() << std::endl; std::cout << "Test5 " << it->vendor() << ", " << it->description() << ", " << it->serial() << std::endl; } delete list; return EXIT_SUCCESS; } Program output: Test1 Lattice, Lattice FTUSB Interface Cable Test2 Lattice, Lattice FTUSB Interface Cable Test3 Lattice, Lattice FTUSB Interface Cable, Test4 $ $ $ $ C s , Cable, Test5 $ $ $ $ C s , Cable, Once it->serial() has been accessed, it->vendor() and it->description() have been corrupted. libftdi - see http://www.intra2net.com/en/developer/libftdi for details. |
Current Thread |
---|
|