From f5590a98ed651d3121b7d9f5e8c2bec548d86e10 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 30 Mar 2017 21:35:26 +0200 Subject: [PATCH] Added missing close for USB programmer. Thanks to legoabram for the fix --- plugins/USBPrinting/USBPrinterOutputDevice.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index a519e05f53..a28bf06b77 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -202,6 +202,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice): try: programmer.connect(self._serial_port) except Exception: + programmer.close() pass # Give programmer some time to connect. Might need more in some cases, but this worked in all tested cases. @@ -312,8 +313,10 @@ class USBPrinterOutputDevice(PrinterOutputDevice): programmer.connect(self._serial_port) # Connect with the serial, if this succeeds, it's an arduino based usb device. self._serial = programmer.leaveISP() except ispBase.IspError as e: + programmer.close() Logger.log("i", "Could not establish connection on %s: %s. Device is not arduino based." %(self._serial_port,str(e))) except Exception as e: + programmer.close() Logger.log("i", "Could not establish connection on %s, unknown reasons. Device is not arduino based." % self._serial_port) # If the programmer connected, we know its an atmega based version.