diff options
author | Simon Rettberg | 2023-08-02 18:29:57 +0200 |
---|---|---|
committer | Simon Rettberg | 2023-08-02 18:29:57 +0200 |
commit | 89a2209a989093da415dffa4fa4812d4e2180631 (patch) | |
tree | 159410ec52f6ac3151f4f649155957d5ff43a5f7 /modules-available/statistics/inc | |
parent | [serversetup-bwlp-ipxe] Rewording, add "new tab" icon to links (diff) | |
download | slx-admin-89a2209a989093da415dffa4fa4812d4e2180631.tar.gz slx-admin-89a2209a989093da415dffa4fa4812d4e2180631.tar.xz slx-admin-89a2209a989093da415dffa4fa4812d4e2180631.zip |
[statistics] Support yet another weird JEDEC encoding
Diffstat (limited to 'modules-available/statistics/inc')
-rw-r--r-- | modules-available/statistics/inc/hardwareparser.inc.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/modules-available/statistics/inc/hardwareparser.inc.php b/modules-available/statistics/inc/hardwareparser.inc.php index 83a0d752..9964159f 100644 --- a/modules-available/statistics/inc/hardwareparser.inc.php +++ b/modules-available/statistics/inc/hardwareparser.inc.php @@ -61,13 +61,21 @@ class HardwareParser if ($id !== null) return $id; } - } elseif (preg_match('/Unknown.{0,16}[\[(](?:0x)?([0-9a-fA-F]{2,4})[\])]/', $string, $out)) { + } elseif (preg_match('/Unknown.{0,16}[\[(](?:0x)?([0-9a-fA-F]{2,4})[\])]/', $string, $out) + || (preg_match('/^([0-9A-F]{4})([0-9A-F]{4})([0-9A-F]{4})$/', $string, $out) && $out[1] === $out[3])) { // 16bit encoding from DDR3+: lower byte is number of 0x7f bytes, upper byte is id within bank $id = hexdec($out[1]); // Our bank counting starts at one. Also ignore parity bit. - $bank = ($id & 0x7f) + 1; + $bank = ($id & 0x7f); // Shift down id, get rid of parity bit $id = ($id >> 8) & 0x7f; + if (count($out) === 4) { + // Observed second case, on OptiPlex 5050, is 80AD000080AD, but here endianness is reversed + $tmp = $id; + $id = $bank; + $bank = $tmp; + } + $bank++; $id = self::lookupJedec($bank, $id); if ($id !== null) return $id; |