1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-03-04 09:17:51 +00:00

uitils/android: Fix logcat monitor on older devices

The `-e` argument to match logcat output with a regex expression is not
present on older devices. If the target is running pre marshmallow fall
back to pipeing logcat into grep.
This commit is contained in:
Marc Bonnici 2018-03-14 17:24:51 +00:00 committed by setrofim
parent a992a890b8
commit c585a4e489

View File

@ -586,7 +586,12 @@ class LogcatMonitor(object):
regexp = '{}'.format('|'.join(self._regexps)) regexp = '{}'.format('|'.join(self._regexps))
if len(self._regexps) > 1: if len(self._regexps) > 1:
regexp = '({})'.format(regexp) regexp = '({})'.format(regexp)
logcat_cmd = '{} -e "{}"'.format(logcat_cmd, regexp) # Logcat on older version of android do not support the -e argument
# so fall back to using grep.
if self.target.get_sdk_version() > 23:
logcat_cmd = '{} -e "{}"'.format(logcat_cmd, regexp)
else:
logcat_cmd = '{} | grep "{}"'.format(logcat_cmd, regexp)
logcat_cmd = get_adb_command(self.target.conn.device, logcat_cmd) logcat_cmd = get_adb_command(self.target.conn.device, logcat_cmd)