fsSize() fix df parsing missing mount points (linux)

This commit is contained in:
Sebastian Hildebrandt 2026-01-02 07:13:27 +01:00
parent 85f61fa2cf
commit 1b7c8e4db2
4 changed files with 102 additions and 42 deletions

View File

@ -90,7 +90,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.28.8 | 2026-01-01 | `bluetooth()` `battery()` improved enomeration (windows) |
| 5.28.0 | 2026-01-02 | `fsSize()` fix df parsing missing mount points (linux) |
| 5.28.8 | 2026-01-01 | `bluetooth()` `battery()` improved enumeration (windows) |
| 5.28.7 | 2026-12-31 | `networkInterfaces()` fix wireless speed (linux) |
| 5.28.6 | 2025-12-31 | `npx systeminformation` improved output |
| 5.28.5 | 2025-12-30 | `cpuCurrentSpeed()` fix cpu loop issue |

View File

@ -57,10 +57,15 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.28.9</th>
<td>2026-01-02</td>
<td><span class="code">fsSize()</span> fix df parsing missing mount points (linux)</td>
</tr>
<tr>
<th scope="row">5.28.8</th>
<td>2026-01-01</td>
<td><span class="code">bluetooth()</span> <span class="code">battery()</span> imprved enomeration (windows)</td>
<td><span class="code">bluetooth()</span> <span class="code">battery()</span> improved enumeration (windows)</td>
</tr>
<tr>
<th scope="row">5.28.7</th>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.28.8</span></div>
<div class="version">New Version: <span id="version">5.28.9</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -19,32 +19,60 @@ const util = require('./util');
let _platform = process.platform;
const _linux = (_platform === 'linux' || _platform === 'android');
const _darwin = (_platform === 'darwin');
const _windows = (_platform === 'win32');
const _freebsd = (_platform === 'freebsd');
const _openbsd = (_platform === 'openbsd');
const _netbsd = (_platform === 'netbsd');
const _sunos = (_platform === 'sunos');
const _linux = _platform === 'linux' || _platform === 'android';
const _darwin = _platform === 'darwin';
const _windows = _platform === 'win32';
const _freebsd = _platform === 'freebsd';
const _openbsd = _platform === 'openbsd';
const _netbsd = _platform === 'netbsd';
const _sunos = _platform === 'sunos';
function parseAudioType(str, input, output) {
str = str.toLowerCase();
let result = '';
if (str.indexOf('input') >= 0) { result = 'Microphone'; }
if (str.indexOf('display audio') >= 0) { result = 'Speaker'; }
if (str.indexOf('speak') >= 0) { result = 'Speaker'; }
if (str.indexOf('laut') >= 0) { result = 'Speaker'; }
if (str.indexOf('loud') >= 0) { result = 'Speaker'; }
if (str.indexOf('head') >= 0) { result = 'Headset'; }
if (str.indexOf('mic') >= 0) { result = 'Microphone'; }
if (str.indexOf('mikr') >= 0) { result = 'Microphone'; }
if (str.indexOf('phone') >= 0) { result = 'Phone'; }
if (str.indexOf('controll') >= 0) { result = 'Controller'; }
if (str.indexOf('line o') >= 0) { result = 'Line Out'; }
if (str.indexOf('digital o') >= 0) { result = 'Digital Out'; }
if (str.indexOf('smart sound technology') >= 0) { result = 'Digital Signal Processor'; }
if (str.indexOf('high definition audio') >= 0) { result = 'Sound Driver'; }
if (str.indexOf('input') >= 0) {
result = 'Microphone';
}
if (str.indexOf('display audio') >= 0) {
result = 'Speaker';
}
if (str.indexOf('speak') >= 0) {
result = 'Speaker';
}
if (str.indexOf('laut') >= 0) {
result = 'Speaker';
}
if (str.indexOf('loud') >= 0) {
result = 'Speaker';
}
if (str.indexOf('head') >= 0) {
result = 'Headset';
}
if (str.indexOf('mic') >= 0) {
result = 'Microphone';
}
if (str.indexOf('mikr') >= 0) {
result = 'Microphone';
}
if (str.indexOf('phone') >= 0) {
result = 'Phone';
}
if (str.indexOf('controll') >= 0) {
result = 'Controller';
}
if (str.indexOf('line o') >= 0) {
result = 'Line Out';
}
if (str.indexOf('digital o') >= 0) {
result = 'Digital Out';
}
if (str.indexOf('smart sound technology') >= 0) {
result = 'Digital Signal Processor';
}
if (str.indexOf('high definition audio') >= 0) {
result = 'Sound Driver';
}
if (!result && output) {
result = 'Speaker';
@ -54,13 +82,12 @@ function parseAudioType(str, input, output) {
return result;
}
function getLinuxAudioPci() {
let cmd = 'lspci -v 2>/dev/null';
let result = [];
try {
const parts = execSync(cmd, util.execOptsLinux).toString().split('\n\n');
parts.forEach(element => {
parts.forEach((element) => {
const lines = element.split('\n');
if (lines && lines.length && lines[0].toLowerCase().indexOf('audio') >= 0) {
const audio = {};
@ -75,11 +102,27 @@ function getLinuxAudioPci() {
}
}
function parseWinAudioStatus(n) {
let status = n;
if (n === 1) {
status = 'other';
} else if (n === 2) {
status = 'unknown';
} else if (n === 3) {
status = 'enabled';
} else if (n === 4) {
status = 'disabled';
} else if (n === 5) {
status = 'not applicable';
}
return status;
}
function parseLinuxAudioPciMM(lines, audioPCI) {
const result = {};
const slotId = util.getValue(lines, 'Slot');
const pciMatch = audioPCI.filter(function (item) { return item.slotId === slotId; });
const pciMatch = audioPCI.filter((item) => item.slotId === slotId);
result.id = slotId;
result.name = util.getValue(lines, 'SDevice');
@ -99,12 +142,24 @@ function parseLinuxAudioPciMM(lines, audioPCI) {
function parseDarwinChannel(str) {
let result = '';
if (str.indexOf('builtin') >= 0) { result = 'Built-In'; }
if (str.indexOf('extern') >= 0) { result = 'Audio-Jack'; }
if (str.indexOf('hdmi') >= 0) { result = 'HDMI'; }
if (str.indexOf('displayport') >= 0) { result = 'Display-Port'; }
if (str.indexOf('usb') >= 0) { result = 'USB'; }
if (str.indexOf('pci') >= 0) { result = 'PCIe'; }
if (str.indexOf('builtin') >= 0) {
result = 'Built-In';
}
if (str.indexOf('extern') >= 0) {
result = 'Audio-Jack';
}
if (str.indexOf('hdmi') >= 0) {
result = 'HDMI';
}
if (str.indexOf('displayport') >= 0) {
result = 'Display-Port';
}
if (str.indexOf('usb') >= 0) {
result = 'USB';
}
if (str.indexOf('pci') >= 0) {
result = 'PCIe';
}
return result;
}
@ -130,7 +185,7 @@ function parseDarwinAudio(audioObject, id) {
function parseWindowsAudio(lines) {
const result = {};
const status = util.getValue(lines, 'StatusInfo', ':');
const status = parseWinAudioStatus(util.getValue(lines, 'StatusInfo', ':'));
result.id = util.getValue(lines, 'DeviceID', ':'); // PNPDeviceID??
result.name = util.getValue(lines, 'name', ':');
@ -148,18 +203,17 @@ function parseWindowsAudio(lines) {
}
function audio(callback) {
return new Promise((resolve) => {
process.nextTick(() => {
let result = [];
const result = [];
if (_linux || _freebsd || _openbsd || _netbsd) {
let cmd = 'lspci -vmm 2>/dev/null';
exec(cmd, function (error, stdout) {
const cmd = 'lspci -vmm 2>/dev/null';
exec(cmd, (error, stdout) => {
// PCI
if (!error) {
const audioPCI = getLinuxAudioPci();
const parts = stdout.toString().split('\n\n');
parts.forEach(element => {
parts.forEach((element) => {
const lines = element.split('\n');
if (util.getValue(lines, 'class', ':', true).toLowerCase().indexOf('audio') >= 0) {
const audio = parseLinuxAudioPciMM(lines, audioPCI);
@ -174,8 +228,8 @@ function audio(callback) {
});
}
if (_darwin) {
let cmd = 'system_profiler SPAudioDataType -json';
exec(cmd, function (error, stdout) {
const cmd = 'system_profiler SPAudioDataType -json';
exec(cmd, (error, stdout) => {
if (!error) {
try {
const outObj = JSON.parse(stdout.toString());
@ -199,7 +253,7 @@ function audio(callback) {
util.powerShell('Get-CimInstance Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl').then((stdout, error) => {
if (!error) {
const parts = stdout.toString().split(/\n\s*\n/);
parts.forEach(element => {
parts.forEach((element) => {
const lines = element.split('\n');
if (util.getValue(lines, 'name', ':')) {
result.push(parseWindowsAudio(lines));