I am trying to write a little program that needs to detect Arduino ports automatically. I have tried many methods but haven't found any reliable way.
I can see that the Arduino IDE can detect it, by showing /dev/cu.xyz (Arduino Uno) or COM6 (Arduino Uno) etc.
How could I detect if the device connected to the serial port is an Arduino or not? Preferably without pre-flashing the Arduino with specific firmware.
I found this Python version, which uses serial.tools.list_ports.comports() herehere, but it didn't work when I tested it on Windows and MacOS.
The best I can get is by using go-serial's USBManufacturer, I can get 'Arduino (www.arduino.cc)'.
I also found this post, about the same question, but without any solution.