mirror of
https://github.com/bkerler/edl.git
synced 2024-11-14 19:14:58 -05:00
Merge pull request #520 from bongbui321/getactiveslot
Add functionality `getactiveslot`
This commit is contained in:
commit
862eb60778
2 changed files with 22 additions and 1 deletions
3
edl
3
edl
|
@ -45,6 +45,7 @@ Usage:
|
|||
edl qfp <filename> [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid] [--skipstorageinit] [--portname=portname] [--serial]
|
||||
edl getstorageinfo [--loader=filename] [--memory=memtype] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid] [--skipstorageinit] [--portname=portname] [--serial] [--devicemodel=value]
|
||||
edl setbootablestoragedrive <lun> [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid] [--portname=portname] [--serial] [--devicemodel=value]
|
||||
edl getactiveslot [--memory=memtype] [--loader=filename] [--debugmode] [--vid=vid] [--pid=pid] [--portname=portname] [--serial] [--devicemodel=value]
|
||||
edl setactiveslot <slot> [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid] [--portname=portname] [--serial] [--devicemodel=value]
|
||||
edl send <command> [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid] [--portname=portname] [--serial] [--devicemodel=value]
|
||||
edl xml <xmlfile> [--loader=filename] [--debugmode] [--skipresponse] [--vid=vid] [--pid=pid] [--skipstorageinit] [--portname=portname] [--serial] [--devicemodel=value]
|
||||
|
@ -153,7 +154,7 @@ print("Qualcomm Sahara / Firehose Client V3.62 (c) B.Kerler 2018-2023.")
|
|||
def parse_cmd(rargs):
|
||||
cmds = ["server", "printgpt", "gpt", "r", "rl", "rf", "rs", "w", "wl", "wf", "ws", "e", "es", "ep", "footer",
|
||||
"peek", "peekhex", "peekdword", "peekqword", "memtbl", "poke", "pokehex", "pokedword", "pokeqword",
|
||||
"memcpy", "secureboot", "pbl", "qfp", "getstorageinfo", "setbootablestoragedrive", "setactiveslot",
|
||||
"memcpy", "secureboot", "pbl", "qfp", "getstorageinfo", "setbootablestoragedrive", "getactiveslot", "setactiveslot",
|
||||
"send", "xml", "rawxml", "reset", "nop", "modules", "memorydump", "provision", "qfil"]
|
||||
for cmd in cmds:
|
||||
if rargs[cmd]:
|
||||
|
|
|
@ -16,6 +16,7 @@ from edlclient.Library.firehose import firehose
|
|||
from edlclient.Library.xmlparser import xmlparser
|
||||
from edlclient.Library.utils import do_tcp_server
|
||||
from edlclient.Library.utils import LogBase, getint
|
||||
from edlclient.Library.gpt import AB_FLAG_OFFSET, AB_PARTITION_ATTR_SLOT_ACTIVE
|
||||
from edlclient.Config.qualcomm_config import memory_type
|
||||
from edlclient.Config.qualcomm_config import infotbl, msmids, secureboottbl, sochw
|
||||
import fnmatch
|
||||
|
@ -639,6 +640,25 @@ class firehose_client(metaclass=LogBase):
|
|||
return False
|
||||
else:
|
||||
return self.firehose.cmd_setbootablestoragedrive(int(options["<lun>"]))
|
||||
elif cmd == "getactiveslot":
|
||||
res = self.firehose.detect_partition(options, "boot_a")
|
||||
if res[0]:
|
||||
lun = res[1]
|
||||
partition = res[2]
|
||||
active = ((partition.flags >> (AB_FLAG_OFFSET*8))&0xFF) & AB_PARTITION_ATTR_SLOT_ACTIVE == AB_PARTITION_ATTR_SLOT_ACTIVE
|
||||
if active:
|
||||
self.printer("Current active slot: a")
|
||||
return True
|
||||
res = self.firehose.detect_partition(options, "boot_b")
|
||||
if res[0]:
|
||||
lun = res[1]
|
||||
partition = res[2]
|
||||
active = ((partition.flags >> (AB_FLAG_OFFSET*8))&0xFF) & AB_PARTITION_ATTR_SLOT_ACTIVE == AB_PARTITION_ATTR_SLOT_ACTIVE
|
||||
if active:
|
||||
self.printer("Current active slot: b")
|
||||
return True
|
||||
self.error("Can't detect active slot. Please make sure your device has slot A/B")
|
||||
return False
|
||||
elif cmd == "setactiveslot":
|
||||
if not self.check_param(["<slot>"]):
|
||||
return False
|
||||
|
|
Loading…
Reference in a new issue