Improved autoinstaller
parent
03e9b92237
commit
abab428842
|
@ -829,38 +829,56 @@ def main():
|
||||||
global squashvw
|
global squashvw
|
||||||
squashvw = True
|
squashvw = True
|
||||||
|
|
||||||
ports = list_ports.comports()
|
|
||||||
portlist = []
|
|
||||||
for port in ports:
|
|
||||||
portlist.insert(0, port)
|
|
||||||
|
|
||||||
pi = 1
|
|
||||||
print("Detected serial ports:")
|
|
||||||
for port in portlist:
|
|
||||||
print(" ["+str(pi)+"] "+str(port.device)+" ("+str(port.product)+", "+str(port.serial_number)+")")
|
|
||||||
pi += 1
|
|
||||||
|
|
||||||
print("\nWhat serial port is your device connected to? ", end="")
|
|
||||||
selected_port = None
|
selected_port = None
|
||||||
try:
|
if not args.port:
|
||||||
c_port = int(input())
|
ports = list_ports.comports()
|
||||||
if c_port < 1 or c_port > len(ports):
|
portlist = []
|
||||||
raise ValueError()
|
for port in ports:
|
||||||
|
portlist.insert(0, port)
|
||||||
|
|
||||||
selected_port = portlist[c_port-1]
|
pi = 1
|
||||||
except Exception as e:
|
print("Detected serial ports:")
|
||||||
print("That port does not exist, exiting now.")
|
for port in portlist:
|
||||||
exit()
|
print(" ["+str(pi)+"] "+str(port.device)+" ("+str(port.product)+", "+str(port.serial_number)+")")
|
||||||
|
pi += 1
|
||||||
|
|
||||||
if selected_port == None:
|
print("\nWhat serial port is your device connected to? ", end="")
|
||||||
print("Could not select port, exiting now.")
|
try:
|
||||||
exit()
|
c_port = int(input())
|
||||||
|
if c_port < 1 or c_port > len(ports):
|
||||||
|
raise ValueError()
|
||||||
|
|
||||||
port_path = selected_port.device
|
selected_port = portlist[c_port-1]
|
||||||
port_product = selected_port.product
|
except Exception as e:
|
||||||
port_serialno = selected_port.serial_number
|
print("That port does not exist, exiting now.")
|
||||||
|
exit()
|
||||||
|
|
||||||
print("\nOk, using device on "+str(port_path)+" ("+str(port_product)+", "+str(port_serialno)+")")
|
if selected_port == None:
|
||||||
|
print("Could not select port, exiting now.")
|
||||||
|
exit()
|
||||||
|
|
||||||
|
port_path = selected_port.device
|
||||||
|
port_product = selected_port.product
|
||||||
|
port_serialno = selected_port.serial_number
|
||||||
|
|
||||||
|
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...")
|
||||||
|
|
||||||
|
@ -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.")
|
||||||
|
|
Loading…
Reference in New Issue