diff options
author | Devaev Maxim <[email protected]> | 2020-05-29 04:33:35 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-05-29 04:33:35 +0300 |
commit | cf5bf8e14732e7c0bdc67a08a0e410b81b2d4572 (patch) | |
tree | 32a0b872b8bf21d5b69e7686ba55ca0f85e50e3f /kvmd/plugins/msd | |
parent | eb13da03be9f52954755930def2bfdf57fb6347c (diff) |
refactoring
Diffstat (limited to 'kvmd/plugins/msd')
-rw-r--r-- | kvmd/plugins/msd/otg/__init__.py | 3 | ||||
-rw-r--r-- | kvmd/plugins/msd/relay.py | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/kvmd/plugins/msd/otg/__init__.py b/kvmd/plugins/msd/otg/__init__.py index 377c1c73..25585302 100644 --- a/kvmd/plugins/msd/otg/__init__.py +++ b/kvmd/plugins/msd/otg/__init__.py @@ -45,6 +45,7 @@ from ....validators.os import valid_abs_dir from ....validators.os import valid_command from .... import aiotools +from .... import aiofs from .. import MsdError from .. import MsdIsBusyError @@ -340,7 +341,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes async def write_image_chunk(self, chunk: bytes) -> int: assert self.__new_file - await aiotools.afile_write_now(self.__new_file, chunk) + await aiofs.afile_write_now(self.__new_file, chunk) self.__new_file_written += len(chunk) now = time.time() if self.__new_file_tick + 1 < now: diff --git a/kvmd/plugins/msd/relay.py b/kvmd/plugins/msd/relay.py index 43baeadc..1254351a 100644 --- a/kvmd/plugins/msd/relay.py +++ b/kvmd/plugins/msd/relay.py @@ -39,6 +39,7 @@ import aiofiles.base from ...logging import get_logger from ... import aiotools +from ... import aiofs from ... import gpio from ...yamlconf import Option @@ -325,7 +326,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes async def write_image_chunk(self, chunk: bytes) -> int: assert self.__device_file - await aiotools.afile_write_now(self.__device_file, chunk) + await aiofs.afile_write_now(self.__device_file, chunk) self.__written += len(chunk) return self.__written @@ -349,7 +350,7 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes assert self.__device_info if self.__device_info.size - self.__written > _IMAGE_INFO_SIZE: await self.__device_file.seek(self.__device_info.size - _IMAGE_INFO_SIZE) - await aiotools.afile_write_now(self.__device_file, _make_image_info_bytes(name, self.__written, complete)) + await aiofs.afile_write_now(self.__device_file, _make_image_info_bytes(name, self.__written, complete)) await self.__device_file.seek(0) else: get_logger().error("Can't write image info because device is full") |