Improved autoinstaller

pull/8/head
Mark Qvist 2022-01-12 23:06:53 +01:00
parent 03e9b92237
commit abab428842
1 changed files with 49 additions and 28 deletions

View File

@ -829,6 +829,8 @@ def main():
global squashvw global squashvw
squashvw = True squashvw = True
selected_port = None
if not args.port:
ports = list_ports.comports() ports = list_ports.comports()
portlist = [] portlist = []
for port in ports: for port in ports:
@ -841,7 +843,6 @@ def main():
pi += 1 pi += 1
print("\nWhat serial port is your device connected to? ", end="") print("\nWhat serial port is your device connected to? ", end="")
selected_port = None
try: try:
c_port = int(input()) c_port = int(input())
if c_port < 1 or c_port > len(ports): if c_port < 1 or c_port > len(ports):
@ -862,6 +863,23 @@ def main():
print("\nOk, using device on "+str(port_path)+" ("+str(port_product)+", "+str(port_serialno)+")") print("\nOk, using device on "+str(port_path)+" ("+str(port_product)+", "+str(port_serialno)+")")
else:
ports = list_ports.comports()
for port in ports:
if port.device == args.port:
selected_port = port
if selected_port == None:
print("Could not find specified port "+str(args.port)+", exiting now")
exit()
port_path = selected_port.device
port_product = selected_port.product
port_serialno = selected_port.serial_number
print("\nUsing device on "+str(port_path))
print("\nProbing device...") print("\nProbing device...")
try: try:
@ -915,11 +933,14 @@ def main():
selected_product = ROM.PRODUCT_HMBRW selected_product = ROM.PRODUCT_HMBRW
elif c_dev == 3: elif c_dev == 3:
selected_product = ROM.PRODUCT_TBEAM selected_product = ROM.PRODUCT_TBEAM
print("\nImportant! Using RNode firmware on T-Beam devices should currently be") print("")
print("---------------------------------------------------------------------------")
print("Important! Using RNode firmware on T-Beam devices should currently be")
print("considered experimental. It is not intended for production or critical use.") print("considered experimental. It is not intended for production or critical use.")
print("The currently supplied firmware is provided AS-IS as a courtesey to those") print("The currently supplied firmware is provided AS-IS as a courtesey to those")
print("who would like to experiment with it. If you want any degree of reliability,") print("who would like to experiment with it. If you want any degree of reliability,")
print("please use an actual RNode from unsigned.io. Hit enter to continue.") print("please use an actual RNode from unsigned.io. Hit enter to continue.")
print("---------------------------------------------------------------------------")
input() input()
except Exception as e: except Exception as e:
print("That device type does not exist, exiting now.") print("That device type does not exist, exiting now.")