systeminformation 5.33.10 → 5.33.11
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/battery.js +32 -11
- package/lib/filesystem.js +2 -2
- package/lib/network.js +2 -0
- package/lib/osinfo.js +17 -3
- package/package.json +1 -1
package/lib/battery.js
CHANGED
|
@@ -29,7 +29,7 @@ const _sunos = _platform === 'sunos';
|
|
|
29
29
|
|
|
30
30
|
function parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity) {
|
|
31
31
|
const result = {};
|
|
32
|
-
|
|
32
|
+
const status = parseInt(util.getValue(lines, 'BatteryStatus', ':').trim(), 10) || 0;
|
|
33
33
|
// let status = util.getValue(lines, 'BatteryStatus', ':').trim();
|
|
34
34
|
// 1 = "Discharging"
|
|
35
35
|
// 2 = "On A/C"
|
|
@@ -111,7 +111,7 @@ module.exports = (callback) =>
|
|
|
111
111
|
if (battery_path) {
|
|
112
112
|
fs.readFile(battery_path + 'uevent', (error, stdout) => {
|
|
113
113
|
if (!error) {
|
|
114
|
-
|
|
114
|
+
const lines = stdout.toString().split('\n');
|
|
115
115
|
|
|
116
116
|
result.isCharging = util.getValue(lines, 'POWER_SUPPLY_STATUS', '=').toLowerCase() === 'charging';
|
|
117
117
|
result.acConnected = acConnected || result.isCharging;
|
|
@@ -176,7 +176,7 @@ module.exports = (callback) =>
|
|
|
176
176
|
}
|
|
177
177
|
if (_freebsd || _openbsd || _netbsd) {
|
|
178
178
|
exec('sysctl -i hw.acpi.battery hw.acpi.acline', (error, stdout) => {
|
|
179
|
-
|
|
179
|
+
const lines = stdout.toString().split('\n');
|
|
180
180
|
const batteries = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.units'), 10);
|
|
181
181
|
const percent = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.life'), 10);
|
|
182
182
|
result.hasBattery = batteries > 0;
|
|
@@ -196,24 +196,45 @@ module.exports = (callback) =>
|
|
|
196
196
|
|
|
197
197
|
if (_darwin) {
|
|
198
198
|
exec(
|
|
199
|
-
'ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|DeviceName|BatterySerialNumber|Serial|TimeRemaining|Voltage"; pmset -g batt | grep %',
|
|
199
|
+
'ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|DeviceName|BatterySerialNumber|Serial|TimeRemaining|Voltage|BatteryData|NominalChargeCapacity"; pmset -g batt | grep %',
|
|
200
200
|
(error, stdout) => {
|
|
201
201
|
if (stdout) {
|
|
202
|
-
|
|
202
|
+
const lines = stdout
|
|
203
|
+
.toString()
|
|
204
|
+
.replace(/^[ |]+/gm, '')
|
|
205
|
+
.replace(/ +/g, '')
|
|
206
|
+
.replace(/"+/g, '')
|
|
207
|
+
.replace(/-/g, '')
|
|
208
|
+
.split('\n');
|
|
209
|
+
const voltage = parseInt('0' + util.getValue(lines, 'voltage', '='), 10) / 1000.0;
|
|
210
|
+
const batteryData = util.getValue(lines, 'BatteryData', '=').replace(/^\{/, '').replace(/\}$/, '').split(',');
|
|
211
|
+
const maxCapacity = Math.round(
|
|
212
|
+
parseInt(
|
|
213
|
+
'0' +
|
|
214
|
+
(util.getValue(lines, 'AppleRawMaxCapacity', '=') ||
|
|
215
|
+
util.getValue(lines, 'NominalChargeCapacity', '=') ||
|
|
216
|
+
util.getValue(batteryData, 'FullChargeCapacity', '=') ||
|
|
217
|
+
util.getValue(batteryData, 'NominalChargeCapacity', '=')),
|
|
218
|
+
10
|
|
219
|
+
) * (voltage || 1)
|
|
220
|
+
);
|
|
221
|
+
const currentCapacity = Math.round(parseInt('0' + (util.getValue(lines, 'AppleRawCurrentCapacity', '=') || util.getValue(batteryData, 'RemainingCapacity', '=')), 10) * (voltage || 1));
|
|
222
|
+
const designedCapacity = Math.round(parseInt('0' + (util.getValue(lines, 'DesignCapacity', '=') || util.getValue(batteryData, 'DesignCapacity', '=')), 10) * (voltage || 1));
|
|
223
|
+
|
|
203
224
|
result.cycleCount = parseInt('0' + util.getValue(lines, 'cyclecount', '='), 10);
|
|
204
|
-
result.voltage =
|
|
225
|
+
result.voltage = voltage;
|
|
205
226
|
result.capacityUnit = result.voltage ? 'mWh' : 'mAh';
|
|
206
|
-
result.maxCapacity =
|
|
207
|
-
result.currentCapacity =
|
|
208
|
-
result.designedCapacity =
|
|
227
|
+
result.maxCapacity = maxCapacity;
|
|
228
|
+
result.currentCapacity = currentCapacity;
|
|
229
|
+
result.designedCapacity = designedCapacity;
|
|
209
230
|
result.manufacturer = 'Apple';
|
|
210
231
|
result.serial = util.getValue(lines, 'BatterySerialNumber', '=') || util.getValue(lines, 'Serial', '=');
|
|
211
232
|
result.model = util.getValue(lines, 'DeviceName', '=');
|
|
212
233
|
let percent = null;
|
|
213
234
|
const line = util.getValue(lines, 'internal', 'Battery');
|
|
214
|
-
|
|
235
|
+
const parts = line.split(';');
|
|
215
236
|
if (parts && parts[0]) {
|
|
216
|
-
|
|
237
|
+
const parts2 = parts[0].split('\t');
|
|
217
238
|
if (parts2 && parts2[1]) {
|
|
218
239
|
percent = parseFloat(parts2[1].trim().replace(/%/g, ''));
|
|
219
240
|
}
|
package/lib/filesystem.js
CHANGED
|
@@ -1433,7 +1433,7 @@ function diskLayout(callback) {
|
|
|
1433
1433
|
}
|
|
1434
1434
|
if (_darwin) {
|
|
1435
1435
|
let cmdFullSmart = '';
|
|
1436
|
-
exec(`system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType SPStorageDataType`, { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
1436
|
+
exec(`system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType SPUSBHostDataType SPStorageDataType`, { maxBuffer: 1024 * 1024 }, (error, stdout) => {
|
|
1437
1437
|
if (!error) {
|
|
1438
1438
|
// split by type:
|
|
1439
1439
|
const lines = stdout.toString().split('\n');
|
|
@@ -1572,7 +1572,7 @@ function diskLayout(callback) {
|
|
|
1572
1572
|
} catch {
|
|
1573
1573
|
util.noop();
|
|
1574
1574
|
}
|
|
1575
|
-
// USB Drives (
|
|
1575
|
+
// USB Drives (SPUSBDataType up to macOS 26, SPUSBHostDataType from macOS 27 on)
|
|
1576
1576
|
try {
|
|
1577
1577
|
const devices = linesUSB.join('\n').replace(/Media:\n /g, 'Model:').split('\n\n Product ID:');
|
|
1578
1578
|
devices.shift();
|
package/lib/network.js
CHANGED
package/lib/osinfo.js
CHANGED
|
@@ -1164,16 +1164,30 @@ function shell(callback) {
|
|
|
1164
1164
|
|
|
1165
1165
|
exports.shell = shell;
|
|
1166
1166
|
|
|
1167
|
+
// macOS 26+ and some hardened linux kernels mask MACs in getifaddrs()
|
|
1168
|
+
const MASKED_MACS = ['00:00:00:00:00:00', '02:00:00:00:00:00'];
|
|
1169
|
+
|
|
1167
1170
|
function getUniqueMacAdresses() {
|
|
1168
1171
|
let macs = [];
|
|
1169
1172
|
try {
|
|
1170
1173
|
const ifaces = os.networkInterfaces();
|
|
1174
|
+
let fallbackMacs = null;
|
|
1171
1175
|
for (let dev in ifaces) {
|
|
1172
1176
|
if ({}.hasOwnProperty.call(ifaces, dev)) {
|
|
1173
1177
|
ifaces[dev].forEach((details) => {
|
|
1174
|
-
if (details && details.mac
|
|
1175
|
-
|
|
1176
|
-
if (
|
|
1178
|
+
if (details && details.mac) {
|
|
1179
|
+
let mac = details.mac.toLowerCase();
|
|
1180
|
+
if (MASKED_MACS.indexOf(mac) >= 0) {
|
|
1181
|
+
if (fallbackMacs === null) {
|
|
1182
|
+
try {
|
|
1183
|
+
fallbackMacs = require('./network').getMacAddresses();
|
|
1184
|
+
} catch {
|
|
1185
|
+
fallbackMacs = {};
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
mac = (fallbackMacs[dev] || '').toLowerCase();
|
|
1189
|
+
}
|
|
1190
|
+
if (mac && MASKED_MACS.indexOf(mac) === -1 && macs.indexOf(mac) === -1) {
|
|
1177
1191
|
macs.push(mac);
|
|
1178
1192
|
}
|
|
1179
1193
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "systeminformation",
|
|
3
|
-
"version": "5.33.
|
|
3
|
+
"version": "5.33.11",
|
|
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)",
|