1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-09-23 12:21:54 +01: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:
Sergei Trofimov
2019-11-28 09:23:41 +00:00
committed by Marc Bonnici
parent 182f4e7b3f
commit 6c9f80ff76
2 changed files with 14 additions and 20 deletions

View File

@@ -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',