Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check helium API and onboarding server for key #231

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions hm_pyhelper/miner_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions hm_pyhelper/util/helium_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import os