@@ -25,7 +25,7 @@ class MbedLsToolsLinuxGeneric(MbedLsToolsBase):
2525 """ MbedLsToolsLinuxGeneric supports mbed-enabled platforms detection across Linux family
2626 """
2727 def __init__ (self ):
28- """ ctor
28+ """! ctor
2929 """
3030 MbedLsToolsBase .__init__ (self )
3131 self .os_supported .append ('LinuxGeneric' )
@@ -35,11 +35,8 @@ def __init__(self):
3535
3636 def list_mbeds (self ):
3737 """! Returns detailed list of connected mbeds
38-
3938 @return Returns list of structures with detailed info about each mbed
40-
4139 @details Function returns list of dictionaries with mbed attributes such as mount point, TargetID name etc.
42-
4340 Function returns mbed list with platform names if possible
4441 all_devices =
4542 [
@@ -122,9 +119,7 @@ def list_mbeds(self):
122119
123120 def get_dev_by_id (self , subdir ):
124121 """! Lists disk devices by id
125-
126122 @return List of strings from 'ls' command executed in shell
127-
128123 @details Uses Linux shell command: 'ls -oA /dev/disk/by-id/'
129124 """
130125 result = []
@@ -143,9 +138,7 @@ def get_dev_by_id(self, subdir):
143138
144139 def get_mounts (self ):
145140 """! Lists mounted devices with vfat file system (potential mbeds)
146-
147141 @result Returns list of all mounted vfat devices
148-
149142 @details Uses Linux shell command: 'mount | grep vfat'
150143 """
151144 result = []
@@ -164,11 +157,8 @@ def get_mounts(self):
164157
165158 def get_disk_hex_ids (self , disk_list ):
166159 """! Get only hexadecimal IDs for mbed disks
167-
168160 @param disk_list List of disks in a system with USBID decoration
169-
170161 @return Returns map of disks and corresponding disks' Hex ids
171-
172162 @details Uses regular expressions to get Hex strings (TargeTIDs) from list of disks
173163 """
174164 nlp = re .compile (self .name_link_pattern )
@@ -185,12 +175,9 @@ def get_disk_hex_ids(self, disk_list):
185175
186176 def get_mbed_serial (self , serial_list , dhi ):
187177 """! Get mbed serial by unique hex id (dhi) in disk name
188-
189- @return Returns None if corresponding serial device is not found, else returns serial device path
190-
191178 @param serial_list List of all serial ports
192179 @param dhi Unique Hex id of possible mbed device
193-
180+ @return Returns None if corresponding serial device is not found, else returns serial device path
194181 @details Devices are located in Linux '/dev/' directory structure
195182 """
196183 nlp = re .compile (self .name_link_pattern )
@@ -205,14 +192,11 @@ def get_mbed_serial(self, serial_list, dhi):
205192
206193 def get_detected (self , tids , disk_list , serial_list , mount_list ):
207194 """! Find all known mbed devices and assign name by targetID
208-
209- @return list of lists [mbed_name, mbed_dev_disk, mbed_mount_point, mbed_dev_serial, disk_hex_id]
210-
211195 @param tids TargetID comprehensive list for detection (manufacturers_ids)
212196 @param disk_list List of disks (mount points in /dev/disk)
213197 @param serial_list List of serial devices (serial ports in /dev/serial)
214198 @param mount_list List of lines from 'mount' command
215-
199+ @return list of lists [mbed_name, mbed_dev_disk, mbed_mount_point, mbed_dev_serial, disk_hex_id]
216200 @details Find for all disk connected all MBED ones we know about from TID list
217201 """
218202 # Find for all disk connected all MBED ones we know about from TID list
@@ -241,14 +225,11 @@ def get_detected(self, tids, disk_list, serial_list, mount_list):
241225
242226 def get_not_detected (self , tids , disk_list , serial_list , mount_list ):
243227 """! Find all unknown mbed-enabled devices (may have 'mbed' string in USBID name)
244-
245- @return list of lists [mbed_name, mbed_dev_disk, mbed_mount_point, mbed_dev_serial, disk_hex_id]
246-
247228 @param tids TargetID comprehensive list for detection (manufacturers_ids)
248229 @param disk_list List of disks (mount points in /dev/disk)
249230 @param serial_list List of serial devices (serial ports in /dev/serial)
250231 @param mount_list List of lines from 'mount' command
251-
232+ @return list of lists [mbed_name, mbed_dev_disk, mbed_mount_point, mbed_dev_serial, disk_hex_id]
252233 @details Find for all disk connected all MBED ones we know about from TID list
253234 """
254235 map_tid_to_mbed = self .get_tid_mbed_name_remap (tids )
@@ -279,12 +260,12 @@ def get_not_detected(self, tids, disk_list, serial_list, mount_list):
279260 return result
280261
281262 def get_tid_mbed_name_remap (self , tids ):
282- """ Remap to get mapping: ID -> mbed name
263+ """! Remap to get mapping: ID -> mbed name
283264 """
284265 return tids
285266
286267 def get_dev_name (self , link ):
287- """ Get device name from symbolic link list
268+ """! Get device name from symbolic link list
288269 """
289270 device_sufix_pattern = ".*/([a-zA-Z0-9]*)$"
290271 dsp = re .compile (device_sufix_pattern )
@@ -293,16 +274,16 @@ def get_dev_name(self, link):
293274 return mbed_dev
294275
295276 def get_mount_point (self , dev_name , mount_list ):
296- """ Find mount points for MBED devices using mount command output
297-
298- @return Returns None if mount point not found. Else returns device mount path
299-
277+ """! Find mount points for MBED devices using mount command output
300278 @param dev_name Device name (e.g 'sda')
301279 @param mount_list List of all mounted devices (strings from Linux mount shell command)
302-
303- @details
280+ @return Returns None if mount point not found. Else returns device mount path
281+ @details We want to scan names of mount points like this:
282+ /media/MBED_xxx
283+ /media/MBED__xxx
284+ /media/MBED-xxx
304285 """
305- mount_media_pattern = "^/[a-zA-Z0-9/]*/" + dev_name + " on (/[a-zA-Z0-9 /]*) "
286+ mount_media_pattern = "^/[a-zA-Z0-9/]*/" + dev_name + " on (/[a-zA-Z0-9_\- /]*) "
306287 mmp = re .compile (mount_media_pattern )
307288 for mount in mount_list :
308289 m = mmp .search (mount )
0 commit comments