summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2013-10-11 01:51:40 +0000
committercliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2013-10-11 01:51:40 +0000
commit5746be32b9926bb4455ee4152c85084fd0942611 (patch)
tree4622044f3a65a73540349de76e119985c978a3b4
parent4b83d667a069acf2a3f644018f779ee908e7bae8 (diff)
downloadpyserial-git-5746be32b9926bb4455ee4152c85084fd0942611.tar.gz
[Bug pyserial:125] Undefined 'base' on list_ports_posix.py, function usb_lsusb
-rw-r--r--pyserial/CHANGES.txt1
-rw-r--r--pyserial/serial/tools/list_ports_posix.py5
2 files changed, 4 insertions, 2 deletions
diff --git a/pyserial/CHANGES.txt b/pyserial/CHANGES.txt
index 5878280..4945c15 100644
--- a/pyserial/CHANGES.txt
+++ b/pyserial/CHANGES.txt
@@ -458,6 +458,7 @@ Bugfixes (posix):
- [Bug 3518380] python3.2 -m serial.tools.list_ports error
- [Bug pyserial:137] Patch to add non-standard baudrates to Cygwin
- [Bug pyserial:141] open: Pass errno from IOError to SerialException
+- [Bug pyserial:125] Undefined 'base' on list_ports_posix.py, function usb_lsusb
Bugfixes (win32):
diff --git a/pyserial/serial/tools/list_ports_posix.py b/pyserial/serial/tools/list_ports_posix.py
index 974c037..3e2da72 100644
--- a/pyserial/serial/tools/list_ports_posix.py
+++ b/pyserial/serial/tools/list_ports_posix.py
@@ -68,9 +68,10 @@ if plat[:5] == 'linux': # Linux (confirmed)
)
def usb_lsusb_string(sysfs_path):
- base = os.path.basename(os.path.realpath(sysfs_path))
- bus, dev = base.split('-')
+ base = os.path.basename(os.path.realpath(sysfs_path))
+ bus = base.split('-')[0]
try:
+ dev = int(open(os.path.join(sysfs_path, 'devnum')).readline().strip())
desc = popen(['lsusb', '-v', '-s', '%s:%s' % (bus, dev)])
# descriptions from device
iManufacturer = re_group('iManufacturer\s+\w+ (.+)', desc)