Skip to content

Linux Serial & USB

nerdCopter edited this page Mar 14, 2023 · 10 revisions

Linux Serial/USB device access

Debian/Ubuntu:

Edit/create udev rules (use vi, nano, or any text editor). * Note: The filename/order can be different as per personal preferences. 45-stdfu-permissions.rules is typical of most Cleanflight/Betaflight installations.

sudo nano /etc/udev/rules.d/45-stdfu-permissions.rules

Copy/paste this content and save it: (See STM list here: https://devicehunt.com/view/type/usb/vendor/0483)

# ALL STMicroelectronics devices & DFU
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="****", GROUP="plugdev", MODE="0664"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="****", GROUP="plugdev", MODE="0664"

Then reload the rules:

sudo udevadm control --reload

You must add yourself (username) to plugdev group.

sudo usermod -a -G plugdev $USER

Also, add yourself to the dialout group for tty/serial permissions: (Fixes Failed to open serial port: FILE_ERROR_ACCESS_DENIED)

sudo usermod -a -G dialout $USER

Often, ModemManger is installed by default, but we rarely use phone-line dial-up modems any more, so fix some issues by removing it:

sudo systemctl stop ModemManager.service
sudo apt remove modemmanager

Required: After all of the above, you must logout/login to update user access rights. Afterward, you may run EmuConfigurator which should properly connect to flight controllers.

Arch:

Similar to all of the above, except GROUP/MODE can be replaced with TAG:

# ALL STMicroelectronics devices & DFU
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="****",  TAG+="uaccess"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="****",  TAG+="uaccess"
Clone this wiki locally