diff --git a/hm_pyhelper/miner_param.py b/hm_pyhelper/miner_param.py index e33cb0e..bc224ce 100644 --- a/hm_pyhelper/miner_param.py +++ b/hm_pyhelper/miner_param.py @@ -3,7 +3,7 @@ import subprocess import json import platform -from urllib.parse import urlparse +from urllib.parse import urlparse, parse_qs from packaging.version import Version from retry import retry @@ -120,15 +120,22 @@ def get_ecc_location() -> str: elif len(ecc_list) == 1: ecc_location = ecc_list[0] else: - for location in ecc_list: - parse_result = urlparse(location) + for index in range(len(ecc_list)): + parse_result = urlparse(ecc_list[index]) i2c_bus = parse_i2c_bus(parse_result.hostname) i2c_address = parse_i2c_address(parse_result.port) + query_string = parse_qs(parse_result.query) + key_slots = query_string["slot"] command = f'i2cdetect -y {i2c_bus}' parameter = f'{i2c_address} --' if config_search_param(command, parameter): - ecc_location = location + if len(key_slots) == 1: + ecc_location = ecc_list[index] + else: + for slot in key_slots: + parse_result.query = f'slot={slot}' + return ecc_location return ecc_location diff --git a/hm_pyhelper/util/helium_api.py b/hm_pyhelper/util/helium_api.py new file mode 100644 index 0000000..21b405d --- /dev/null +++ b/hm_pyhelper/util/helium_api.py @@ -0,0 +1 @@ +import os