getStatic() added audio, usb, bluetooth, printer

This commit is contained in:
Sebastian Hildebrandt 2025-05-21 19:49:07 +02:00
parent ddced76f65
commit bab2758476
6 changed files with 39 additions and 15 deletions

View File

@ -90,6 +90,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment | | Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- | | ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.26.0 | 2025-05-21 | `getStatic()` added audio, usb, bluetooth, printer |
| 5.25.11 | 2025-01-11 | `docs` updated | | 5.25.11 | 2025-01-11 | `docs` updated |
| 5.25.10 | 2025-01-10 | `graphics()` improvement Raspberry Ubuntu | | 5.25.10 | 2025-01-10 | `graphics()` improvement Raspberry Ubuntu |
| 5.25.9 | 2025-01-10 | `memLayout()` improvement Raspberry PI 5 | | 5.25.9 | 2025-01-10 | `memLayout()` improvement Raspberry PI 5 |

View File

@ -163,6 +163,7 @@ si.cpu()
(last 7 major and minor version releases) (last 7 major and minor version releases)
- Version 5.26.0: `getStatic()`, `getAll()` added usb, audio, bluetooth, printer
- Version 5.25.0: `versions()` added homebrew - Version 5.25.0: `versions()` added homebrew
- Version 5.24.0: `versions()` added bun and deno - Version 5.24.0: `versions()` added bun and deno
- Version 5.23.0: `usb()` added serial number (linux) - Version 5.23.0: `usb()` added serial number (linux)

View File

@ -57,6 +57,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">5.26.0</th>
<td>2024-05-21</td>
<td><span class="code">getStatic()</span> added audio, usb, bluetooth, printer</td>
</tr>
<tr> <tr>
<th scope="row">5.25.11</th> <th scope="row">5.25.11</th>
<td>2024-01-11</td> <td>2024-01-11</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo"> <img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div> <div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div> <div class="subtitle"><span id="typed"></span>&nbsp;</div>
3<div class="version">New Version: <span id="version">5.25.11</span></div> 3<div class="version">New Version: <span id="version">5.26.0</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> <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>
<div class="down"> <div class="down">

View File

@ -994,7 +994,7 @@ function getCpuCurrentSpeedSync() {
let cores = []; let cores = [];
let speeds = []; let speeds = [];
if (cpus && cpus.length && cpus[0].speed) { if (cpus && cpus.length && cpus[0].hasOwnProperty('speed')) {
for (let i in cpus) { for (let i in cpus) {
speeds.push(cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10); speeds.push(cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10);
} }
@ -1010,19 +1010,28 @@ function getCpuCurrentSpeedSync() {
} }
if (speeds && speeds.length) { if (speeds && speeds.length) {
for (let i in speeds) { try {
avgFreq = avgFreq + speeds[i]; for (let i in speeds) {
if (speeds[i] > maxFreq) { maxFreq = speeds[i]; } avgFreq = avgFreq + speeds[i];
if (speeds[i] < minFreq) { minFreq = speeds[i]; } if (speeds[i] > maxFreq) { maxFreq = speeds[i]; }
cores.push(parseFloat(speeds[i].toFixed(2))); if (speeds[i] < minFreq) { minFreq = speeds[i]; }
cores.push(parseFloat(speeds[i].toFixed(2)));
}
avgFreq = avgFreq / speeds.length;
return {
min: parseFloat(minFreq.toFixed(2)),
max: parseFloat(maxFreq.toFixed(2)),
avg: parseFloat((avgFreq).toFixed(2)),
cores: cores
};
} catch (e) {
return {
min: 0,
max: 0,
avg: 0,
cores: cores
};
} }
avgFreq = avgFreq / speeds.length;
return {
min: parseFloat(minFreq.toFixed(2)),
max: parseFloat(maxFreq.toFixed(2)),
avg: parseFloat((avgFreq).toFixed(2)),
cores: cores
};
} else { } else {
return { return {
min: 0, min: 0,

View File

@ -95,7 +95,11 @@ function getStaticData(callback) {
graphics.graphics(), graphics.graphics(),
network.networkInterfaces(), network.networkInterfaces(),
memory.memLayout(), memory.memLayout(),
filesystem.diskLayout() filesystem.diskLayout(),
audio.audio(),
bluetooth.bluetoothDevices(),
usb.usb(),
printer.printer(),
]).then((res) => { ]).then((res) => {
data.system = res[0]; data.system = res[0];
data.bios = res[1]; data.bios = res[1];
@ -110,6 +114,10 @@ function getStaticData(callback) {
data.net = res[10]; data.net = res[10];
data.memLayout = res[11]; data.memLayout = res[11];
data.diskLayout = res[12]; data.diskLayout = res[12];
data.audio = res[13];
data.bluetooth = res[14];
data.usb = res[15];
data.printer = res[16];
if (callback) { callback(data); } if (callback) { callback(data); }
resolve(data); resolve(data);
}); });