From 0eb13de9799897a80f3fb91bef32a5c631c05bb4 Mon Sep 17 00:00:00 2001 From: cliechti Date: Thu, 31 Jul 2014 23:32:06 +0000 Subject: [Patch pyserial:32] Module list_ports for linux should include the product information as description. git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@498 f19166aa-fa4f-0410-85c2-fa1106f25c8a --- CHANGES.txt | 1 + serial/tools/list_ports_linux.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index c162253..5741b40 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -480,6 +480,7 @@ Version 2.8 2014-xx-xx --------------------------- - [FTR pyserial:37] Support fileno() function in the socket protocol - Posix: [Patch pyserial:31] Mark/space parity on Linux +- Linux: [Patch pyserial:32] Module list_ports for linux should include the product information as description. Bugfixes: diff --git a/serial/tools/list_ports_linux.py b/serial/tools/list_ports_linux.py index 0a23e09..d3fa0e4 100644 --- a/serial/tools/list_ports_linux.py +++ b/serial/tools/list_ports_linux.py @@ -110,6 +110,12 @@ def describe(device): sys_dev_path = '/sys/class/tty/%s/device/interface' % (base,) if os.path.exists(sys_dev_path): return read_line(sys_dev_path) + # USB Product Information + sys_dev_path = '/sys/class/tty/%s/device' % (base,) + if os.path.exists(sys_dev_path): + product_name_file = os.path.dirname(os.path.realpath(sys_dev_path)) + "/product" + if os.path.exists(product_name_file): + return read_line(product_name_file) return base def hwinfo(device): -- cgit v1.2.1