Skip to content

Commit

Permalink
fix(api): OT-2 attempting to connect modules via temporary ports (#15134
Browse files Browse the repository at this point in the history
)

Closes AUTH-379

# Overview

#14345 updated the module ports filtering to exclude any temporary ports
created by udev. But the regex used for port name matching filters out
only Flex port names (e.g. `ot_module_thermocycler2.tmp-c166:2`). This
PR adds regex to filter out OT-2 temp ports as well (e.g.
`.#ot_module_thermocycler0b494617b5e4f08ae`).

# Risk assessment

Medium. Can affect module connectivity but is easy to test and rule out
any issues.
  • Loading branch information
sanni-t authored May 8, 2024
1 parent 31a0f3e commit 2011402
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/src/opentrons/hardware_control/module_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
log = logging.getLogger(__name__)

MODULE_PORT_REGEX = re.compile(
# add a negative lookbehind to suppress matches on OT-2 tempfiles udev creates
r"(?<!\.#ot_module_)"
# capture all modules by name using alternation
"(" + "|".join(modules.MODULE_TYPE_BY_NAME.keys()) + ")"
# add a negative lookahead to suppress matches on tempfiles udev creates
+ "(" + "|".join(modules.MODULE_TYPE_BY_NAME.keys()) + ")"
# add a negative lookahead to suppress matches on Flex tempfiles udev creates
+ r"\d+(?!\.tmp-c\d+:\d+)",
re.I,
)
Expand Down

0 comments on commit 2011402

Please sign in to comment.