diff --git a/README.md b/README.md index d6e324e..f8850d5 100644 --- a/README.md +++ b/README.md @@ -334,7 +334,7 @@ lrwxrwxrwx root 10 Dec 3 09:10 wwn-0x5000cca30ccffb77-part5 -> ../../sda5 ***Note:*** ```mbed-ls``` tools pair only serial ports and mount points (not CMSIS-DAP - yet). -We can see that on our host machine (running Ubuntu) there are many 'disk type' devices visible under ```/dev/disk```. The mbed boards can be distinguished and filtered by their unique ```USB-ID``` conventions. In our case, we can see pairs of ```usb-ids``` in both ```/dev/serial/usb-id``` and ```/dev/disk/usb-id``` with embedded ``` TargetID```. ```TargetID``` can be filtered out, for example using this sudo-regexpr: ```(“MBED”|”mbed”|”STMicro”)_([a-zA-z_-]+)_([a-fA_F0-0]){4,}``` +We can see that on our host machine (running Ubuntu) there are many 'disk type' devices visible under ```/dev/disk```. The mbed boards can be distinguished and filtered by their unique ```USB-ID``` conventions. In our case, we can see pairs of ```usb-ids``` in both ```/dev/serial/usb-id``` and ```/dev/disk/usb-id``` with embedded ``` TargetID```. ```TargetID``` can be filtered out, for example using this sudo-regexpr: ```(“MBED”|”mbed”|”STMicro”)_([a-zA-z_-]+)_([a-zA-Z0-9]){4,}``` For example, we can match the board 066EFF525257775087141721 by connecting a few dots: diff --git a/mbed_lstools/lstools_linux_generic.py b/mbed_lstools/lstools_linux_generic.py index 4877075..919c4ea 100644 --- a/mbed_lstools/lstools_linux_generic.py +++ b/mbed_lstools/lstools_linux_generic.py @@ -88,10 +88,10 @@ def list_mbeds(self): self.ERRORLEVEL_FLAG = 0 result = [] - tidhex = re.compile(r'_([0-9a-fA-F]+)-\d+:\d+') + tidpattern = re.compile(r'_([0-9a-zA-Z]+)-\d+:\d+') for device in all_devices: tid = None - m = tidhex.search(device[4]) + m = tidpattern.search(device[4]) if m and len(m.groups()): tid = m.group(1) mbed = {'mount_point' : device[2], diff --git a/mbed_lstools/lstools_win7.py b/mbed_lstools/lstools_win7.py index 7a66b4c..0a95bd7 100644 --- a/mbed_lstools/lstools_win7.py +++ b/mbed_lstools/lstools_win7.py @@ -161,7 +161,7 @@ def get_mbeds(self): for mbed in self.get_mbed_devices(): mountpoint = re.match('.*\\\\(.:)$', mbed[0]).group(1) # TargetID is a hex string with 10-48 chars - tid = re.search('[0-9A-Fa-f]{10,48}', mbed[1]).group(0) + tid = re.search('[0-9A-Za-z]{10,48}', mbed[1]).group(0) mbeds += [(mountpoint, tid)] self.debug(self.get_mbeds.__name__, (mountpoint, tid)) return mbeds