From 98f491a7c7ffd6e4ae54f1aef1d14fe060be0a2d Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 25 Jan 2021 08:21:20 +0100 Subject: [PATCH] graphics() controller subid fix (win) --- CHANGELOG.md | 1 + docs/history.html | 7 ++++++- docs/index.html | 6 +++--- lib/graphics.js | 14 +++++++++----- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 147ca1a..1873590 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | +| 4.34.8 | 2020-01-25 | `graphics()` controller subid fix (win) | | 4.34.7 | 2020-01-13 | `services()` improved service discovery (linux) | | 4.34.6 | 2020-01-12 | `networkInterfaces()` catch errors | | 4.34.5 | 2020-01-07 | `networkInterfaceDefault()` fixed CMD popup (windows) | diff --git a/docs/history.html b/docs/history.html index 5ab66f6..7c379b3 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.34.8 + 2020-01-25 + graphics() controller subid fix (win) + 4.34.7 2020-01-13 @@ -2069,4 +2074,4 @@ - + \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 4af9bcf..f7842e5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -169,7 +169,7 @@
systeminformation
-
Current Version: 4.34.7
+
Current Version: 4.34.8
@@ -208,7 +208,7 @@
Downloads last month
-
367
+
375
Dependents
@@ -366,4 +366,4 @@ - + \ No newline at end of file diff --git a/lib/graphics.js b/lib/graphics.js index 3a65cc9..84d489a 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -720,8 +720,8 @@ function graphics(callback) { result.controllers = parseLinesLinuxControllers(lines); const nvidiaData = nvidiaDevices(); // needs to be rewritten ... using no spread operators - result.controllers = result.controllers.map(( controller ) => { // match by busAddress - return mergeControllerNvidia(controller, nvidiaData.find(({ pciBus }) => pciBus.endsWith(controller.busAddress)) || {} ); + result.controllers = result.controllers.map((controller) => { // match by busAddress + return mergeControllerNvidia(controller, nvidiaData.find(({ pciBus }) => pciBus.endsWith(controller.busAddress)) || {}); }) } let cmd = "clinfo --raw"; @@ -887,9 +887,13 @@ function graphics(callback) { if (sections[i].trim() !== '') { let lines = sections[i].trim().split('\r\n'); - let subDeviceId = util.getValue(lines, 'PNPDeviceID', '=').match(/SUBSYS_[a-fA-F\d]{8}/)[0]; - if (subDeviceId) { - subDeviceId = subDeviceId.split('_')[1]; + let pnpDeviceId = util.getValue(lines, 'PNPDeviceID', '=').match(/SUBSYS_[a-fA-F\d]{8}/); + let subDeviceId = null; + if (pnpDeviceId) { + subDeviceId = pnpDeviceId[0]; + if (subDeviceId) { + subDeviceId = subDeviceId.split('_')[1]; + } } controllers.push({ vendor: util.getValue(lines, 'AdapterCompatibility', '='),