Merge pull request #21 from steadfasterX/pr_skiphello

added skip-hello to the partition handlers
This commit is contained in:
Peter Wu 2017-10-15 18:54:03 +01:00 committed by GitHub
commit 8dc96c2178
2 changed files with 10 additions and 2 deletions

View file

@ -19,6 +19,8 @@ parser.add_argument("-d", "--outdir", default=".",
parser.add_argument("--max-size", metavar="kbytes", type=int, default=65535,
help="Maximum partition size to dump (in KiB) or 0 to dump all (default %(default)d)")
parser.add_argument("--debug", action='store_true', help="Enable debug messages")
parser.add_argument("--skip-hello", action="store_true",
help="Immediately send commands, skip HELO message")
def dump_partitions(comm, disk_fd, outdir, max_size):
parts = partitions.get_partitions(comm)
@ -54,7 +56,9 @@ def main():
comm = lglaf.autodetect_device()
with closing(comm):
lglaf.try_hello(comm)
if not args.skip_hello:
lglaf.try_hello(comm)
with partitions.laf_open_disk(comm) as disk_fd:
_logger.debug("Opened fd %d for disk", disk_fd)
dump_partitions(comm, disk_fd, args.outdir, args.max_size * 1024)

View file

@ -232,6 +232,8 @@ parser.add_argument("--wipe", action='store_true',
parser.add_argument("partition", nargs='?',
help="Partition number (e.g. 1 for block device mmcblk0p1)"
" or partition name (e.g. 'recovery')")
parser.add_argument("--skip-hello", action="store_true",
help="Immediately send commands, skip HELO message")
def main():
args = parser.parse_args()
@ -247,7 +249,9 @@ def main():
comm = lglaf.autodetect_device()
with closing(comm):
lglaf.try_hello(comm)
if not args.skip_hello:
lglaf.try_hello(comm)
if args.list:
list_partitions(comm, args.partition)