-
-
Notifications
You must be signed in to change notification settings - Fork 40
feat: install udev rules for UNO Q #240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||
| #!/usr/bin/env bash | ||||||
|
|
||||||
| arduino_zephyr_rules () { | ||||||
| cat <<EOF | ||||||
| # Arduino Zephyr rules | ||||||
|
|
||||||
| # Arduino UNO Q | ||||||
| SUBSYSTEM=="usb", ATTR{idVendor}=="2341", ATTR{idProduct}=="0078", MODE="0666" | ||||||
|
|
||||||
| EOF | ||||||
| } | ||||||
|
|
||||||
| OS="$(uname -s)" | ||||||
| case "$OS" in | ||||||
| Linux*) | ||||||
| if [ "$EUID" -ne 0 ]; then | ||||||
| if [ -e "${PWD}/post_install.sh" ]; then | ||||||
| if command -v pkexec > /dev/null 2>&1; then | ||||||
| echo "Requesting root privileges via $PKEXEC..." | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The I don't see any need to surface to the user the exact tool that is being used to request the privileges, so I think the best approach is to reword it as in my suggestion above. |
||||||
| pkexec "${PWD}/post_install.sh" | ||||||
| else | ||||||
| echo | ||||||
| echo "You might need to configure permissions for uploading." | ||||||
| echo "To do so, run the following command from the terminal:" | ||||||
| echo "sudo \"${PWD}/post_install.sh\"" | ||||||
| echo | ||||||
| exit | ||||||
| fi | ||||||
| else | ||||||
| # Script was executed from another path. It is assumed this will only occur when user is executing script directly. | ||||||
| # So it is not necessary to provide the command line. | ||||||
| echo "Please run as root" | ||||||
| fi | ||||||
|
|
||||||
| exit | ||||||
| fi | ||||||
|
|
||||||
| arduino_zephyr_rules > /etc/udev/rules.d/60-arduino-zephyr.rules | ||||||
|
|
||||||
| # reload udev rules | ||||||
| echo "Reload rules..." | ||||||
| udevadm trigger | ||||||
| udevadm control --reload-rules | ||||||
|
|
||||||
| ;; | ||||||
| esac | ||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though it is not required for the specific use case of uploading a sketch to the board, I think it is worth also adding a rule for the "EDL mode" we put the board in when flashing the Linux operating system image to the board.