mirror of https://github.com/ARMmbed/mbed-os.git
Removed get_mounted_details_txt from test_api.py
Fixed minor typos in test_api.py Added get_interface_version to detect_targetspull/5077/head
parent
7ff57c4671
commit
e4b55dd6a0
|
@ -31,9 +31,13 @@ check_required_modules(['prettytable'])
|
|||
# Imports related to mbed build api
|
||||
from tools.build_api import mcu_toolchain_matrix
|
||||
from tools.test_api import get_autodetected_MUTS_list
|
||||
from tools.test_api import get_mounted_details_txt
|
||||
from tools.test_api import get_module_avail
|
||||
from argparse import ArgumentParser
|
||||
|
||||
try:
|
||||
import mbed_lstools
|
||||
except:
|
||||
pass
|
||||
|
||||
def main():
|
||||
"""Entry Point"""
|
||||
|
@ -76,17 +80,17 @@ def main():
|
|||
count = 0
|
||||
for mut in muts.values():
|
||||
if re.match(mcu_filter, mut['mcu']):
|
||||
# Grab additional target details about the mut
|
||||
details_txt = get_mounted_details_txt(mut['disk'])
|
||||
interface_version = get_interface_version(mut['disk'])
|
||||
print ""
|
||||
print "[mbed] Detected %s, port %s, mounted %s, interface version %s" % \
|
||||
(mut['mcu'], mut['port'], mut['disk'], details_txt['Interface Version'])
|
||||
print "[mbed] Detected %s, port %s, mounted %s, interface version %s:" % \
|
||||
(mut['mcu'], mut['port'], mut['disk'], interface_version)
|
||||
|
||||
print "[mbed] Supported toolchains for %s" % mut['mcu']
|
||||
print mcu_toolchain_matrix(platform_filter=mut['mcu'])
|
||||
count += 1
|
||||
|
||||
if count == 0:
|
||||
print "[mbed] No mbed targets where detected on your system."
|
||||
print "[mbed] No mbed targets were detected on your system."
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print "\n[CTRL+c] exit"
|
||||
|
@ -96,5 +100,22 @@ def main():
|
|||
print "[ERROR] %s" % str(exc)
|
||||
sys.exit(1)
|
||||
|
||||
def get_interface_version(mount_point):
|
||||
""" Function returns interface version from the target mounted on the specified mount point
|
||||
mount_point = mut['port']
|
||||
@param mount_point Name of disk where platform is connected to host machine.
|
||||
"""
|
||||
if get_module_avail('mbed_lstools'):
|
||||
mbeds = mbed_lstools.create()
|
||||
details_txt = mbeds.get_details_txt(mount_point)
|
||||
|
||||
if 'Interface Version' in details_txt:
|
||||
return details_txt['Interface Version']
|
||||
|
||||
elif 'Version' in details_txt:
|
||||
return details_txt['Version']
|
||||
|
||||
return 'unknown'
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -1643,17 +1643,10 @@ def detect_database_verbose(db_url):
|
|||
|
||||
|
||||
def get_module_avail(module_name):
|
||||
""" This function returns True if module_name is already impored module
|
||||
""" This function returns True if module_name is already imported module
|
||||
"""
|
||||
return module_name in sys.modules.keys()
|
||||
|
||||
def get_mounted_details_txt(mount_point):
|
||||
""" Function returns object containing details.txt information from the specified mount point
|
||||
@param mount_point Name of disk where platform is connected to host machine.
|
||||
"""
|
||||
mbeds = mbed_lstools.create()
|
||||
return mbeds.get_details_txt(mount_point)
|
||||
|
||||
def get_autodetected_MUTS_list(platform_name_filter=None):
|
||||
oldError = None
|
||||
if os.name == 'nt':
|
||||
|
|
Loading…
Reference in New Issue