Hi,
I am trying to run a simple program with the fdti library on Microsoft
Visual Studios 2008 in order to open a usb device. I have
libftdi.dll.a and libusb.lib linked in the additional dependencies.
It should work just fine, but as of now ftdi_usb_open() is returning
-3 (device not found), and I can't figure out why it can't find the
device.
Here is the sample code:
#include <stdio.h>
#include <ftdi.h>
int main(void)
{
if (ftdi_init(&ftdic) < 0)
int ret;
struct ftdi_context ftdic;
{
fprintf(stderr, "ftdi_init failed\n");
return EXIT_FAILURE;
}
if ((ret = ftdi_usb_open(&ftdic, 0x0403, 0x6001)) < 0)
{
fprintf(stderr, "unable to open ftdi device: %d (%s)\n", ret,
ftdi_get_error_string(&ftdic));
return EXIT_FAILURE;
}
// Read out FTDIChip-ID of R type chips
if (ftdic.type == TYPE_R)
{
unsigned int chipid;
printf("ftdi_read_chipid: %d\n", ftdi_read_chipid(&ftdic, &chipid));
printf("FTDI chipid: %X\n", chipid);
}
if ((ret = ftdi_usb_close(&ftdic)) < 0)
{
fprintf(stderr, "unable to close ftdi device: %d (%s)\n", ret,
ftdi_get_error_string(&ftdic));
return EXIT_FAILURE;
}
ftdi_deinit(&ftdic);
return EXIT_SUCCESS;
}
Please let me know all that I have to include in the project
properties in order for this to work or if I am missing something.
Thanks in advance.
--
Devon Lind
Crystalfontz America, Inc.
12412 East Saltese Ave
Spokane Valley, WA 99216-0357
Twitter @Crystalfontz devon@xxxxxxxxxxxxxxxx http://www.crystalfontz.com
Phone: 1-509-892-1200, Fax: 1-509-892-1203, US Toll Free: 888-206-9720
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|