systeminformation 5.33.4 → 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/README.md +2 -1
- package/lib/audio.js +56 -3
- package/lib/osinfo.js +1 -0
- package/lib/util.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -84,8 +84,9 @@ If you want to run the whole test locally on your machines (without writing any
|
|
|
84
84
|
git clone -b v6 https://github.com/sebhildebrandt/systeminformation.git
|
|
85
85
|
cd systeminformation
|
|
86
86
|
|
|
87
|
-
# install dev dependencies
|
|
87
|
+
# install dev dependencies and build
|
|
88
88
|
npm ci
|
|
89
|
+
npm run build
|
|
89
90
|
|
|
90
91
|
# run tests
|
|
91
92
|
npm run ci # for the whole test run
|
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/lib/osinfo.js
CHANGED
|
@@ -336,6 +336,7 @@ function osInfo(callback) {
|
|
|
336
336
|
result.codename = result.release.startsWith('14.') ? 'Sonoma' : result.codename;
|
|
337
337
|
result.codename = result.release.startsWith('15.') ? 'Sequoia' : result.codename;
|
|
338
338
|
result.codename = result.release.startsWith('26.') ? 'Tahoe' : result.codename;
|
|
339
|
+
result.codename = result.release.startsWith('27.') ? 'Golden Gate' : result.codename;
|
|
339
340
|
result.uefi = true;
|
|
340
341
|
result.codepage = util.getCodepage();
|
|
341
342
|
if (callback) {
|
package/lib/util.js
CHANGED
|
@@ -202,7 +202,14 @@ function parseTime(t, pmDesignator) {
|
|
|
202
202
|
parts[1] += parts[2];
|
|
203
203
|
}
|
|
204
204
|
const p1 = (parts[1] || '').toLowerCase();
|
|
205
|
-
let isPM =
|
|
205
|
+
let isPM =
|
|
206
|
+
p1.indexOf('pm') > -1 ||
|
|
207
|
+
p1.indexOf('p.m.') > -1 ||
|
|
208
|
+
p1.indexOf('p. m.') > -1 ||
|
|
209
|
+
p1.indexOf('n') > -1 ||
|
|
210
|
+
p1.indexOf('ch') > -1 ||
|
|
211
|
+
p1.indexOf('ös') > -1 ||
|
|
212
|
+
(pmDesignator && p1.indexOf(pmDesignator) > -1);
|
|
206
213
|
hour = parseInt(parts[0], 10);
|
|
207
214
|
min = parseInt(parts[1], 10);
|
|
208
215
|
hour = isPM && hour < 12 ? hour + 12 : hour;
|
|
@@ -1430,6 +1437,8 @@ function semverCompare(v1, v2) {
|
|
|
1430
1437
|
return res;
|
|
1431
1438
|
}
|
|
1432
1439
|
|
|
1440
|
+
// Mac model name and serial number / model identifier
|
|
1441
|
+
|
|
1433
1442
|
function getAppleModel(key) {
|
|
1434
1443
|
const appleModelIds = [
|
|
1435
1444
|
{
|
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)",
|