mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
target: get model form platform
Move the resolution of the model name from targets into Platform's _set_model_from_target() (which was already attempting to do that via dmidecode method).
This commit is contained in:
parent
182f4e7b3f
commit
6c9f80ff76
@ -78,7 +78,16 @@ class Platform(object):
|
||||
|
||||
def _set_model_from_target(self, target):
|
||||
if target.os == 'android':
|
||||
self.model = target.getprop('ro.product.model')
|
||||
try:
|
||||
self.model = target.getprop(prop='ro.product.device')
|
||||
except KeyError:
|
||||
self.model = target.getprop('ro.product.model')
|
||||
elif target.file_exists("/proc/device-tree/model"):
|
||||
# There is currently no better way to do this cross platform.
|
||||
# ARM does not have dmidecode
|
||||
raw_model = target.execute("cat /proc/device-tree/model")
|
||||
device_model_to_return = '_'.join(raw_model.split()[:2])
|
||||
return device_model_to_return.rstrip(' \t\r\n\0')
|
||||
elif target.is_rooted:
|
||||
try:
|
||||
self.model = target.execute('dmidecode -s system-version',
|
||||
|
@ -136,6 +136,10 @@ class Target(object):
|
||||
def os_version(self): # pylint: disable=no-self-use
|
||||
return {}
|
||||
|
||||
@property
|
||||
def model(self):
|
||||
return self.platform.model
|
||||
|
||||
@property
|
||||
def abi(self): # pylint: disable=no-self-use
|
||||
return None
|
||||
@ -980,17 +984,6 @@ class LinuxTarget(Target):
|
||||
os_version[name] = convert_new_lines(output.strip()).replace('\n', ' ')
|
||||
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")
|
||||
device_model_to_return = '_'.join(raw_model.split()[:2])
|
||||
return device_model_to_return.rstrip(' \t\r\n\0')
|
||||
return None
|
||||
|
||||
@property
|
||||
@memoized
|
||||
def system_id(self):
|
||||
@ -1163,14 +1156,6 @@ 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 system_id(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user