mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
commit
615f1ce5e8
@ -28,12 +28,12 @@ class LocalConnection(object):
|
|||||||
|
|
||||||
name = 'local'
|
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.logger = logging.getLogger('local_connection')
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.keep_password = keep_password
|
self.keep_password = keep_password
|
||||||
self.unrooted = unrooted
|
self.unrooted = unrooted
|
||||||
self.password = None
|
self.password = password
|
||||||
|
|
||||||
def push(self, source, dest, timeout=None, as_root=False): # pylint: disable=unused-argument
|
def push(self, source, dest, timeout=None, as_root=False): # pylint: disable=unused-argument
|
||||||
self.logger.debug('cp {} {}'.format(source, dest))
|
self.logger.debug('cp {} {}'.format(source, dest))
|
||||||
@ -77,4 +77,3 @@ class LocalConnection(object):
|
|||||||
if self.keep_password:
|
if self.keep_password:
|
||||||
self.password = password
|
self.password = password
|
||||||
return password
|
return password
|
||||||
|
|
||||||
|
@ -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