On Linux, if you have more than one USB TTY device, the USB port name (/dev/ttyUSBx
) changes every time one is plugged in, and there's no easy way to know the new name without going and looking through dmesg. It's trivial to set up a udev rule that creates a custom symlink so that my Arduino's FTDI can always be accessed through e.g., /dev/ttyArduino
, and this is the standard procedure for persistent access to USB devices.
However, I can't make the IDE accept anything other than the /dev/ttyUSBx
names. Even directly editing preferences.txt
is ignored.
Is there any way to instruct the IDE to use custom port names in order to access the Arduino through a symlink or other persistent name?
-
1I am not aware of a way in the Arduino IDE, but you can in UECIDE.Majenko– Majenko2016年03月25日 21:55:01 +00:00Commented Mar 25, 2016 at 21:55
-
1Look here: arduino.stackexchange.com/questions/3680/…moestly– moestly2016年03月26日 10:50:30 +00:00Commented Mar 26, 2016 at 10:50
2 Answers 2
Consider using a device name of form ttyUSBnn, where nn is fairly large. For example, in /dev you could say
sudo ln -s ttyUSB1 ttyUSB77
Then, ttyUSB77
shows up in the IDE's ports list and can be selected.
(I don't know how to set up that link using the udev
system, but imagine it can be done.)
-
Excellent hack, and it does work. Thanks. If nobody answers with an IDE configuration answer in a few days I'll accept this.Autumn– Autumn2016年03月26日 05:03:04 +00:00Commented Mar 26, 2016 at 5:03
-
This is also very dynamic and will not do what you've asked formoestly– moestly2016年03月30日 14:47:06 +00:00Commented Mar 30, 2016 at 14:47
-
Obviously this is a one-off hack and doesn't work on the next plug-in, but doing it from udev appears to work fine.Autumn– Autumn2017年03月29日 17:08:16 +00:00Commented Mar 29, 2017 at 17:08
Think the other way.
If your device has a port name, that is not supported by the IDE, you can create an additional (static) symlink /dev/USBx
that you can identify and select in the arduino IDE.
And yes, it is quite easy to make all of your arduinos unique to udev.
-
Thanks! Your link on how to flash a new serial number to an FTDI chip is very cool. Unfortunately, there's nothing similar for the (all-too-common) CH340 and PL2303 chips -- they have no onboard storage.Autumn– Autumn2017年03月29日 17:06:29 +00:00Commented Mar 29, 2017 at 17:06