1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-02-07 13:40:48 +00:00

target: timestamp for capture_screen

Add an option to format an ISO8601 timestamp into the screenshot file
name.
This commit is contained in:
Sergei Trofimov 2018-04-11 10:48:49 +01:00 committed by Marc Bonnici
parent 2a23c435d4
commit 8370c8fba3
2 changed files with 11 additions and 2 deletions

View File

@ -242,6 +242,11 @@ class Gem5SimulationPlatform(Platform):
if '.bmp' in f:
screen_caps.append(f)
if '{ts}' in filepath:
cmd = '{} date -u -Iseconds'
ts = self.target.execute(cmd.format(self.target.busybox)).strip()
filepath = filepath.format(ts=ts)
successful_capture = False
if len(screen_caps) == 1:
# Bail out if we do not have image, and resort to the slower, built

View File

@ -905,7 +905,9 @@ class LinuxTarget(Target):
try:
tmpfile = self.tempfile()
self.execute('DISPLAY=:0.0 scrot {}'.format(tmpfile))
cmd = 'DISPLAY=:0.0 scrot {} && {} date -u -Iseconds'
ts = self.execute(cmd.format(tmpfile, self.busybox)).strip()
filepath = filepath.format(ts=ts)
self.pull(tmpfile, filepath)
self.remove(tmpfile)
except TargetError as e:
@ -1144,7 +1146,9 @@ class AndroidTarget(Target):
def capture_screen(self, filepath):
on_device_file = self.path.join(self.working_directory, 'screen_capture.png')
self.execute('screencap -p {}'.format(on_device_file))
cmd = 'screencap -p {} && {} date -u -Iseconds'
ts = self.execute(cmd.format(on_device_file, self.busybox)).strip()
filepath = filepath.format(ts=ts)
self.pull(on_device_file, filepath)
self.remove(on_device_file)