mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +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:
		@@ -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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user