Commit 2045fb3a authored by Aard's avatar Aard

[ssu] Add uname-release.contains to boardmapping options

parent bd4a2b73
......@@ -19,10 +19,13 @@
# pull in the whole X11 stack, and on Mer/Nemo does cpuinfo
# matching only anyway, which ssu can do better already.
# - cpuinfo.contains -- searches /proc/cpuinfo for a string
# - uname-release.contains -- searches the kernels release string for
# a string (uname -r)
# - arch.equals -- compares with zyppers arch (like i586)
#
# Resolve order is:
# file.exists -> systeminfo.equals -> cpuinfo.contains -> arch.equals
# file.exists -> systeminfo.equals -> cpuinfo.contains
# -> uname-release.contains -> arch.equals
#
# The found model (after resolving variants) will be used as category. The
# following keys are valid there:
......
......@@ -9,6 +9,8 @@
#include <QTextStream>
#include <QDir>
#include <sys/utsname.h>
#include "ssudeviceinfo.h"
#include "ssucoreconfig.h"
#include "ssulog.h"
......@@ -184,8 +186,25 @@ QString SsuDeviceInfo::deviceModel(){
}
if (!cachedModel.isEmpty()) return cachedModel;
// check if the device can be identified by the kernel version string
struct utsname buf;
if (!uname(&buf)){
QString utsRelease(buf.release);
boardMappings->beginGroup("uname-release.contains");
keys = boardMappings->allKeys();
foreach (const QString &key, keys){
QString value = boardMappings->value(key).toString();
if (utsRelease.contains(value)){
cachedModel = key;
break;
}
}
boardMappings->endGroup();
}
if (!cachedModel.isEmpty()) return cachedModel;
// check if there's a match on arch ofr generic fallback. This probably
// check if there's a match on arch of generic fallback. This probably
// only makes sense for x86
boardMappings->beginGroup("arch.equals");
keys = boardMappings->allKeys();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment