52 int ret, i, no_devices;
53 struct ftdi_context ftdic;
54 struct ftdi_device_list *devlist, *curdev;
55 char manufacturer[128], description[128];
58 if (ftdi_init(&ftdic) < 0)
60 std::cerr <<
"ftdi_init failed" << std::endl;
64 if ((no_devices = ftdi_usb_find_all(&ftdic, &devlist, 0x0403, 0x6001)) < 0)
66 std::cerr <<
"ftdi_usb_find_all failed: " << ftdi_get_error_string(&ftdic) << std::endl;
70 std::cout <<
"Number of FTDI devices found: " << no_devices << std::endl;
73 for (curdev = devlist; curdev != NULL; i++)
75 std::cout <<
"Device #" << i << std::endl;
76 if ((ret = ftdi_usb_get_strings(&ftdic, curdev->dev, manufacturer, 128, description, 128, serial, 128)) < 0)
78 std::cerr <<
"ftdi_usb_get_strings failed: " << ftdi_get_error_string(&ftdic) << std::endl;
81 std::cout <<
" Manufacturer: " << manufacturer << std::endl;
82 std::cout <<
" Description : " << description << std::endl;
83 std::cout <<
" Serial Id : " << serial << std::endl;
84 curdev = curdev->next;
87 ftdi_list_free(&devlist);