Files

55 lines
1.5 KiB
Python
Raw Permalink Normal View History

2026-07-02 17:16:18 +08:00
import time
#
# 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.UCD400.DPSourceDPSink)
# Enable DisplayID on RX side.
role.dprx.display_id.enable(True);
# Will be returned bytearray with DisplayID.
# For reading remote DisplayID you should select Virtual channel on TX side and call function
# 'read_sbm (index of virtual channel)'
display_id_data = role.dptx.display_id.read_i2c()
print(display_id_data)
caps = UniTAP.LinkCapabilities()
caps.mst = True
role.dprx.link.capabilities.set(caps)
config = role.dptx.link.config.get(UniTAP.LinkConfig.DP8b10b)
config.mst = True
role.dptx.link.config.set(config)
role.dptx.link.start_link_training()
time.sleep(5)
sbm_display_id_data = role.dptx.display_id.read_sbm(0)
print(sbm_display_id_data)
role.dprx.display_id.enable(False);
#
# 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()