0

I'm using the ftdixx driver and ftdi.so file to communicate with ft232h module. FT_Open(iport, &fthandle) function doesn't work with normal user. If it is root user,it is working and opening the port .In normal user mode, it is failing with segmentation fault in FT_Open(iport, &fthandle) function. So what could be cause of this issue.

int main()
{
FT_STATUS ftstatus;
FT_HANDLE fthandle;
int iport =0;
DWORD libversion = 0;

ftstatus = FT_GetLibraryVersion(&libversion)
if(ftstatus != FT_OK)
{
}

ftstatus = FT_Open(iport, &fthandle)
if(ftstatus != FT_OK)
{
}
return 0;
}
Vinooooo
  • 15
  • 4
  • Normal users don't have access to physical I/O ports on Linux, aside of programs with the corresponding capabilities – Adalcar Mar 08 '21 at 09:53
  • What operating system and what version of the ftdixx driver and ftdi.so library? I've never heard of the ftdixx driver and library files normally have a "lib" prefix in their name. – Ian Abbott Mar 08 '21 at 10:26
  • Linux operating system. Libftd2xx.so @IanAbbott – Vinooooo Mar 08 '21 at 10:29
  • @Adalcar is there way to give access to the normal user ? – Vinooooo Mar 08 '21 at 10:30
  • 2
    You need a UDEV rule to set the permissions. Assuming the FT232H is using the factory default USB vendor and product IDs and you want the device to be accessible to members of the "plugdev" group, the following rule in "/etc/udev/rules.d/99-libftdi.rules" will do: `SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", GROUP="plugdev", MODE="0660"`. (The "plugdev" group is common on Debian or Ubuntu systems, but I think Fedora uses the "uaccess" group instead of "plugdev", so the UDEV rule would need to be changed accordingly.) You also need to add your username to the group. – Ian Abbott Mar 08 '21 at 11:38
  • Regarding the cause of the segmentation fault within FT_Open, it is hard to tell because the source code for this function is not publicly available. There is an alternative, open source library "libftdi" with a different interface to FTDI's libftd2xx library, but is commonly packaged by Linux distros. It may be worth checking out. There is the old, "legacy" branch "libftdi-0.x" based on the libusb 0.x API, and the new branch "libftdi-1.x" based on the libusb 1.0 API. – Ian Abbott Mar 08 '21 at 12:01
  • it doesnt worked out for me . already I had tried changing the udev rule set @IanAbbott – Vinooooo Mar 08 '21 at 13:08
  • why don't you use the termios.h standard unix interface? It runs pleasantly with fdti serial interfaces, and doesn't need a library to interface. And the program you write will be portable to any other unix platform, with minor or no modifications at al. `man termios` – Luis Colorado Mar 09 '21 at 06:53
  • Hey, @Vinooooo did you get an update on that? Were you able to fix the issue ? – Traoré Moussa May 24 '22 at 20:51

0 Answers0