I work with a significant amount of Arduinos (about 2000 a batch), and they all need firmware loaded on them via usb. I've already written programs to speed up this process, but I can't find a way to stop the program from rewriting the firmware to the Arduino Leonardo, because the only identifier seems to be the com port number. To work around this I've pressed a key every time I plug in new Arduinos but this is slow. I want to keep the program in a loop so I don't need to press a key every time or re run the program. If I get this to work then I can just plug in as many as possible and keep switching them out when they're done uploading, because my program can already upload to multiple devices.
I've already learned of avrdude's -U parameter which allows a programmer to read or verify the device's files which could potentially work to check for loaded files, but it requires bootloading the Leonardo, which defeats the purpose at least in terms of efficiency (takes .5 seconds for the Leonardo to go into bootloader mode). I've also thought of connecting to the devices with the firmware through its package, but the timeout for devices that don't have the firmware loaded yet is around 5 seconds.
Is there anyway to check for previously loaded firmware on a Arduino Leonardo, without the use of the bootloader? Any help would be greatly appreciated.
(Just for your information, I'm writing this program in Python using the Pyserial and Subprocess packages)