From 951806b4003324b6f0190dc7a4ad3a2b15fa0690 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Sun, 13 Jan 2019 14:48:56 +0100 Subject: [PATCH] graphics() raspian detection fix --- lib/graphics.js | 14 +++++++++----- lib/util.js | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/graphics.js b/lib/graphics.js index a956ae3..81ef272 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -401,11 +401,11 @@ function graphics(callback) { let cmd = 'fbset -s | grep \'mode "\'; vcgencmd get_mem gpu; tvservice -s; tvservice -n;'; exec(cmd, function (error, stdout) { 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'); if (parts.length === 2) { - push({ - model: getValue(lines, 'device_name', '='), + result.displays.push({ + model: util.getValue(lines, 'device_name', '='), main: true, builtin: false, connection: 'HDMI', @@ -417,8 +417,8 @@ function graphics(callback) { }) } } - if (lines.length > 1 && lines[1].indexOf('gpu=' >= -1) { - push({ + if (lines.length > 1 && lines[1].indexOf('gpu=' >= -1)) { + result.controllers.push({ vendor: 'Broadcom', model: 'VideoCore IV', bus: '', @@ -426,6 +426,10 @@ function graphics(callback) { vramDynamic: true }) } + if (callback) { + callback(result); + } + resolve(result); }); } else { let cmd = 'lspci -vvv 2>/dev/null'; diff --git a/lib/util.js b/lib/util.js index bdf4394..9063ba2 100644 --- a/lib/util.js +++ b/lib/util.js @@ -300,7 +300,7 @@ function isRaspbian() { } catch (e) { return false; }; - const id = getValue(cpuinfo, 'id'); + const id = getValue(osrelease, 'id'); return (id.indexOf('raspbian') >= -1) }