new: added skip-hello to partition handlers

skip-hello is sometimes needed / useful here.
This commit is contained in:
steadfasterX 2017-10-05 17:19:27 +02:00
parent 253b7a17fb
commit 5af4d393a1
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, 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)") 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("--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): def dump_partitions(comm, disk_fd, outdir, max_size):
parts = partitions.get_partitions(comm) parts = partitions.get_partitions(comm)
@ -54,7 +56,9 @@ def main():
comm = lglaf.autodetect_device() comm = lglaf.autodetect_device()
with closing(comm): with closing(comm):
if not args.skip_hello:
lglaf.try_hello(comm) lglaf.try_hello(comm)
with partitions.laf_open_disk(comm) as disk_fd: with partitions.laf_open_disk(comm) as disk_fd:
_logger.debug("Opened fd %d for disk", disk_fd) _logger.debug("Opened fd %d for disk", disk_fd)
dump_partitions(comm, disk_fd, args.outdir, args.max_size * 1024) 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='?', parser.add_argument("partition", nargs='?',
help="Partition number (e.g. 1 for block device mmcblk0p1)" help="Partition number (e.g. 1 for block device mmcblk0p1)"
" or partition name (e.g. 'recovery')") " or partition name (e.g. 'recovery')")
parser.add_argument("--skip-hello", action="store_true",
help="Immediately send commands, skip HELO message")
def main(): def main():
args = parser.parse_args() args = parser.parse_args()
@ -247,6 +249,8 @@ def main():
comm = lglaf.autodetect_device() comm = lglaf.autodetect_device()
with closing(comm): with closing(comm):
if not args.skip_hello:
lglaf.try_hello(comm) lglaf.try_hello(comm)
if args.list: if args.list: