Merge pull request #157 from 1e9abhi1e10/update_firmware_2
This commit is contained in:
@@ -193,6 +193,40 @@ class Auradine(StockFirmware):
|
|||||||
for key in conf.keys():
|
for key in conf.keys():
|
||||||
await self.web.send_command(command=key, **conf[key])
|
await self.web.send_command(command=key, **conf[key])
|
||||||
|
|
||||||
|
async def upgrade_firmware(self, *, url: str = None, version: str = "latest", keep_settings: bool = False, **kwargs) -> bool:
|
||||||
|
"""
|
||||||
|
Upgrade the firmware of the Auradine device.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
url (str): The URL to download the firmware from.
|
||||||
|
version (str): The version of the firmware to upgrade to.
|
||||||
|
keep_settings (bool): Whether to keep the current settings during the upgrade.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: True if the firmware upgrade was successful, False otherwise.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
logging.info("Starting firmware upgrade process.")
|
||||||
|
|
||||||
|
if not url and not version:
|
||||||
|
raise ValueError("Either URL or version must be provided for firmware upgrade.")
|
||||||
|
|
||||||
|
if url:
|
||||||
|
result = await self.web.firmware_upgrade(url=url)
|
||||||
|
else:
|
||||||
|
result = await self.web.firmware_upgrade(version=version)
|
||||||
|
|
||||||
|
if result.get("STATUS", [{}])[0].get("STATUS") == "S":
|
||||||
|
logging.info("Firmware upgrade process completed successfully.")
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
logging.error(f"Firmware upgrade failed: {result.get('error', 'Unknown error')}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"An error occurred during the firmware upgrade process: {str(e)}")
|
||||||
|
return False
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
### DATA GATHERING FUNCTIONS (get_{some_data}) ###
|
### DATA GATHERING FUNCTIONS (get_{some_data}) ###
|
||||||
##################################################
|
##################################################
|
||||||
|
|||||||
@@ -228,4 +228,4 @@ class BFGMiner(StockFirmware):
|
|||||||
expected_rate, HashUnit.SHA256.from_str(rate_unit)
|
expected_rate, HashUnit.SHA256.from_str(rate_unit)
|
||||||
).into(self.algo.unit.default)
|
).into(self.algo.unit.default)
|
||||||
except LookupError:
|
except LookupError:
|
||||||
pass
|
pass
|
||||||
@@ -560,5 +560,18 @@ class BaseMiner(MinerProtocol):
|
|||||||
if self._ssh_cls is not None:
|
if self._ssh_cls is not None:
|
||||||
self.ssh = self._ssh_cls(ip)
|
self.ssh = self._ssh_cls(ip)
|
||||||
|
|
||||||
|
async def upgrade_firmware(self, *, file: str = None, url: str = None, version: str = None, keep_settings: bool = True) -> bool:
|
||||||
|
"""Upgrade the firmware of the miner.
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
file (str, optional): The file path to the firmware to upgrade from. Must be a valid file path if provided.
|
||||||
|
url (str, optional): The URL to download the firmware from. Must be a valid URL if provided.
|
||||||
|
version (str, optional): The version of the firmware to upgrade to. If None, the version will be inferred from the file or URL.
|
||||||
|
keep_settings (bool, optional): Whether to keep the current settings during the upgrade. Defaults to True.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A boolean value of the success of the firmware upgrade.
|
||||||
|
"""
|
||||||
|
return False
|
||||||
|
|
||||||
AnyMiner = TypeVar("AnyMiner", bound=BaseMiner)
|
AnyMiner = TypeVar("AnyMiner", bound=BaseMiner)
|
||||||
|
|||||||
@@ -43,4 +43,4 @@ class LuxOSFirmware(BaseMiner):
|
|||||||
|
|
||||||
|
|
||||||
class MaraFirmware(BaseMiner):
|
class MaraFirmware(BaseMiner):
|
||||||
firmware = MinerFirmware.MARATHON
|
firmware = MinerFirmware.MARATHON
|
||||||
Reference in New Issue
Block a user