Skip to content

Commit 07597b3

Browse files
committed
Fixing USB device detection based on sysfs usb paths
1 parent e85a085 commit 07597b3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mbed_lstools/linux.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self, **kwargs):
4747
r'(pci|usb)-[0-9a-zA-Z_-]*_(?P<usbid>[0-9a-zA-Z]*)-.*$')
4848
self.mmp = re.compile(
4949
r'(?P<dev>(/[^/ ]*)+) on (?P<dir>(/[^/ ]*)+) ')
50-
self.udp = re.compile(r'[0-9]+-[0-9]+')
50+
self.udp = re.compile(r'^[0-9]+-[0-9]+[^:\s]*$')
5151

5252
def find_candidates(self):
5353
disk_ids = self._dev_by_id('disk')
@@ -126,7 +126,6 @@ def _sysfs_block_devices(self, block_devices):
126126
for index, part in enumerate(path_parts):
127127
if self.udp.search(part):
128128
end_index = index
129-
break
130129

131130
if end_index == None:
132131
logger.debug('Did not find suitable usb folder for usb info: %s', full_sysfs_path)

0 commit comments

Comments
 (0)