systeminformation 5.33.5 → 5.33.7
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/README.md +1 -1
- package/lib/audio.js +62 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ lines of code, > 750 versions published, up to 50 mio downloads per month, > 700
|
|
|
35
35
|
mio downloads overall. Top 5 NPM ranking for backend packages. Thank you to all
|
|
36
36
|
who contributed to this project!
|
|
37
37
|
|
|
38
|
-
> **Version 6** beta just released ⭐️⭐️⭐️
|
|
38
|
+
> ### **Version 6** beta just released ⭐️⭐️⭐️
|
|
39
39
|
>
|
|
40
40
|
> 🏆🏆🏆 We're proud to have just released the first beta of the new version 6 of systeminformation.
|
|
41
41
|
> Version 6 of this package (written completely in TypeScript) is
|
package/lib/audio.js
CHANGED
|
@@ -55,7 +55,7 @@ function parseAudioType(str, input, output) {
|
|
|
55
55
|
if (str.indexOf('mikr') >= 0) {
|
|
56
56
|
result = 'Microphone';
|
|
57
57
|
}
|
|
58
|
-
if (str.indexOf('phone') >= 0) {
|
|
58
|
+
if (str.indexOf('phone') >= 0 && str.indexOf('headphone') < 0) {
|
|
59
59
|
result = 'Phone';
|
|
60
60
|
}
|
|
61
61
|
if (str.indexOf('controll') >= 0) {
|
|
@@ -102,6 +102,51 @@ function getLinuxAudioPci() {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
// ARM boards (e.g. Raspberry Pi) have no PCI bus at all - ALSA lists the sound cards instead (#545)
|
|
106
|
+
function parseLinuxAudioAlsa(stdout) {
|
|
107
|
+
const result = [];
|
|
108
|
+
const parts = stdout.split('--pcm--');
|
|
109
|
+
const cards = parts[0] || '';
|
|
110
|
+
const pcms = parts[1] || '';
|
|
111
|
+
const lines = cards.split('\n');
|
|
112
|
+
lines.forEach((line, i) => {
|
|
113
|
+
// ' 1 [Device ]: USB-Audio - USB Audio Device'
|
|
114
|
+
const card = line.match(/^\s*(\d+)\s+\[(.+?)\s*\]:\s*(.*)$/);
|
|
115
|
+
if (card && card[3].trim()) {
|
|
116
|
+
const index = card[1];
|
|
117
|
+
// some drivers (e.g. bcm2835) print an unterminated driver string, gluing the name to it
|
|
118
|
+
const sep = card[3].lastIndexOf(' - ');
|
|
119
|
+
const name = (sep >= 0 ? card[3].substring(sep + 3) : card[3]).trim();
|
|
120
|
+
let driver = (sep >= 0 ? card[3].substring(0, sep) : '').trim();
|
|
121
|
+
if (name && driver.endsWith(name)) {
|
|
122
|
+
driver = driver.substring(0, driver.length - name.length).trim();
|
|
123
|
+
}
|
|
124
|
+
// second line holds the long name, which is prefixed with the manufacturer on USB devices
|
|
125
|
+
const longName = (lines[i + 1] || '').trim();
|
|
126
|
+
const manufacturer = longName.indexOf(name) > 0 ? longName.substring(0, longName.indexOf(name)).trim() : '';
|
|
127
|
+
const devices = pcms.split('\n').filter((pcm) => pcm.indexOf('/card' + index + '/pcm') >= 0);
|
|
128
|
+
const out = devices.some((pcm) => pcm.trim().endsWith('p'));
|
|
129
|
+
const isIn = devices.some((pcm) => pcm.trim().endsWith('c'));
|
|
130
|
+
const usb = (driver + ' ' + longName).toLowerCase().indexOf('usb') >= 0;
|
|
131
|
+
const hdmi = (card[2] + ' ' + name).toLowerCase().indexOf('hdmi') >= 0;
|
|
132
|
+
result.push({
|
|
133
|
+
id: 'hw:' + index,
|
|
134
|
+
name,
|
|
135
|
+
manufacturer,
|
|
136
|
+
revision: null,
|
|
137
|
+
driver,
|
|
138
|
+
default: null,
|
|
139
|
+
channel: usb ? 'USB' : hdmi ? 'HDMI' : 'Onboard',
|
|
140
|
+
type: parseAudioType(name, isIn, out),
|
|
141
|
+
in: devices.length ? isIn : null,
|
|
142
|
+
out: devices.length ? out : null,
|
|
143
|
+
status: 'online'
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
|
|
105
150
|
function parseWinAudioStatus(n) {
|
|
106
151
|
const num = parseInt(n, 10);
|
|
107
152
|
let status = n;
|
|
@@ -222,10 +267,23 @@ function audio(callback) {
|
|
|
222
267
|
}
|
|
223
268
|
});
|
|
224
269
|
}
|
|
225
|
-
if (
|
|
226
|
-
|
|
270
|
+
if (!result.length) {
|
|
271
|
+
const cmdAlsa = 'cat /proc/asound/cards 2>/dev/null; echo "--pcm--"; ls -d /proc/asound/card*/pcm* 2>/dev/null';
|
|
272
|
+
exec(cmdAlsa, util.execOptsLinux, (error, stdout) => {
|
|
273
|
+
if (!error) {
|
|
274
|
+
parseLinuxAudioAlsa(stdout.toString()).forEach((item) => result.push(item));
|
|
275
|
+
}
|
|
276
|
+
if (callback) {
|
|
277
|
+
callback(result);
|
|
278
|
+
}
|
|
279
|
+
resolve(result);
|
|
280
|
+
});
|
|
281
|
+
} else {
|
|
282
|
+
if (callback) {
|
|
283
|
+
callback(result);
|
|
284
|
+
}
|
|
285
|
+
resolve(result);
|
|
227
286
|
}
|
|
228
|
-
resolve(result);
|
|
229
287
|
});
|
|
230
288
|
}
|
|
231
289
|
if (_darwin) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.33.
|
|
3
|
+
"version": "5.33.7",
|
|
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)",
|