libftdi Archives

Subject: open failure for requested FTDI device if another FTDI device can't be opened

From: Eric Smith <eric@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 19 Jun 2019 17:12:37 -0600
Hi,

I'm using libftdi indirectly indirectly through pylibftdi, and have encountered a problem that seems to be in libftdi. I think pylibftdi isn't causing the problem, though it's possible that my analysis is wrong.

I'm using a C232HM-DDHSL-0 cable, base don the FT232H chip, in bit-bang mode. That's working fine in a simple test program. When I try to integrate it in a larger system, and attempt to open it, I get the error:

  File "/usr/lib/python3.7/site-packages/pylibftdi/device.py", line 173, in open
    raise FtdiError(msg)
pylibftdi._base.FtdiError: b'usb_open() failed' (-4)

The larger system has a second FTDI device, a US232R cable using an FT232RQ chip. However, I am specifically requesting an open of the cable I want by serial number. That works fine as long as only the cable I want is plugged in, but fails if the second cable is also plugged in.

It appears that the reason for this is that the permissions on the second cable are not set for world access. The libftdi code appears to error out as soon as it encounters an FTDI device it can't open, and does not proceed to try opening other devices.

If I set the permissions on the device I _don't_ want to use to 666 (world read/write), then I can open the device I _do_ want without any problem.

In my opinion, the code should not return the "usb_open() failed" error until it has tried all of the possible devices and not found a suitable match for the serial number I've requested, even if some other device can't be opened.

Best regards,
Eric Smith


**********************

This message may contain privileged or confidential information for the sole use of the intended  recipient.  Any review or distribution by others is strictly prohibited.  If you are not the intended recipient of this message, you may not make use of, or rely in any way on this information.  You should immediately notify the sender by reply email and destroy this message.  Please advise us immediately if you or your employer do not consent to Internet email for messages of this kind.

**********************



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


Current Thread
  • open failure for requested FTDI device if another FTDI device can't be opened, Eric Smith <=