graphics() raspian detection fix

This commit is contained in:
Sebastian Hildebrandt 2019-01-13 14:48:56 +01:00
parent fa7e7c5d12
commit 951806b400
2 changed files with 10 additions and 6 deletions

View File

@ -401,11 +401,11 @@ function graphics(callback) {
let cmd = 'fbset -s | grep \'mode "\'; vcgencmd get_mem gpu; tvservice -s; tvservice -n;'; let cmd = 'fbset -s | grep \'mode "\'; vcgencmd get_mem gpu; tvservice -s; tvservice -n;';
exec(cmd, function (error, stdout) { exec(cmd, function (error, stdout) {
let lines = stdout.toString().split('\n'); let lines = stdout.toString().split('\n');
if (lines.length > 3 && lines[0].indexOf('mode "' >= -1)) { if (lines.length > 3 && lines[0].indexOf('mode "' >= -1) && lines[2].indexOf('0x12000a') > -1) {
const parts = lines[0].replace('mode', '').replace(/"/g, '').trim().split('x'); const parts = lines[0].replace('mode', '').replace(/"/g, '').trim().split('x');
if (parts.length === 2) { if (parts.length === 2) {
push({ result.displays.push({
model: getValue(lines, 'device_name', '='), model: util.getValue(lines, 'device_name', '='),
main: true, main: true,
builtin: false, builtin: false,
connection: 'HDMI', connection: 'HDMI',
@ -417,8 +417,8 @@ function graphics(callback) {
}) })
} }
} }
if (lines.length > 1 && lines[1].indexOf('gpu=' >= -1) { if (lines.length > 1 && lines[1].indexOf('gpu=' >= -1)) {
push({ result.controllers.push({
vendor: 'Broadcom', vendor: 'Broadcom',
model: 'VideoCore IV', model: 'VideoCore IV',
bus: '', bus: '',
@ -426,6 +426,10 @@ function graphics(callback) {
vramDynamic: true vramDynamic: true
}) })
} }
if (callback) {
callback(result);
}
resolve(result);
}); });
} else { } else {
let cmd = 'lspci -vvv 2>/dev/null'; let cmd = 'lspci -vvv 2>/dev/null';

View File

@ -300,7 +300,7 @@ function isRaspbian() {
} catch (e) { } catch (e) {
return false; return false;
}; };
const id = getValue(cpuinfo, 'id'); const id = getValue(osrelease, 'id');
return (id.indexOf('raspbian') >= -1) return (id.indexOf('raspbian') >= -1)
} }