mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-03 23:41:21 +00:00 
			
		
		
		
	target: fix get_rotation() when null
Some targets don't seem to set system.user_rotation, resulting in "null" being returned. This exploded on integer conversion. Handle this case by returning the Python equivalent, None.
This commit is contained in:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							bfda5c4271
						
					
				
				
					commit
					f3c8ce975e
				
			@@ -1370,7 +1370,11 @@ class AndroidTarget(Target):
 | 
			
		||||
 | 
			
		||||
    def get_rotation(self):
 | 
			
		||||
        cmd = 'settings get system user_rotation'
 | 
			
		||||
        return int(self.execute(cmd).strip())
 | 
			
		||||
        res = self.execute(cmd).strip()
 | 
			
		||||
        try:
 | 
			
		||||
            return int(res)
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            return None
 | 
			
		||||
 | 
			
		||||
    def set_rotation(self, rotation):
 | 
			
		||||
        if not 0 <= rotation <= 3:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user