systeminformation 5.33.5 → 5.33.6
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 +56 -3
- package/package.json +1 -1
package/lib/audio.js
CHANGED
|
@@ -102,6 +102,46 @@ 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*(\S+)\s+-\s+(.*)$/);
|
|
115
|
+
if (card) {
|
|
116
|
+
const index = card[1];
|
|
117
|
+
const driver = card[3];
|
|
118
|
+
const name = card[4].trim();
|
|
119
|
+
// second line holds the long name, which is prefixed with the manufacturer on USB devices
|
|
120
|
+
const longName = (lines[i + 1] || '').trim();
|
|
121
|
+
const manufacturer = longName.indexOf(name) > 0 ? longName.substring(0, longName.indexOf(name)).trim() : '';
|
|
122
|
+
const devices = pcms.split('\n').filter((pcm) => pcm.indexOf('/card' + index + '/pcm') >= 0);
|
|
123
|
+
const out = devices.some((pcm) => pcm.trim().endsWith('p'));
|
|
124
|
+
const isIn = devices.some((pcm) => pcm.trim().endsWith('c'));
|
|
125
|
+
const usb = (driver + ' ' + longName).toLowerCase().indexOf('usb') >= 0;
|
|
126
|
+
const hdmi = (card[2] + ' ' + name).toLowerCase().indexOf('hdmi') >= 0;
|
|
127
|
+
result.push({
|
|
128
|
+
id: 'hw:' + index,
|
|
129
|
+
name,
|
|
130
|
+
manufacturer,
|
|
131
|
+
revision: null,
|
|
132
|
+
driver,
|
|
133
|
+
default: null,
|
|
134
|
+
channel: usb ? 'USB' : hdmi ? 'HDMI' : 'Onboard',
|
|
135
|
+
type: parseAudioType(name, isIn, out),
|
|
136
|
+
in: devices.length ? isIn : null,
|
|
137
|
+
out: devices.length ? out : null,
|
|
138
|
+
status: 'online'
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
|
|
105
145
|
function parseWinAudioStatus(n) {
|
|
106
146
|
const num = parseInt(n, 10);
|
|
107
147
|
let status = n;
|
|
@@ -222,10 +262,23 @@ function audio(callback) {
|
|
|
222
262
|
}
|
|
223
263
|
});
|
|
224
264
|
}
|
|
225
|
-
if (
|
|
226
|
-
|
|
265
|
+
if (!result.length) {
|
|
266
|
+
const cmdAlsa = 'cat /proc/asound/cards 2>/dev/null; echo "--pcm--"; ls -d /proc/asound/card*/pcm* 2>/dev/null';
|
|
267
|
+
exec(cmdAlsa, util.execOptsLinux, (error, stdout) => {
|
|
268
|
+
if (!error) {
|
|
269
|
+
parseLinuxAudioAlsa(stdout.toString()).forEach((item) => result.push(item));
|
|
270
|
+
}
|
|
271
|
+
if (callback) {
|
|
272
|
+
callback(result);
|
|
273
|
+
}
|
|
274
|
+
resolve(result);
|
|
275
|
+
});
|
|
276
|
+
} else {
|
|
277
|
+
if (callback) {
|
|
278
|
+
callback(result);
|
|
279
|
+
}
|
|
280
|
+
resolve(result);
|
|
227
281
|
}
|
|
228
|
-
resolve(result);
|
|
229
282
|
});
|
|
230
283
|
}
|
|
231
284
|
if (_darwin) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.33.
|
|
3
|
+
"version": "5.33.6",
|
|
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)",
|