Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save azaslavskis/b8da3ea039d3da10439c6706d62f78ce to your computer and use it in GitHub Desktop.
Save azaslavskis/b8da3ea039d3da10439c6706d62f78ce to your computer and use it in GitHub Desktop.
gets uart permisions under linux
#!/bin/bash
# Create udev rule file
RULE_FILE="/etc/udev/rules.d/99-uart.rules"
echo "Creating udev rule at $RULE_FILE..."
sudo bash -c "cat > $RULE_FILE" <<EOF
# USB UART devices
KERNEL=="ttyUSB[0-9]*", MODE="0666"
KERNEL=="ttyACM[0-9]*", MODE="0666"
# Built-in serial ports
KERNEL=="ttyS[0-9]*", MODE="0666"
EOF
echo "Reloading udev rules..."
sudo udevadm control --reload-rules
sudo udevadm trigger
echo "UART udev rules applied. You may need to replug your device or reboot."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment