Skip to content
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

The "USB access right on Linux" section in readme.md is not specific or correct enough. #23

Open
XinLong-Li opened this issue Feb 18, 2023 · 1 comment

Comments

@XinLong-Li
Copy link

XinLong-Li commented Feb 18, 2023

I think the "USB access right on Linux" section in readme.md is not specific or correct enough, especially for a beginner of Linux.
The command in the "USB access right on Linux" section of readme.md is shown as below:

USB access right on Linux

On Linux, to be able to flash the node you need to have access right to the node bootloader. This can be achieved by adding a udev rules for the node bootloader.

# cat > /etc/udev/rules.d/99-lps.rules << EOF
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"
EOF

If I directly copy that command and paste it to terminal, then this is what happened:

lxl@lxl-Inspiron-3558:~$ # cat > /etc/udev/rules.d/99-lps.rules << EOF
lxl@lxl-Inspiron-3558:~$ SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"
ATTRS{idVendor}==0483,: command not found
lxl@lxl-Inspiron-3558:~$ EOF

Notice that there is an # at the begin of that command. However, that # should not be in there.

If I remove the # at the begin of that command, then I got:


lxl@lxl-Inspiron-3558:~$ cat > /etc/udev/rules.d/99-lps.rules << EOF
> SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"
> EOF
bash: /etc/udev/rules.d/99-lps.rules: Permission denied

It turned out that the current user "lxl" has no permission to create file in that directory.

My solution is to log in with root account. The root account is not active by default. So, first, I input this below command:

sudo passwd root

Then set password to active the root account.

And I switch the user from lxl to root, using the below command:

lxl@lxl-Inspiron-3558:~$ su root
Password: 
root@lxl-Inspiron-3558:/home/lxl#

And then paste that command line without # to terminal:

root@lxl-Inspiron-3558:/home/lxl# cat > /etc/udev/rules.d/99-lps.rules << EOF
> SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"
> EOF

Press Enter, and then the file 99-lps.rules was correctly created.

@ataffanel
Copy link
Member

ataffanel commented Feb 21, 2023

Your procedure is correct: # actually denotes a commands that should be run on the command line as superuser (root). $ would be used for a command to be run as a normal user. This is indeed something that might not be understandable easily by a beginner.

We have something that might be better in the lib: https://github.com/bitcraze/crazyflie-lib-python/blob/master/docs/installation/usb_permissions.md. There, the command has no $ or # header and contains sudo so when copy-pasted in the terminal it will ask for the root password.

If you think the lib approach is better and if you are interested in contributing we will gladly accept a pull-request with an updated documentation to this repos.

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

No branches or pull requests

2 participants