1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 02:40:50 +01:00

Merge pull request #21 from ep1cman/fixes

Fixes
This commit is contained in:
setrofim 2016-02-23 17:15:00 +00:00
commit 615f1ce5e8
2 changed files with 21 additions and 3 deletions

View File

@ -28,12 +28,12 @@ class LocalConnection(object):
name = 'local'
def __init__(self, timeout=10, keep_password=True, unrooted=False):
def __init__(self, timeout=10, keep_password=True, unrooted=False, password=None):
self.logger = logging.getLogger('local_connection')
self.timeout = timeout
self.keep_password = keep_password
self.unrooted = unrooted
self.password = None
self.password = password
def push(self, source, dest, timeout=None, as_root=False): # pylint: disable=unused-argument
self.logger.debug('cp {} {}'.format(source, dest))
@ -77,4 +77,3 @@ class LocalConnection(object):
if self.keep_password:
self.password = password
return password

View File

@ -539,6 +539,16 @@ class LinuxTarget(Target):
raise
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):
super(LinuxTarget, self).connect(timeout=timeout)
@ -644,6 +654,7 @@ class AndroidTarget(Target):
return self.conn.device
@property
@memoized
def android_id(self):
"""
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()
return output.split('value=')[-1]
@property
@memoized
def model(self):
try:
return self.getprop(prop='ro.product.device')
except KeyError:
return None
@property
@memoized
def screen_resolution(self):