Closed TheEdward162 closed 1 month ago
@TheEdward162 could you please share how you enabled running espflash without root on alpine linux?
My user account is in the dialout group. I have eudev setup. I can read the port ttyACM0.
~/esp % cargo run --release -- --list-all-ports
Finished `release` profile [optimized + debuginfo] target(s) in 0.24s
Running `espflash flash --monitor target/riscv32imc-unknown-none-elf/release/esp-first-try --list-all-ports`
[2024-05-16T13:39:48Z INFO ] Serial port: '/dev/ttyACM0'
[2024-05-16T13:39:48Z INFO ] Connecting...
Error: espflash::serial_error
× Failed to open serial port /dev/ttyACM0
├─▶ Error while connecting to device
├─▶ IO error while using serial port: Permission denied
╰─▶ Permission denied
1 ~/esp % file /dev/ttyACM0
/dev/ttyACM0: character special (166/0)
~/esp % ls /dev/ttyACM0
/dev/ttyACM0
~/esp % ls /dev/ttyACM0 -lah
crw-rw---- 1 root dialout 166, 0 May 16 15:44 /dev/ttyACM0
Running the command espflash flash --monitor target/riscv32imc-unknown-none-elf/release/esp-first-try --list-all-ports --before usb-reset
as root solves the issue for me.
--before usb-reset
is currently required for me, due to issue #636
Hi, I've been trying to use espflash from Alpine linux and on my system
serialport::available_ports()
returns something like[SerialPortInfo { port_name: "/dev/ttyS0", port_type: Unknown }, SerialPortInfo { port_name: "/dev/ttyUSB0", port_type: Unknown }]
. The function that handles this expectsport_name
to be in the form of/sys/class/tty/*
and this makes espflash not work on my system due to being unable to detect any serial ports.In this PR I've added a branch which checks if the path returned from
available_ports
starts with/dev/
and if it does it replaces it with/sys/class/tty/
and proceeds as before. I can confirm this works for flashing esp32c3 board I'm working with.I'm not sure this is the best approach but at least it works now. Let me know if you think this can be improved in an obvious way.