I have an idea, if we could scan all the port in pc to find the possible modem port, and test all of it, then add it to the config automatically. After the first initialization, if there are any port changes, it could update the data automatically based on the imei, and auto disabling the port if imei doesn't found on second scan attempt.
And maybe this is as all of us want, complete API documentation, for this tool.
Below is my example snippet, for scanning possibly modem port, maybe it could help :
def find_all_port():
all_port_tuples = list(list_ports.comports())
all_ports = []
for port in all_port_tuples:
if port.device.startswith("COM") or port.device.startswith("ttyACM") or "ttyUSB" in port.device:
all_ports.append({"portLoc": port.device, "status": ""})
if len(all_ports) == 0:
logging.error("No valid port detected!. Possibly, device not plugged/detected.")
pass
return all_ports
```