Skip to content

Commit

Permalink
allow None in port hardware ids
Browse files Browse the repository at this point in the history
  • Loading branch information
HotNoob committed Sep 18, 2024
1 parent 3777a1d commit 2604c43
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions defs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def find_usb_serial_port(port : str = '', vendor_id : str = '', product_id : st
if not port.startswith('['):
return port

port = port.replace('None', '')

match = re.match(r"\[(?P<vendor>[\da-zA-Z]+|):?(?P<product>[\da-zA-Z]+|):?(?P<serial>[\da-zA-Z]+|):?(?P<location>[\d\-]+|)\]", port)
if match:
vendor_id = int(match.group("vendor"), 16) if match.group("vendor") else ''
Expand Down

0 comments on commit 2604c43

Please sign in to comment.