mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
AndroidTarget & LinuxTarget: Added a model
property
This commit is contained in:
parent
a7f6ddb05a
commit
f5b7c82f52
@ -539,6 +539,16 @@ class LinuxTarget(Target):
|
|||||||
raise
|
raise
|
||||||
return os_version
|
return os_version
|
||||||
|
|
||||||
|
@property
|
||||||
|
@memoized
|
||||||
|
# There is currently no better way to do this cross platform.
|
||||||
|
# ARM does not have dmidecode
|
||||||
|
def model(self):
|
||||||
|
if self.file_exists("/proc/device-tree/model"):
|
||||||
|
raw_model = self.execute("cat /proc/device-tree/model")
|
||||||
|
return '_'.join(raw_model.split()[:2])
|
||||||
|
return None
|
||||||
|
|
||||||
def connect(self, timeout=None):
|
def connect(self, timeout=None):
|
||||||
super(LinuxTarget, self).connect(timeout=timeout)
|
super(LinuxTarget, self).connect(timeout=timeout)
|
||||||
|
|
||||||
@ -644,6 +654,7 @@ class AndroidTarget(Target):
|
|||||||
return self.conn.device
|
return self.conn.device
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@memoized
|
||||||
def android_id(self):
|
def android_id(self):
|
||||||
"""
|
"""
|
||||||
Get the device's ANDROID_ID. Which is
|
Get the device's ANDROID_ID. Which is
|
||||||
@ -658,6 +669,14 @@ class AndroidTarget(Target):
|
|||||||
output = self.execute('content query --uri content://settings/secure --projection value --where "name=\'android_id\'"').strip()
|
output = self.execute('content query --uri content://settings/secure --projection value --where "name=\'android_id\'"').strip()
|
||||||
return output.split('value=')[-1]
|
return output.split('value=')[-1]
|
||||||
|
|
||||||
|
@property
|
||||||
|
@memoized
|
||||||
|
def model(self):
|
||||||
|
try:
|
||||||
|
return self.getprop(prop='ro.product.device')
|
||||||
|
except KeyError:
|
||||||
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@memoized
|
@memoized
|
||||||
def screen_resolution(self):
|
def screen_resolution(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user