Port Detection IDE on Linux

55 views
Skip to first unread message

Chris Nyland

unread,
Jan 26, 2021, 5:14:17 AM1/26/21
to Developers
Hello,

I have been messing about with a UNO board I own and run several different Linux distros at home. Specifically on my laptop I find plugging and unplugging leads to different ttyUSB devices being assign. When I took to the internet I found common answer was to create some udev rules to make sure my devices always gets mapped to the same tty device. The rule was easy enough to create but I found that the IDE won't pick up on the new assignment. 

Based on a quick survey of the internet it seems lots of people would like to map to /dev/arduino. I ran across this post on the arduino forums https://forum.arduino.cc/index.php?topic=387200.0 suggesting this regex might to be blamed for the /dev/arduino device not showing up in the Tools>Ports drop down. However I modified my rule file to use something like ttyUSB100 which the regex should find and still this device did not show up in the list. 

Is allowing something like a /dev/arduino device available via the Tools>Ports drop down something you guys would be agreeable to? If it is I would be willing to do the work but I need some pointing in the right direction. I cloned the repo and was able to follow the instructions to get a build but after quite a bit of poking around I was unable to effect the Ports list. If someone could give me a hint of where to start I could make some adjustments and then give it a test on my desktop (Arch) and laptop (BunsenLabs/Debian). Then I could just submit a pull request.

Or maybe there is a reason why this isn't a good idea just let me know it just seems a shame to not be able to take advantage of the udev rules. 

Chris Nyland

per1234

unread,
Jan 26, 2021, 5:26:31 AM1/26/21
to Developers, meny...@gmail.com
I think there is some related discussion here:
https://github.com/arduino/Arduino/issues/5096

There seems to be something similar happening in Arduino CLI:

Chris Nyland

unread,
Feb 13, 2021, 3:18:57 AM2/13/21
to Developers, per1234, Chris Nyland
Hello,

With some helpful direction from Per I have made changes to the libserialport library, used by the Arduino IDE to get the serial port list that is presented the Tool>Ports drop down menu, to allow it to show TTY devices that are symlinks to real devices on Linux. Symlinks to devices are common on Linux when udev rules are used to direct a specific device to a device name. It appears this has been an out standing issue for a while as noted in the bug report below


I have added a comment to that bug indicating I have changes to libserialport.

The libserialport library is actually part of a project call sigrok. I have initiated a pull request with that project to have my changes reviewed and merged. I am fairly confident that my changes should not affect Windows or Mac and I am less sure about BSD. Additionally I was only able to test my changes with my single UNO board, more testing probably needs to be done since this library ultimately responsible for list and configuration the serial ports. 

Please let me know what else I might be able to do to help these changes along or assist with testing.

VR,

Chris Nyland

Chris Nyland

unread,
Jun 22, 2021, 4:50:30 AM6/22/21
to Developers
All,

I posted a few months ago about doing some work so that symlinks to serial ports would be recognized by the Arduino IDE on Linux. After a bit of searching and some help from the mailing list I determined that the code changes need to happen in the libserialport library that is part of the sigrok project. I made the changes to the libserialport library in order to allow it to list the symlink ports and tested it to see if it would work with the Arduino IDE they did. I created a pull request for both the sigrok project and a fork controlled by Martin Ling who appears to be the lead developer. I haven't gotten any response to either pull request since I submitted them in February/March. It seems like the Arduino project has its own fork of the libserialport however it hasn't been touched in quite some time. Would it be acceptable to update and apply the changes to the Arduino fork? I guess what I am asking is since it doesn't seem like my PRs are going to be acted on at the two "official" repos, what is the best way to get these changes rolled into the Arduino IDE?

I can do more work if needed but I tested my changes on Arch and Debian. From my analysis of the code Windows and Mac should not be affected, since neither allows symlinks for serial ports. The only OS supported by libserialport that I am uncertain of is BSD. I have no experience with BSD but looking at the code it doesn't seem to use the same mechanism to find the serial ports so it should also be unaffected by my changes. 

Just let me know I would like to have this feature standard in the IDE.

VR,

Chris Nyland
Reply all
Reply to author
Forward
0 new messages