dhylands / rshell

Remote Shell for MicroPython
MIT License
945 stars 133 forks source link

RSHELL failed to access /dev/ttyUSB0 #40

Closed Novo55 closed 6 years ago

Novo55 commented 6 years ago

don't understand why RSHELL can't see my ESP32 when Picocom can.

rshell is version 0.0.11

Running Ububtu 16.04 on dell I7 screenshot from 2018-01-05 16-20-58

screenshot from 2018-01-05 16-14-47

Novo55 commented 6 years ago

when I use sudo on the command it works, I'm such a newbie :-)

dhylands commented 6 years ago

There are two ways to make it so that you don't need to use sudo (and this is just a linux thing, nothing to do with rshell): 1 - Add your user to the dialout group. If you do ls -l /dev/ttyUSB0 you'll typically see something like this:

crw-rw---- 1 root dialout 188, 0 Dec 18 20:54 /dev/ttyUSB0

This says that the user root and the group dialout have read/write access to /dev/ttyUSB0. Note, when adding yourself to a group, you'll need to logout completely and log back in for it to take effect. You can use the id command to verify what groups your user is a member of.

2 - You can add a file to /etc/udev/rules.d which will change the permissions of the /dev/ttyUSB0 file. Follow the directions here: https://github.com/micropython/micropython/wiki/Board-STM32F407-Discovery#programming-from-linux-via-dfu (note that you don't need to install dfu-utils)

The f055 and 9800 are specific to the pyboard. I'm not sure what the values will need to change slightly for the EPS32. If the ESP32 is using an FTDI adapter, then a file with these 2 lines should work:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", MODE:="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", MODE="0666"

I'd call the file something like 49-ftdi.rules

If your rules are working properly, then ls -l /dev/ttyUSB0 should show this:

crw-rw-rw- 1 root dialout 188, 0 Dec 18 20:54 /dev/ttyUSB0

(i.e. notice the rw for 'others')

If those don't work I can help you to create a file that will. I'll need the output of lsusb while your board is plugged in.

Novo55 commented 6 years ago

Hi Dave,

been using RSHELL for a couple of weeks its an awesome tool, please keep up the good work.

regards

-- regards Steve W

tejastank commented 4 years ago

I face same issue.

@dhylands thank for you help, but it did not works somehow. I will investigate in detail.

My solution works with below command.

sudo chmod 777 /dev/ttyUSB0

or

sudo gpasswd --add ${USER} dialout

Above command works for me ;)

davehylands commented 4 years ago

I added some notes to the rshell README: https://github.com/dhylands/rshell#serial-port-permissions-linux