libftdi Archives

Subject: control multiple devices with same VID/PID independently

From: Ryan Tennill <rtennill@xxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 12 Sep 2012 16:15:38 -0500
I need to open and monitor LOTS (> 50) of FTDI devices on a single
computer as serial ports with CBUS GPIO. We're using one of the FT232R's
CBUS pins as power enable and UART activity for now.

Is there a standard way for opening and controlling multiple devices
simultaneously and independently? Even when I only create one child
process and open one device, the call to ftdi_set_bitmode() is sent to
ALL DEVICES even ones not explicitly opened!

I am using libftdi 0.20 and libusb0.1 which may not be thread-safe...
http://developer.intra2net.com/mailarchive/html/libftdi/2012/msg00118.html

If libftdi-1.0 / libusb-1.0 thread-safe then I should probably consider
switching over but I still don't understand why my set_bitmode() goes to
all attached FT232's...

Pseudocode:
 - ftdi_new()
 - ftdi_init()
 - ftdi_usb_find_all()
 - for all found devices 
    - ftdi_usb_open_desc_index(ftdi,DEVICE_VID,DEVICE_PID,NULL,NULL,i)
    - read chipID and get serial from EEPROM
    - ftdi_usb_close(ftdi) after reads
    - fork() and child execl()'s another program to manage UART 
      and CBUS after parent exits
    - parent sets process group ID of child to new group shared
      by all children (** this might be a problem too ? **)
 - once all children processes created and running, parent 
   cleans up eeprom, ftdi_dev_list, ftdi_deinit, and exits


The child process opens devices by serial using the following call:
  ftdi_usb_open_desc(ftdi, DEVICE_VID, DEVICE_PID,NULL,ftdi_serial)


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

Current Thread