Skip to content

Instantly share code, notes, and snippets.

@wlgrd
Last active January 27, 2024 22:23
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save wlgrd/17b3f8626fe3bff29a4bcad2622f2177 to your computer and use it in GitHub Desktop.
Save wlgrd/17b3f8626fe3bff29a4bcad2622f2177 to your computer and use it in GitHub Desktop.
How to set up betaflight fc with Ubuntu
1. Create a rule for the DFU
$ (echo '# DFU (Internal bootloader for STM32 MCUs)' echo 'ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"') | sudo tee /etc/udev/rules.d/45-stdfu-permissions.rules > /dev/null
2. Monitor connection and find your model (unplug/plug the fc while this cmd is active)
$ udevadm monitor --environment --udev | grep ID_MODEL_ID
3. Update the /etc/udev/rules.d/45-stdfu-permissions.rules file with your model. E.g, my MODEL_ID is 5740, and the .rules file
ends up like this:
# DFU (Internal bootloader for STM32 MCUs)
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"
# ix5
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0664", GROUP="plugdev"
4. Now reload rules
$ sudo udevadm control --reload-rules && udevadm trigger
5. You can then test the rule using when your FC is plugged in:
$ udevadm test $(udevadm info -q path -n /dev/ttyACM0)
Ensure line "MODE 0664 /etc/udev/rules.d/45-stdfu-permissions.rules" is present
6. Now check the group at which the device belongs to
You can then test the rule using when your FC is plugged in:
$ ls -lah /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 mars 17 21:57 /dev/ttyACM0
Here it is in dialout, obviosuly thinking it is a modem.
7. Stop the modem service
$ sudo systemctl stop ModemManager.service
8. Add yourself to the group plugdev and dialout (don't know which one is the "correct one")
$ sudo usermod -G plugdev -a <username>
$ sudo usermod -G dialout -a <username>
9. I had to reboot for this to work.
@BatonExt
Copy link

Dear NightCrack thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment