FTDI Community

General Category => Discussion - Drivers => Topic started by: prex on June 12, 2018, 05:27:35 PM

Title: Issues with using D2XX driver without root privileges on Ubuntu (udev)
Post by: prex on June 12, 2018, 05:27:35 PM
Hi there,

I hope this is not a stupid question and that this community can help me.

I'm using FTDI D2XX driver on a virtual Ubuntu 16.04. However, I have some issues with accessing my devices without root privileges. The EEPROM/read example, which comes with the driver just worked fine executed as root. However, I can not execute it as "normal" user. And I have the same problem with my own software. Therefore, I was trying to set up an udev rule. Seems to work fine on my "physical" Ubuntu 16.04, but not on VMware. I have the exactly same rule on my "physical" Ubuntu and it works without root privileges. This is what I did:

Code: [Select]
cd /etc/udev/rules.d

sudo gedit 52-thorlab.rules

SUBSYSTEMS==”usb”,  ATTRS{idVendor}==”0403”, ATTRS{idProduct}==”faf0”,
GROUP=”student”

sudo udevadm control –reload-rules

Any help is appreciated.

Best,

prex
Title: Re: Issues with using D2XX driver without root privileges on Ubuntu (udev)
Post by: FTDI Community on June 13, 2018, 11:34:39 AM
Hello,

Thanks for your question.

As you have discovered, elevated privileges are required to interact with the USB subsystem via a user space program. Thus requiring any software which makes use of the D2XX library to be run with these elevated privileges, this is usually achieved by running as 'root'.

I have found the following useful when writing udev rules:
http://www.reactivated.net/writing_udev_rules.html (http://www.reactivated.net/writing_udev_rules.html)

I would suggest that if the rule works on a physical Ubuntu system, that it should work on a Virtual Machine. Although in my practical experience this is rarely the case, and VMs can be tedious to debug.

Unfortunately we have limited experience with VMs here at FTDI, hopefully one of the other forum members could point you in the right direction. Otherwise the VMware or Ubuntu forums are likely to be helpful with such an issue.

VMware:
https://communities.vmware.com/community/vmtn/overview (https://communities.vmware.com/community/vmtn/overview)

Ubuntu:
https://ubuntuforums.org/ (https://ubuntuforums.org/)

Best Regards,
FTDI Community
Title: Re: Issues with using D2XX driver without root privileges on Ubuntu (udev)
Post by: prex on June 13, 2018, 01:08:10 PM
Thanks for your reply. I actually spent some more time trying to get the right privileges on VMWare Ubuntu and finally succeeded. I added my user to the dialout and tty group:
Code: [Select]
sudo usermod -aG tty user
sudo usermod -aG dialout user

And then added another udev rule, which shouldn't be necessary anymore... but now it's working.

99-ftdi.rules
Code: [Select]
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="faf0", GROUP="users", MODE="0666"

And then restarted the whole system.