The Arduino serial port can be found as a symlink in /dev/serial/by-id/ We could look for a symlink with arduino in the name in that dir intead of just trying ttyACM0 and ttyACM1