error handling for untimley removal of key

This commit is contained in:
Eggman20339 2024-05-05 20:14:22 -04:00
parent 43846ab6db
commit ee9d3a7a58

22
main.py
View File

@ -72,19 +72,21 @@ while True:
# GPIO.output(14, GPIO.LOW) # GPIO.output(14, GPIO.LOW)
print("Waiting for device...") print("Waiting for device...")
while True: while True:
# GPIO.output(14, GPIO.LOW) try:
dev = next(CtapHidDevice.list_devices(), None) # GPIO.output(14, GPIO.LOW)
dev = next(CtapHidDevice.list_devices(), None)
if dev: if dev:
ctap2 = Ctap2(dev) ctap2 = Ctap2(dev)
info = ctap2.get_info() info = ctap2.get_info()
gotAaguid = info.aaguid gotAaguid = info.aaguid
print(str(gotAaguid)) print(str(gotAaguid))
break break
time.sleep(0.1)
time.sleep(0.1)
except Exception as e:
print(e)
# Handle user interaction # Handle user interaction
try: try: