Additional unlock fixes

This commit is contained in:
Bjoern Kerler 2023-04-03 15:46:24 +02:00
parent 571ee4ed89
commit b97f670433
No known key found for this signature in database
GPG key ID: 52E823BB96A55380
3 changed files with 9 additions and 3 deletions

View file

@ -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:

View file

@ -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]")

View file

@ -4,6 +4,7 @@ pyserial>=3.4
docopt>=0.6.2
pylzma>=0.5.0
pycryptodome
pycryptodomex
lxml>=4.6.1
colorama
usb