graphics() XML parser improvement (macOS)

This commit is contained in:
Sebastian Hildebrandt 2021-09-15 08:50:14 +02:00
parent 09775cd5bd
commit 17e4b7e70d
6 changed files with 121 additions and 15 deletions

View File

@ -77,6 +77,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.9.0 | 2021-09-15 | `graphics()` new XML parser, added properties (macOS) |
| 5.8.9 | 2021-09-13 | `battery()` fix linux |
| 5.8.8 | 2021-09-11 | `wifiConnections()`, `wifiInterfaces()`, `wifiNetworks()` fix windows |
| 5.8.7 | 2021-09-01 | `processes()` fix alpine linux |

View File

@ -95,14 +95,13 @@ si.cpu()
.catch(error => console.error(error));
```
**Callback, Promises, Async / Await**
## News and Changes
### Latest Activity
(last 7 major and minor version releases)
- Version 5.9.0: `graphics()` added properties (macOS)
- Version 5.8.0: `disksIO()` added waitTime, waitPercent (linux)
- Version 5.7.0: `diskLayout()` added S.M.A.R.T for Windows (if installed)
- Version 5.6.0: `cpuTemperature()` added added socket and chipset temp (linux)

View File

@ -86,16 +86,6 @@
<td></td>
<td>graphics controllers array</td>
</tr>
<tr>
<td></td>
<td>...[0].model</td>
<td>X</td>
<td></td>
<td>X</td>
<td>X</td>
<td></td>
<td>graphics controller model</td>
</tr>
<tr>
<td></td>
<td>...[0].vendor</td>
@ -106,6 +96,16 @@
<td></td>
<td>e.g. ATI</td>
</tr>
<tr>
<td></td>
<td>...[0].model</td>
<td>X</td>
<td></td>
<td>X</td>
<td>X</td>
<td></td>
<td>graphics controller model</td>
</tr>
<tr>
<td></td>
<td>...[0].bus</td>
@ -136,6 +136,56 @@
<td></td>
<td>true if dynamicly allocated ram</td>
</tr>
<tr>
<td></td>
<td>...[0].deviceId</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td></td>
<td>device ID (macOS only)</td>
</tr>
<tr>
<td></td>
<td>...[0].vendorId</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td></td>
<td>vendor ID (macOS only)</td>
</tr>
<tr>
<td></td>
<td>...[0].external</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td></td>
<td>is external GPU (macOS only)</td>
</tr>
<tr>
<td></td>
<td>...[0].cores</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td></td>
<td>GPU cores (Apple silicon only)</td>
</tr>
<tr>
<td></td>
<td>...[0].metalVersion</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td></td>
<td>Metal Version (macOS only)</td>
</tr>
<tr>
<td></td>
<td>...[0].subDeviceId</td>
@ -316,6 +366,16 @@
<td></td>
<td>monitor/display vendor</td>
</tr>
<tr>
<td></td>
<td>...[0].vendorId</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td></td>
<td>monitor/display vendor ID (macOS only)</td>
</tr>
<tr>
<td></td>
<td>...[0].deviceName</td>
@ -336,6 +396,36 @@
<td></td>
<td>monitor/display model</td>
</tr>
<tr>
<td></td>
<td>...[0].productionYear</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td></td>
<td>production year (macOS only)</td>
</tr>
<tr>
<td></td>
<td>...[0].serial</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td></td>
<td>serial number (macOS only)</td>
</tr>
<tr>
<td></td>
<td>...[0].displayId</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td></td>
<td>disoplay ID (macOS only)</td>
</tr>
<tr>
<td></td>
<td>...[0].main</td>

View File

@ -56,6 +56,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.9.0</th>
<td>2021-09-15</td>
<td><span class="code">graphics()</span> macOS new XML parser, extended properties</td>
</tr>
<tr>
<th scope="row">5.8.9</th>
<td>2021-09-13</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.8.9</span></div>
<div class="version">New Version: <span id="version">5.9.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>
</div>
<div class="down">
@ -203,7 +203,7 @@
</div>
<div class="row number-section">
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">14,587</div>
<div class="numbers">14,629</div>
<div class="title">Lines of code</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">

View File

@ -103,6 +103,17 @@ function getVendorFromId(id) {
return vendors[id] || '';
}
function vendorToId(str) {
let result = '';
str = (str || '').toLowerCase();
if (str.indexOf('apple') >= 0) { result = '0x05ac'; }
else if (str.indexOf('nvidia') >= 0) { result = '0x10de'; }
else if (str.indexOf('intel') >= 0) { result = '0x8086'; }
else if (str.indexOf('ati') >= 0 || str.indexOf('amd') >= 0) { result = '0x1002'; }
return result;
}
function getMetalVersion(id) {
const families = {
'spdisplays_mtlgpufamilymac1': 'mac1',
@ -139,7 +150,7 @@ function graphics(callback) {
vramDynamic: bus === 'Built-In',
vram: vram || vramDyn || 0,
deviceId: item['spdisplays_device-id'] || '',
vendorId: item['spdisplays_vendor-id'] || '',
vendorId: item['spdisplays_vendor-id'] || vendorToId((item['spdisplays_vendor'] || '') + (item.sppci_model || '')),
external: (item.sppci_device_type === 'spdisplays_egpu'),
cores: item['sppci_cores'] || null,
metalVersion