Tools: allow uploader.py to detect ttyS* on Ubuntu on Windows (WSL)
This commit is contained in:
parent
e4b3ad377d
commit
d47663c0ba
@ -64,9 +64,12 @@ import base64
|
||||
import time
|
||||
import array
|
||||
import os
|
||||
import platform
|
||||
|
||||
from sys import platform as _platform
|
||||
|
||||
is_WSL = bool("Microsoft" in platform.uname()[2])
|
||||
|
||||
# default list of port names to look for autopilots
|
||||
default_ports = [ '/dev/serial/by-id/usb-Ardu*',
|
||||
'/dev/serial/by-id/usb-3D*',
|
||||
@ -78,7 +81,7 @@ default_ports = [ '/dev/serial/by-id/usb-Ardu*',
|
||||
'/dev/serial/by-id/usb-Holybro*',
|
||||
'/dev/tty.usbmodem*']
|
||||
|
||||
if "cygwin" in _platform:
|
||||
if "cygwin" in _platform or is_WSL:
|
||||
default_ports += [ '/dev/ttyS*' ]
|
||||
|
||||
# Detect python version
|
||||
@ -771,8 +774,9 @@ def main():
|
||||
args.source_component)
|
||||
|
||||
except Exception as e:
|
||||
if not is_WSL:
|
||||
# open failed, WSL must cycle through all ttyS* ports quickly but rate limit everything else
|
||||
print("Exception creating uploader: %s" % str(e))
|
||||
# open failed, rate-limit our attempts
|
||||
time.sleep(0.05)
|
||||
|
||||
# and loop to the next port
|
||||
|
Loading…
Reference in New Issue
Block a user