android: allow to specify a target for fastboot commands
ADB commands always expect a device ID as first parameter, here
unfortunately we need to pass it as an optional one to avoid breaking
existing clients.
Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
diff --git a/devlib/utils/android.py b/devlib/utils/android.py
index ad4c324..cfbfb00 100644
--- a/devlib/utils/android.py
+++ b/devlib/utils/android.py
@@ -237,9 +237,10 @@
pass
-def fastboot_command(command, timeout=None):
+def fastboot_command(command, timeout=None, device=None):
_check_env()
- full_command = "fastboot {}".format(command)
+ target = '-s {}'.format(device) if device else ''
+ full_command = 'fastboot {} {}'.format(target, command)
logger.debug(full_command)
output, _ = check_output(full_command, timeout, shell=True)
return output