memLayout() improved parsing memory bank (windows)

This commit is contained in:
Sebastian Hildebrandt 2024-03-15 16:24:18 +01:00
parent b6e84beb5a
commit 356bb7a505
6 changed files with 29 additions and 21 deletions

View File

@ -83,7 +83,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.22.1 | 2024-03-14 | `chassis()` type, assetTag, sku improved parsing (macOS) |
| 5.22.3 | 2024-03-15 | `chassis()` improved parsing memory bank (windows) |
| 5.22.2 | 2024-03-14 | `chassis()` type, assetTag, sku improved parsing (macOS) |
| 5.22.1 | 2024-03-12 | `wifiConnections()` patch for mac OS Sonome 14.4 (macOS) |
| 5.22.0 | 2024-02-18 | `wifiConnections()` added signal quality attribute |
| 5.21.25 | 2024-02-17 | `wifiConnections()` fixed signal strength (windows) |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.22.3</th>
<td>2024-03-15</td>
<td><span class="code">memLayout()</span> improved parsing memory bank (windows)</td>
</tr>
<tr>
<th scope="row">5.22.2</th>
<td>2024-03-14</td>

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.22.2</span></div>
<div class="version">New Version: <span id="version">5.22.3</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

@ -530,7 +530,7 @@ function memLayout(callback) {
const FormFactors = 'Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA'.split('|');
try {
util.powerShell('Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage | fl').then((stdout, error) => {
util.powerShell('Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage,Tag | fl').then((stdout, error) => {
if (!error) {
let devices = stdout.toString().split(/\n\s*\n/);
devices.shift();
@ -539,10 +539,12 @@ function memLayout(callback) {
const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
const tag = util.getValue(lines, 'Tag', ':');
const tagInt = util.splitByNumber(tag);
if (size) {
result.push({
size,
bank: util.getValue(lines, 'BankLabel', ':'), // BankLabel
bank: util.getValue(lines, 'BankLabel', ':') + tagInt[1] ? ' / ' + tagInt[1] : '', // BankLabel
type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)],
ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0,

View File

@ -215,7 +215,7 @@ function system(callback) {
exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) {
if (!error) {
let lines = stdout.toString().replace(/[<>"]/g, '').split('\n');
const model = splitByNumber(util.getValue(lines, 'model', '=', true));
const model = util.splitByNumber(util.getValue(lines, 'model', '=', true));
const version = util.getValue(lines, 'version', '=', true);
result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
result.model = version ? util.getValue(lines, 'model', '=', true) : model[0];
@ -616,21 +616,6 @@ function macOsChassisType(model) {
return 'Other';
}
function splitByNumber(str) {
let numberStarted = false;
let num = '';
let cpart = '';
for (const c of str) {
if ((c >= '0' && c <= '9') || numberStarted) {
numberStarted = true;
num += c;
} else {
cpart += c;
}
}
return [cpart, num];
}
function chassis(callback) {
const chassisTypes = ['Other',
'Unknown',
@ -710,7 +695,7 @@ function chassis(callback) {
if (!error) {
let lines = stdout.toString().replace(/[<>"]/g, '').split('\n');
const model = util.getValue(lines, 'model', '=', true);
const modelParts = splitByNumber(model);
const modelParts = util.splitByNumber(model);
const version = util.getValue(lines, 'version', '=', true);
result.manufacturer = util.getValue(lines, 'manufacturer', '=', true);
result.model = version ? util.getValue(lines, 'model', '=', true) : modelParts[0];

View File

@ -63,6 +63,20 @@ function toInt(value) {
return result;
}
function splitByNumber(str) {
let numberStarted = false;
let num = '';
let cpart = '';
for (const c of str) {
if ((c >= '0' && c <= '9') || numberStarted) {
numberStarted = true;
num += c;
} else {
cpart += c;
}
}
return [cpart, num];
}
const stringReplace = new String().replace;
const stringToLower = new String().toLowerCase;
@ -1302,6 +1316,7 @@ function semverCompare(v1, v2) {
function noop() { }
exports.toInt = toInt;
exports.splitByNumber = splitByNumber;
exports.execOptsWin = execOptsWin;
exports.getCodepage = getCodepage;
exports.execWin = execWin;