Skip to content

Commit 198fcc4

Browse files
authored
Merge pull request #43 from mvolstad/serialnumber_regex_fix
Serialnumber regex fix
2 parents a07f517 + 90abb9f commit 198fcc4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ lrwxrwxrwx root 10 Dec 3 09:10 wwn-0x5000cca30ccffb77-part5 -> ../../sda5
334334

335335
***Note:*** ```mbed-ls``` tools pair only serial ports and mount points (not CMSIS-DAP - yet).
336336

337-
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,}```
337+
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,}```
338338

339339
For example, we can match the board 066EFF525257775087141721 by connecting a few dots:
340340

mbed_lstools/lstools_linux_generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ def list_mbeds(self):
8888
self.ERRORLEVEL_FLAG = 0
8989

9090
result = []
91-
tidhex = re.compile(r'_([0-9a-fA-F]+)-\d+:\d+')
91+
tidpattern = re.compile(r'_([0-9a-zA-Z]+)-\d+:\d+')
9292
for device in all_devices:
9393
tid = None
94-
m = tidhex.search(device[4])
94+
m = tidpattern.search(device[4])
9595
if m and len(m.groups()):
9696
tid = m.group(1)
9797
mbed = {'mount_point' : device[2],

mbed_lstools/lstools_win7.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def get_mbeds(self):
161161
for mbed in self.get_mbed_devices():
162162
mountpoint = re.match('.*\\\\(.:)$', mbed[0]).group(1)
163163
# TargetID is a hex string with 10-48 chars
164-
tid = re.search('[0-9A-Fa-f]{10,48}', mbed[1]).group(0)
164+
tid = re.search('[0-9A-Za-z]{10,48}', mbed[1]).group(0)
165165
mbeds += [(mountpoint, tid)]
166166
self.debug(self.get_mbeds.__name__, (mountpoint, tid))
167167
return mbeds

0 commit comments

Comments
 (0)