This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 39ee8d5  [µTVM] Avoid listing links when probing serial ports (#7265)
39ee8d5 is described below

commit 39ee8d59ce75804e425db0faa53987d0a12f33bb
Author: Gustavo Romero <[email protected]>
AuthorDate: Wed Jan 13 11:01:56 2021 -0300

    [µTVM] Avoid listing links when probing serial ports (#7265)
    
    SerialTransport.open() probes automatically the device name based upon a
    grep regex if a device name is not provided. The code expects to find only
    a single device. Currently when it probes for the available serial ports it
    includes in the list the device names that are also symbolic links.
    
    Since _find_openocd_serial_port() always returns a serial number for a
    given serial port (not the device name path) the available device names
    are always probed when the openocd flash runner is used.
    
    It's not uncommon that device drivers create symbolic links for certain
    kinds of serial devices, specially those that provide a serial port plus
    an additional endpoint to program the device attached, like a ST-Link
    interface, etc.
    
    As a consequence the current code fails to select the correct device name
    when symbolic links exist and the openocd flash runner is used.
    
    That commit changes the probe behavior to avoid listing symbolic links when
    probing the device name for the target serial port.
    
    Signed-off-by: Gustavo Romero <[email protected]>
---
 python/tvm/micro/transport/serial.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/tvm/micro/transport/serial.py 
b/python/tvm/micro/transport/serial.py
index 6640bb5..b72dee1 100644
--- a/python/tvm/micro/transport/serial.py
+++ b/python/tvm/micro/transport/serial.py
@@ -67,7 +67,7 @@ class SerialTransport(Transport):
         if self._port_path is not None:
             port_path = self._port_path
         else:
-            ports = list(serial.tools.list_ports.grep(self._grep, 
include_links=True))
+            ports = list(serial.tools.list_ports.grep(self._grep))
             if len(ports) != 1:
                 raise SerialPortNotFoundError(
                     f"grep expression should find 1 serial port; found 
{ports!r}"

Reply via email to