mirror of
https://github.com/ARM-software/devlib.git
synced 2025-04-17 07:10:03 +01: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:
parent
bfda5c4271
commit
f3c8ce975e
@ -1370,7 +1370,11 @@ class AndroidTarget(Target):
|
|||||||
|
|
||||||
def get_rotation(self):
|
def get_rotation(self):
|
||||||
cmd = 'settings get system user_rotation'
|
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):
|
def set_rotation(self, rotation):
|
||||||
if not 0 <= rotation <= 3:
|
if not 0 <= rotation <= 3:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user