vim-arduino icon indicating copy to clipboard operation
vim-arduino copied to clipboard

ArduinoUploadAndSerial: screen: device or resource busy

Open elig0n opened this issue 3 years ago • 4 comments

When running :ArduinoUploadAndSerial screen's terminal window will open concurrently with the compile&upload terminal window but arduino cannot upload a sketch when the device is open and so prints this:

  File ".../.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/pyserial/serial/serialposix.py", line 325, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 16] could not open port /dev/ttyUSB0: [Errno 16] Device or resource busy: '/dev/ttyUSB0'
Error during Upload: Failed uploading: uploading error: exit status 1

System information

  • OS: linux
  • Vim: vim
  • Arduino: 1.8.19
  • CLI version: 0.24.0

elig0n avatar Aug 30 '22 22:08 elig0n

Ah, yeah this is because originally the commands were run with the simple :!cmd method, which runs synchronously so the upload comes before the serial. Now that we're using :terminal! for most things, the experience is better for everything except that the upload command doesn't block so the two get run at the same time.

The idea of writing more vimscript to cleanly block until complete on either vim or neovim is about as appealing as walking over broken glass. I'd be willing to review a PR for this, but I'm not likely to spend much time myself on supporting vimscript plugins anymore.

stevearc avatar Sep 01 '22 05:09 stevearc

Having the same issue, is there any fix for this?

Paxxous avatar Nov 20 '22 03:11 Paxxous

Nope. PRs welcome :)

stevearc avatar Nov 20 '22 21:11 stevearc

I've found a fix, I'm using lsof to find the processes running under the device directory. Then I use the kill command to kill the running process, (this isn't a permanent fix, also make sure to have sudo privileges when using finding and killing the process).

Paxxous avatar Nov 20 '22 22:11 Paxxous