Files
pqAutomationApp/docs/UCD-API文档/examples/work_with_fw_version_check.py

36 lines
1.1 KiB
Python
Raw Normal View History

2026-07-02 17:16:18 +08:00
#
# Import UniTAP module.
#
import UniTAP
#
# To initialize UniTAP library wrapper user should create UniTAP.TsiLib() object.
#
lUniTAP = UniTAP.TsiLib()
#
# For opening device, please, put serial number of the device as 8 symbol str or put index of device.
#
# dev = lUniTAP.open("NNNNNNNN")
dev = lUniTAP.open(0)
# After opening device as in UCD Console device role should be selected.
role = dev.select_role(UniTAP.dev.UCD500.DPSourceDPSink)
update_available = role.is_fw_update_available() # Check if there is a firmware update available for the current device.
if update_available:
update_info = role.get_fw_update_info() # Get information about available firmware update.
print(f"Firmware update is available:\n{update_info}")
else:
print("Firmware is up to date.")
#
# Since the 3.5 version, TsiLib and TSIDevice objects have the option to be closed earlier.
# TSIDevice can be closed with the TsiLib method close(). TsiLib can be closed with cleanup().
# Clean up will close all opened devices and block ability to open any devices
# with same TsiLib object.
#
lUniTAP.close(dev)
lUniTAP.cleanup()