libftdi Archives

Subject: ftdi_usb_open*() functions now require root access?

From: Paul E Ourada <paul@xxxxxxxxxxxxxxxxxxx>
To: "libftdi@xxxxxxxxxxxxxxxxxxxxxxx" <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 12 Sep 2019 21:49:03 +0000
Some of you may recognize me from earlier posts. 

I am working on an RPi3 B+ system running the most recent Raspbian Buster which has been updated. Results of uname -a:

Linux tse09b 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux

The target FTDI devices are on a custom board on which there are four FT4232H/Q devices. Two are used for normal serial I/O such as rs232, 422, 485, and the others are used mostly for GPIO. The FTDI devices are hardwired to a Microchip USB hub, which is then connected to the RPi3 via cable. We keep track of which FTDI does what function by programming a FLASH eeprom. The /dev/ttyUSB* devices are all set up using udev rules, and everything seems to be playing nicely there wrt to group and permissions. All 16 interfaces get assigned to a /dev/ttyUSBx device via the kernel and the ftdi_sio driver, mode 664 and group plugdev. When I run minicom on /dev/ttyUSB[0-9]*, it runs fine. All of this part of the system seems to be copacetic.

The issue is that I cannot open the FTDI devices used for GPIO via the methods that use a device handle or a description (ftdi_usb_open*() ) unless I elevate permissions to sudo/root.

To troubleshoot, I pulled the latest libftdi1 sources down, and built directly on the RPi3. Since I'm using the FT4232, I modified the product code to 0x6011. Then I used the example programs to see how they compared to my custom programs. They fared no better. I attempted to use the bitbang example, and I get an error like this:
$./bitbang
unable to open ftdi device: -4 (usb_open() failed)

But when I run bitbang with sudo, it runs just fine.  Other example programs have the same issue.
$sudo ./bitbang
ftdi open succeeded: 0
enabling bitbang mode
turning everything on
turning everything off
fe fd fb f7 ef df bf 7f
fe fd fb f7 ef df bf 7f
fe fd fb f7 ef df bf 7f
fe fd fb f7 ef df bf 7f
disabling bitbang mode

Previously, I had been running on an RPi2 B+ system with Raspbian Jessie. I had no issues needing root access on this system. I used libftdi1-1.4 on both systems.

Was there some change in udev or the kernel that messes w/the usb device permissions? I looked through the git log and saw that there is a new AUTO_DETACH_REATACH_SIO_MODULE enum and this gets initialized in the ftdi_init() function, just like the old AUTO_DETACH_SIO_MODULE.

Thanks in Advance,

Paul E Ourada

Principal/Owner

BluSkai Systems, LLC

paul@xxxxxxxxxxxxxxxxxxx

(m) 303-396-2872



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


Current Thread