Quantcast

Using multiple FTDI devices in the same program

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using multiple FTDI devices in the same program

Ales Fiala
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 [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using multiple FTDI devices in the same program

E.S. Rosenberg
That sounds correct, from my experience with the Open Lighting Architecture ftdi driver you need a separate context for each port (I modified it to support a 4-port single FTDI device), so devices would definitely need their individual context.

HTH,
Eli

2016-06-01 18:50 GMT+03:00 Ales Fiala <[hidden email]>:
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 [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using multiple FTDI devices in the same program

Ales Fiala
Eli,

Thanks. That validates my initial assessment. 

Still, I find the API overly cumbersome in trying to do this.  I basically have to get a separate ftdi_device_list for each context, then discard all the other devices and only keep the one I want to assign to that context.  There should be a way to only get the ftdi_device_list only once and then use the devices off that list with the multiple contexts.  I hope I am explaining my concern clearly.

Thanks again

Ales


On Thu, Jun 2, 2016 at 9:33 AM, E.S. Rosenberg <[hidden email]> wrote:
That sounds correct, from my experience with the Open Lighting Architecture ftdi driver you need a separate context for each port (I modified it to support a 4-port single FTDI device), so devices would definitely need their individual context.

HTH,
Eli

2016-06-01 18:50 GMT+03:00 Ales Fiala <[hidden email]>:
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 [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using multiple FTDI devices in the same program

E.S. Rosenberg
Hi Ales,
What I did was one device list loop (per VID/PID because I couldn't switch to the newer libftdi at the time, I hope next time I can sit on that driver the project will agree to change the dependency) which built a list of device for which an ftdi_context should be initiated.

You can have a look at the code here:
https://github.com/OpenLightingProject/ola/blob/master/plugins/ftdidmx/FtdiWidget.cpp

The FtdiInterface class is the final port while the FtdiWidget first builds the list iirc.
HTH,
Eli

2016-06-02 18:58 GMT+03:00 Ales Fiala <[hidden email]>:
Eli,

Thanks. That validates my initial assessment. 

Still, I find the API overly cumbersome in trying to do this.  I basically have to get a separate ftdi_device_list for each context, then discard all the other devices and only keep the one I want to assign to that context.  There should be a way to only get the ftdi_device_list only once and then use the devices off that list with the multiple contexts.  I hope I am explaining my concern clearly.

Thanks again

Ales


On Thu, Jun 2, 2016 at 9:33 AM, E.S. Rosenberg <[hidden email]> wrote:
That sounds correct, from my experience with the Open Lighting Architecture ftdi driver you need a separate context for each port (I modified it to support a 4-port single FTDI device), so devices would definitely need their individual context.

HTH,
Eli

2016-06-01 18:50 GMT+03:00 Ales Fiala <[hidden email]>:
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 [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using multiple FTDI devices in the same program

Ales Fiala
I see what you did.  You avoid using the ftdi_device_list to open the devices. Instead you use ftdi_usb_open_desc().  Unfortunately that will not work for me.  Some of my devices don't have a serial number.  But perhaps I can make use of the ftdi_usb_open_desc_index() function in a similar way.

Thanks for the advice.

Ales


On Thu, Jun 2, 2016 at 12:10 PM, E.S. Rosenberg <[hidden email]> wrote:
Hi Ales,
What I did was one device list loop (per VID/PID because I couldn't switch to the newer libftdi at the time, I hope next time I can sit on that driver the project will agree to change the dependency) which built a list of device for which an ftdi_context should be initiated.

You can have a look at the code here:
https://github.com/OpenLightingProject/ola/blob/master/plugins/ftdidmx/FtdiWidget.cpp

The FtdiInterface class is the final port while the FtdiWidget first builds the list iirc.
HTH,
Eli

2016-06-02 18:58 GMT+03:00 Ales Fiala <[hidden email]>:
Eli,

Thanks. That validates my initial assessment. 

Still, I find the API overly cumbersome in trying to do this.  I basically have to get a separate ftdi_device_list for each context, then discard all the other devices and only keep the one I want to assign to that context.  There should be a way to only get the ftdi_device_list only once and then use the devices off that list with the multiple contexts.  I hope I am explaining my concern clearly.

Thanks again

Ales


On Thu, Jun 2, 2016 at 9:33 AM, E.S. Rosenberg <[hidden email]> wrote:
That sounds correct, from my experience with the Open Lighting Architecture ftdi driver you need a separate context for each port (I modified it to support a 4-port single FTDI device), so devices would definitely need their individual context.

HTH,
Eli

2016-06-01 18:50 GMT+03:00 Ales Fiala <[hidden email]>:
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 [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]





libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Loading...