Add TODO comment and device log

This commit is contained in:
HuangMason320 2025-07-16 21:53:31 +08:00
parent e0169cd845
commit e34cdfb856

View File

@ -90,6 +90,8 @@ class MultiDongle:
print('[Scanning Devices]') print('[Scanning Devices]')
device_descriptors = kp.core.scan_devices() device_descriptors = kp.core.scan_devices()
print(device_descriptors)
if not device_descriptors: if not device_descriptors:
print(' - No devices found') print(' - No devices found')
return [] return []
@ -175,14 +177,13 @@ class MultiDongle:
str: Device series (e.g., 'KL520', 'KL720', etc.) str: Device series (e.g., 'KL520', 'KL720', etc.)
""" """
try: try:
# Product ID to device series mapping # TODO: Check Product ID to device series mapping
product_id_mapping = { product_id_mapping = {
'0x100': 'KL520', '0x100': 'KL520',
'0x720': 'KL720', '0x720': 'KL720',
'0x630': 'KL630', '0x630': 'KL630',
'0x730': 'KL730', '0x730': 'KL730',
'0x540': 'KL540', '0x540': 'KL540',
# Add more mappings as needed
} }
# Handle dict format (from JSON) # Handle dict format (from JSON)
@ -331,16 +332,16 @@ class MultiDongle:
# kp.core.set_timeout(device_group=self.device_group, milliseconds=5000) # kp.core.set_timeout(device_group=self.device_group, milliseconds=5000)
# print(' - Success') # print(' - Success')
if self.upload_fw: # if self.upload_fw:
try: try:
print('[Upload Firmware]') print('[Upload Firmware]')
kp.core.load_firmware_from_file(device_group=self.device_group, kp.core.load_firmware_from_file(device_group=self.device_group,
scpu_fw_path=self.scpu_fw_path, scpu_fw_path=self.scpu_fw_path,
ncpu_fw_path=self.ncpu_fw_path) ncpu_fw_path=self.ncpu_fw_path)
print(' - Success') print(' - Success')
except kp.ApiKPException as exception: except kp.ApiKPException as exception:
print('Error: upload firmware failed, error = \'{}\''.format(str(exception))) print('Error: upload firmware failed, error = \'{}\''.format(str(exception)))
sys.exit(1) sys.exit(1)
# upload model to device # upload model to device
try: try: