From 207253abc6ec81112abf0a64a8bf68e227528d64 Mon Sep 17 00:00:00 2001 From: Simon John Date: Tue, 4 Aug 2020 23:19:49 +0100 Subject: Rebased python3 branch with some changes from tuna-f1sh@87d5241 --- bin/ard-reset-arduino | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'bin/ard-reset-arduino') diff --git a/bin/ard-reset-arduino b/bin/ard-reset-arduino index d6f974f..f03bf66 100755 --- a/bin/ard-reset-arduino +++ b/bin/ard-reset-arduino @@ -1,18 +1,11 @@ #!/usr/bin/env python -from __future__ import print_function import serial import serial.tools.list_ports import os.path import argparse from time import sleep -pyserial_version = None -try: - pyserial_version = int(serial.VERSION[0]) -except: - pyserial_version = 2 # less than 2.3 - parser = argparse.ArgumentParser(description='Reset an Arduino') parser.add_argument('--zero', action='store_true', help='Reset Arduino Zero or similar Native USB to enter bootloader') parser.add_argument('--caterina', action='store_true', help='Reset a Leonardo, Micro, Robot or LilyPadUSB.') @@ -65,11 +58,7 @@ if args.zero: ser = serial.Serial(args.port[0], 57600) ser.close() - - if pyserial_version < 3: - ser.setBaudrate(1200) - else: - ser.baudrate = 1200 + ser.baudrate = 1200 # do the open/close at 1200 BAUD ser.open() -- cgit v1.2.3 From dff6492a4b07b4db53da23d7159c81697d12b47e Mon Sep 17 00:00:00 2001 From: Simon John Date: Tue, 4 Aug 2020 23:28:36 +0100 Subject: Fixed SyntaxWarning: "is" vs "==" --- bin/ard-reset-arduino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/ard-reset-arduino') diff --git a/bin/ard-reset-arduino b/bin/ard-reset-arduino index f03bf66..51b4577 100755 --- a/bin/ard-reset-arduino +++ b/bin/ard-reset-arduino @@ -89,7 +89,7 @@ if args.zero: # check if a new port has attached and return the index if it has port_index = new_port(initial_ports, reset_ports) # return the new port if detected, otherwise return passed port - if port_index is -1: + if port_index == -1: bootloader_port = args.port[0] else: bootloader_port = reset_ports[port_index] -- cgit v1.2.3 From 5f5a68aa315e691f2eec64dcb749558c1132fac5 Mon Sep 17 00:00:00 2001 From: Simon John Date: Tue, 4 Aug 2020 23:49:32 +0100 Subject: Replaced env with python3 shebang --- bin/ard-reset-arduino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/ard-reset-arduino') diff --git a/bin/ard-reset-arduino b/bin/ard-reset-arduino index 51b4577..69a442e 100755 --- a/bin/ard-reset-arduino +++ b/bin/ard-reset-arduino @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3 import serial import serial.tools.list_ports -- cgit v1.2.3