libftdi Archives

Subject: Using multiple FTDI devices in the same program

From: Ales Fiala <ales.fiala@xxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 1 Jun 2016 09:50:14 -0600
I am trying to understand how to open and use multiple FTDI devices in the same program.

I am using ftdi_usb_find_all() to enumerate the devices and then ftdi_usb_open_dev() to open each one and identify it. Afterwards I close each device. I do this part with just one ftdi_context.

Now that I found all the devices I want to open each selected device and keep it open for reading and writing. I notice that ftdi_context contains the following:
  • libusb_device_handle
  • readbuffer
  • eeprom

All this makes me believe that I need a separate ftdi_context for each device that I want to access.  Am I on the right track?

Using the ftdi_device_list that I found above I want to create a new context for each device and open it.

I tried doing

ftdi_new();
ftdi_usb_open_dev();

for each device using the old device list.  But I get a SIGSEGV somewhere in the depths of usb_open() in libusb. I am thinking it is because I used a device list created with one context and now am trying to open the same device using a different context.

So how do I accomplish what I want?  Any advice would be appreciated.

Regards

Ales Fiala




libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx


Current Thread