From 687da6a7813e70a710d870346692e59959db264e Mon Sep 17 00:00:00 2001 From: Maik Marschner Date: Tue, 20 Oct 2020 17:43:15 +0200 Subject: [PATCH 1/4] Import json files without __dirname. --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index ac17849..b9fac89 100644 --- a/src/index.js +++ b/src/index.js @@ -16,9 +16,9 @@ const EdidParser = require('./edid-parser'); class EdidReader { // Source: http://www.komeil.com/blog/fix-edid-monitor-no-signal-dvi#li-comment-845 - static eisaIds = require(`${__dirname}/../data/eisa.json`); + static eisaIds = require(`../data/eisa.json`); // Source: https://uefi.org/acpi_id_list - static pnpIds = require(`${__dirname}/../data/pnp.json`); + static pnpIds = require(`../data/pnp.json`); constructor() { if (!_.includes(['linux', 'darwin'], os.platform())) { From dd7302cf832b522a9962b0f997a0165d262e9cea Mon Sep 17 00:00:00 2001 From: Maik Marschner Date: Tue, 20 Oct 2020 17:46:18 +0200 Subject: [PATCH 2/4] Fix the scan function. Applies the patches from https://github.com/carlipa/node-edid-reader/issues/4#issue-673513975 --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index b9fac89..9f604fc 100644 --- a/src/index.js +++ b/src/index.js @@ -59,7 +59,7 @@ class EdidReader { // Linux fetch EDID getLinuxSystemEdids() { // /sys/devices/pci0000\:00/0000\:00\:02.0/drm/card0/card0-HDMI-A-1/edid - return glob('/sys/devices/pci*/0000:*/drm/card*/card*/edid') + return glob('/sys/devices/pci*/0000:*/*/drm/card*/card*/edid') .map((edidFileName) => fs.readFileAsync(edidFileName) .then(buffer => ({filename: edidFileName, edid: buffer.toString('hex')}))) .filter(result => result.edid !== ''); @@ -77,7 +77,7 @@ class EdidReader { // Scan host for edids scan() { return this.getSystemEdids() - .map(this.formatEdid) + .map(EdidReader.formatEdid) .then((rawEdids) => { this.monitors = _.map(rawEdids, ({filename, edid}) => { console.log(edid); From fdded128f9df8167f5535bcecd65ba2459ac9a40 Mon Sep 17 00:00:00 2001 From: Maik Marschner Date: Tue, 20 Oct 2020 17:46:46 +0200 Subject: [PATCH 3/4] Remove debug output. --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 9f604fc..60c1ec7 100644 --- a/src/index.js +++ b/src/index.js @@ -80,7 +80,7 @@ class EdidReader { .map(EdidReader.formatEdid) .then((rawEdids) => { this.monitors = _.map(rawEdids, ({filename, edid}) => { - console.log(edid); + // console.log(edid); const edidObj = EdidReader.parse(edid); edidObj.outputName = EdidReader.cardOutputMapper(filename); return edidObj; From 348cb7891f236c63227fc1f908f1a22627baaac0 Mon Sep 17 00:00:00 2001 From: Maik Marschner Date: Tue, 20 Oct 2020 17:48:17 +0200 Subject: [PATCH 4/4] Drop unneeded template string from require calls. --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 60c1ec7..5c5a78b 100644 --- a/src/index.js +++ b/src/index.js @@ -16,9 +16,9 @@ const EdidParser = require('./edid-parser'); class EdidReader { // Source: http://www.komeil.com/blog/fix-edid-monitor-no-signal-dvi#li-comment-845 - static eisaIds = require(`../data/eisa.json`); + static eisaIds = require('../data/eisa.json'); // Source: https://uefi.org/acpi_id_list - static pnpIds = require(`../data/pnp.json`); + static pnpIds = require('../data/pnp.json'); constructor() { if (!_.includes(['linux', 'darwin'], os.platform())) {