fix: ignore ttyAMA0 serial interface

This commit is contained in:
Uwe Hennig 2023-01-24 17:52:23 +01:00
parent 52caa7aa22
commit 0a2bddae9f

View file

@ -15,8 +15,11 @@ class hardwareInterface():
ports = [] ports = []
self.addToTrace('Available serial ports:') self.addToTrace('Available serial ports:')
for n, (port, desc, hwid) in enumerate(sorted(comports()), 1): for n, (port, desc, hwid) in enumerate(sorted(comports()), 1):
self.addToTrace('{:2}: {:20} {!r}'.format(n, port, desc)) if (port=="/dev/ttyAMA0"):
ports.append(port) self.addToTrace("ignoring /dev/ttyAMA0, because this is not an USB serial port")
else:
self.addToTrace('{:2}: {:20} {!r}'.format(n, port, desc))
ports.append(port)
if (len(ports)<1): if (len(ports)<1):
self.addToTrace("ERROR: No serial ports found. No hardware interaction possible.") self.addToTrace("ERROR: No serial ports found. No hardware interaction possible.")
self.ser = None self.ser = None
@ -174,4 +177,4 @@ if __name__ == "__main__":
hw.setRelay2Off() hw.setRelay2Off()
sleep(0.03) sleep(0.03)
hw.close() hw.close()
print("finished.") print("finished.")