From b97f6704331d5bec835e94c354e5de91cd9039d7 Mon Sep 17 00:00:00 2001 From: Bjoern Kerler Date: Mon, 3 Apr 2023 15:46:24 +0200 Subject: [PATCH] Additional unlock fixes --- edlclient/Library/Modules/generic.py | 9 ++++++--- edlclient/Library/Modules/init.py | 2 ++ requirements.txt | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/edlclient/Library/Modules/generic.py b/edlclient/Library/Modules/generic.py index c22618f..ee3117c 100644 --- a/edlclient/Library/Modules/generic.py +++ b/edlclient/Library/Modules/generic.py @@ -23,9 +23,12 @@ class generic(metaclass=LogBase): if res[0]: lun = res[1] rpartition = res[2] - offsettopatch = 0x7FFFF - sector = rpartition.sector + (offsettopatch // self.fh.cfg.SECTOR_SIZE_IN_BYTES) - offset = offsettopatch % self.fh.cfg.SECTOR_SIZE_IN_BYTES + if rpartition.sectors <= (0x8000//self.cfg.SECTOR_SIZE_IN_BYTES): + offsettopatch = 0x7FFF + sector, offset = self.fh.calc_offset(rpartition.sector, offsettopatch) + else: + offsettopatch = 0x7FFFF + sector, offset = self.fh.calc_offset(rpartition.sector, offsettopatch) if enable: value = 0x1 else: diff --git a/edlclient/Library/Modules/init.py b/edlclient/Library/Modules/init.py index 48d17bf..607d83f 100644 --- a/edlclient/Library/Modules/init.py +++ b/edlclient/Library/Modules/init.py @@ -98,3 +98,5 @@ class modules(metaclass=LogBase): self.error("Unknown mode given. Available are: enable, disable.") return False return self.generic.oem_unlock(enable) + else: + print("Valid options are: oemunlock [enable,disable]") diff --git a/requirements.txt b/requirements.txt index c08275e..4b4df8c 100755 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ pyserial>=3.4 docopt>=0.6.2 pylzma>=0.5.0 pycryptodome +pycryptodomex lxml>=4.6.1 colorama usb