✨ Add hook to extend serial port names

This commit is contained in:
Gina Häußge committed 2020-06-04 18:58:09 +02:00
1 parent 488a75737c
commit 2206b84f3e
2 files changed
+26

No files matched your search

+7
View File
@@ -188,6 +188,13 @@ def serialList():
for additional in additionalPorts:
candidates += glob.glob(additional)
hooks = octoprint.plugin.plugin_manager().get_hooks("octoprint.comm.transport.serial.additional_port_names")
for name, hook in hooks.items():
try:
candidates += hook(candidates)
except Exception:
logging.getLogger(__name__).exception("Error while retrieving additional "
"serial port names from hook {}".format(name))
# special treatment for virtual printer
# TODO: Move that exclusively into the plugin