[Linux] Can't connect the the Arduino because the port is busy
RandomLegend opened this issue · comments
Hi there @Smart-Helper, thanks for writing.
You appear to have defined the port correctly in your config (it is indeed just the full device path such as /dev/ttyUSB0
). However, the error you're getting seems to suggest that something else is already occupying that port. Only a single thing can connect to a given serial port at one time, so if you have anything else that potentially occupies that connection (such as the Arduino IDE, its serial monitor panel, another instance of deej that might be running in the background, or simply another program that interacts with serial ports) - deej won't be able to connect.
There is a way to use lsof
to find out which process currently uses your device, if it doesn't seem like one of the options I listed I would suggest to look for an example of that. Please let me know if you need any help there.
Thanks!
Yeah i already checked with lsof and nothing used ttyUSB0
But i just found the culprit. I got some error on arduino when i started it and without thinking i just started it as root and it worked. And i only realized NOW that the issue i had with arduino was probably that my user didn't have permission to use the ttyUSB0
So i looked up the groupname to be used for ttyUSB0 (uucp) and put my user into it - now it works absolutely flawless and this thing is just amazing!
Thanks for the update, @Smart-Helper. Glad to hear it was just a permissions issue.
I guess that both missing permissions and the device being in active use result in us receiving the E_ACCESS error, so there is no great way to distinguish between the two and that'd explain why you received the "port busy" notification. I'll look into whether there's a better way to tell these apart in the future, but for now it's great to be aware of this solution.
I hope you'll enjoy deej!