systeminformation 5.28.8 → 5.28.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/audio.js +93 -39
- package/lib/battery.js +1 -1
- package/lib/filesystem.js +1 -1
- package/package.json +1 -1
package/lib/audio.js
CHANGED
|
@@ -19,32 +19,60 @@ const util = require('./util');
|
|
|
19
19
|
|
|
20
20
|
let _platform = process.platform;
|
|
21
21
|
|
|
22
|
-
const _linux =
|
|
23
|
-
const _darwin =
|
|
24
|
-
const _windows =
|
|
25
|
-
const _freebsd =
|
|
26
|
-
const _openbsd =
|
|
27
|
-
const _netbsd =
|
|
28
|
-
const _sunos =
|
|
22
|
+
const _linux = _platform === 'linux' || _platform === 'android';
|
|
23
|
+
const _darwin = _platform === 'darwin';
|
|
24
|
+
const _windows = _platform === 'win32';
|
|
25
|
+
const _freebsd = _platform === 'freebsd';
|
|
26
|
+
const _openbsd = _platform === 'openbsd';
|
|
27
|
+
const _netbsd = _platform === 'netbsd';
|
|
28
|
+
const _sunos = _platform === 'sunos';
|
|
29
29
|
|
|
30
30
|
function parseAudioType(str, input, output) {
|
|
31
31
|
str = str.toLowerCase();
|
|
32
32
|
let result = '';
|
|
33
33
|
|
|
34
|
-
if (str.indexOf('input') >= 0) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (str.indexOf('
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (str.indexOf('
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (str.indexOf('
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (str.indexOf('
|
|
47
|
-
|
|
34
|
+
if (str.indexOf('input') >= 0) {
|
|
35
|
+
result = 'Microphone';
|
|
36
|
+
}
|
|
37
|
+
if (str.indexOf('display audio') >= 0) {
|
|
38
|
+
result = 'Speaker';
|
|
39
|
+
}
|
|
40
|
+
if (str.indexOf('speak') >= 0) {
|
|
41
|
+
result = 'Speaker';
|
|
42
|
+
}
|
|
43
|
+
if (str.indexOf('laut') >= 0) {
|
|
44
|
+
result = 'Speaker';
|
|
45
|
+
}
|
|
46
|
+
if (str.indexOf('loud') >= 0) {
|
|
47
|
+
result = 'Speaker';
|
|
48
|
+
}
|
|
49
|
+
if (str.indexOf('head') >= 0) {
|
|
50
|
+
result = 'Headset';
|
|
51
|
+
}
|
|
52
|
+
if (str.indexOf('mic') >= 0) {
|
|
53
|
+
result = 'Microphone';
|
|
54
|
+
}
|
|
55
|
+
if (str.indexOf('mikr') >= 0) {
|
|
56
|
+
result = 'Microphone';
|
|
57
|
+
}
|
|
58
|
+
if (str.indexOf('phone') >= 0) {
|
|
59
|
+
result = 'Phone';
|
|
60
|
+
}
|
|
61
|
+
if (str.indexOf('controll') >= 0) {
|
|
62
|
+
result = 'Controller';
|
|
63
|
+
}
|
|
64
|
+
if (str.indexOf('line o') >= 0) {
|
|
65
|
+
result = 'Line Out';
|
|
66
|
+
}
|
|
67
|
+
if (str.indexOf('digital o') >= 0) {
|
|
68
|
+
result = 'Digital Out';
|
|
69
|
+
}
|
|
70
|
+
if (str.indexOf('smart sound technology') >= 0) {
|
|
71
|
+
result = 'Digital Signal Processor';
|
|
72
|
+
}
|
|
73
|
+
if (str.indexOf('high definition audio') >= 0) {
|
|
74
|
+
result = 'Sound Driver';
|
|
75
|
+
}
|
|
48
76
|
|
|
49
77
|
if (!result && output) {
|
|
50
78
|
result = 'Speaker';
|
|
@@ -54,13 +82,12 @@ function parseAudioType(str, input, output) {
|
|
|
54
82
|
return result;
|
|
55
83
|
}
|
|
56
84
|
|
|
57
|
-
|
|
58
85
|
function getLinuxAudioPci() {
|
|
59
86
|
let cmd = 'lspci -v 2>/dev/null';
|
|
60
87
|
let result = [];
|
|
61
88
|
try {
|
|
62
89
|
const parts = execSync(cmd, util.execOptsLinux).toString().split('\n\n');
|
|
63
|
-
parts.forEach(element => {
|
|
90
|
+
parts.forEach((element) => {
|
|
64
91
|
const lines = element.split('\n');
|
|
65
92
|
if (lines && lines.length && lines[0].toLowerCase().indexOf('audio') >= 0) {
|
|
66
93
|
const audio = {};
|
|
@@ -75,11 +102,27 @@ function getLinuxAudioPci() {
|
|
|
75
102
|
}
|
|
76
103
|
}
|
|
77
104
|
|
|
105
|
+
function parseWinAudioStatus(n) {
|
|
106
|
+
let status = n;
|
|
107
|
+
if (n === 1) {
|
|
108
|
+
status = 'other';
|
|
109
|
+
} else if (n === 2) {
|
|
110
|
+
status = 'unknown';
|
|
111
|
+
} else if (n === 3) {
|
|
112
|
+
status = 'enabled';
|
|
113
|
+
} else if (n === 4) {
|
|
114
|
+
status = 'disabled';
|
|
115
|
+
} else if (n === 5) {
|
|
116
|
+
status = 'not applicable';
|
|
117
|
+
}
|
|
118
|
+
return status;
|
|
119
|
+
}
|
|
120
|
+
|
|
78
121
|
function parseLinuxAudioPciMM(lines, audioPCI) {
|
|
79
122
|
const result = {};
|
|
80
123
|
const slotId = util.getValue(lines, 'Slot');
|
|
81
124
|
|
|
82
|
-
const pciMatch = audioPCI.filter(
|
|
125
|
+
const pciMatch = audioPCI.filter((item) => item.slotId === slotId);
|
|
83
126
|
|
|
84
127
|
result.id = slotId;
|
|
85
128
|
result.name = util.getValue(lines, 'SDevice');
|
|
@@ -99,12 +142,24 @@ function parseLinuxAudioPciMM(lines, audioPCI) {
|
|
|
99
142
|
function parseDarwinChannel(str) {
|
|
100
143
|
let result = '';
|
|
101
144
|
|
|
102
|
-
if (str.indexOf('builtin') >= 0) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (str.indexOf('
|
|
106
|
-
|
|
107
|
-
|
|
145
|
+
if (str.indexOf('builtin') >= 0) {
|
|
146
|
+
result = 'Built-In';
|
|
147
|
+
}
|
|
148
|
+
if (str.indexOf('extern') >= 0) {
|
|
149
|
+
result = 'Audio-Jack';
|
|
150
|
+
}
|
|
151
|
+
if (str.indexOf('hdmi') >= 0) {
|
|
152
|
+
result = 'HDMI';
|
|
153
|
+
}
|
|
154
|
+
if (str.indexOf('displayport') >= 0) {
|
|
155
|
+
result = 'Display-Port';
|
|
156
|
+
}
|
|
157
|
+
if (str.indexOf('usb') >= 0) {
|
|
158
|
+
result = 'USB';
|
|
159
|
+
}
|
|
160
|
+
if (str.indexOf('pci') >= 0) {
|
|
161
|
+
result = 'PCIe';
|
|
162
|
+
}
|
|
108
163
|
|
|
109
164
|
return result;
|
|
110
165
|
}
|
|
@@ -130,7 +185,7 @@ function parseDarwinAudio(audioObject, id) {
|
|
|
130
185
|
|
|
131
186
|
function parseWindowsAudio(lines) {
|
|
132
187
|
const result = {};
|
|
133
|
-
const status = util.getValue(lines, 'StatusInfo', ':');
|
|
188
|
+
const status = parseWinAudioStatus(util.getValue(lines, 'StatusInfo', ':'));
|
|
134
189
|
|
|
135
190
|
result.id = util.getValue(lines, 'DeviceID', ':'); // PNPDeviceID??
|
|
136
191
|
result.name = util.getValue(lines, 'name', ':');
|
|
@@ -148,18 +203,17 @@ function parseWindowsAudio(lines) {
|
|
|
148
203
|
}
|
|
149
204
|
|
|
150
205
|
function audio(callback) {
|
|
151
|
-
|
|
152
206
|
return new Promise((resolve) => {
|
|
153
207
|
process.nextTick(() => {
|
|
154
|
-
|
|
208
|
+
const result = [];
|
|
155
209
|
if (_linux || _freebsd || _openbsd || _netbsd) {
|
|
156
|
-
|
|
157
|
-
exec(cmd,
|
|
210
|
+
const cmd = 'lspci -vmm 2>/dev/null';
|
|
211
|
+
exec(cmd, (error, stdout) => {
|
|
158
212
|
// PCI
|
|
159
213
|
if (!error) {
|
|
160
214
|
const audioPCI = getLinuxAudioPci();
|
|
161
215
|
const parts = stdout.toString().split('\n\n');
|
|
162
|
-
parts.forEach(element => {
|
|
216
|
+
parts.forEach((element) => {
|
|
163
217
|
const lines = element.split('\n');
|
|
164
218
|
if (util.getValue(lines, 'class', ':', true).toLowerCase().indexOf('audio') >= 0) {
|
|
165
219
|
const audio = parseLinuxAudioPciMM(lines, audioPCI);
|
|
@@ -174,8 +228,8 @@ function audio(callback) {
|
|
|
174
228
|
});
|
|
175
229
|
}
|
|
176
230
|
if (_darwin) {
|
|
177
|
-
|
|
178
|
-
exec(cmd,
|
|
231
|
+
const cmd = 'system_profiler SPAudioDataType -json';
|
|
232
|
+
exec(cmd, (error, stdout) => {
|
|
179
233
|
if (!error) {
|
|
180
234
|
try {
|
|
181
235
|
const outObj = JSON.parse(stdout.toString());
|
|
@@ -199,7 +253,7 @@ function audio(callback) {
|
|
|
199
253
|
util.powerShell('Get-CimInstance Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl').then((stdout, error) => {
|
|
200
254
|
if (!error) {
|
|
201
255
|
const parts = stdout.toString().split(/\n\s*\n/);
|
|
202
|
-
parts.forEach(element => {
|
|
256
|
+
parts.forEach((element) => {
|
|
203
257
|
const lines = element.split('\n');
|
|
204
258
|
if (util.getValue(lines, 'name', ':')) {
|
|
205
259
|
result.push(parseWindowsAudio(lines));
|
package/lib/battery.js
CHANGED
|
@@ -43,7 +43,7 @@ function parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity) {
|
|
|
43
43
|
// 10 = "Undefined"
|
|
44
44
|
// 11 = "Partially Charged"
|
|
45
45
|
if (status >= 0) {
|
|
46
|
-
const statusValue = status
|
|
46
|
+
const statusValue = status;
|
|
47
47
|
result.status = statusValue;
|
|
48
48
|
result.hasBattery = true;
|
|
49
49
|
result.maxCapacity = fullChargeCapacity || parseInt(util.getValue(lines, 'DesignCapacity', ':') || 0);
|
package/lib/filesystem.js
CHANGED
|
@@ -101,7 +101,7 @@ function fsSize(drive, callback) {
|
|
|
101
101
|
const rw = osMounts && Object.keys(osMounts).length > 0 ? osMounts[fs] || false : null;
|
|
102
102
|
line.splice(0, _linux || _freebsd || _openbsd || _netbsd ? 6 : 5);
|
|
103
103
|
const mount = line.join(' ');
|
|
104
|
-
if (!data.find((el) => el.fs === fs && el.type === fsType)) {
|
|
104
|
+
if (!data.find((el) => el.fs === fs && el.type === fsType && el.mount === mount)) {
|
|
105
105
|
data.push({
|
|
106
106
|
fs,
|
|
107
107
|
type: fsType,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.28.
|
|
3
|
+
"version": "5.28.9",
|
|
4
4
|
"description": "Advanced, lightweight system and OS information library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",
|