Skip to content

Commit

Permalink
sfdp: Added some more logging output for when the basic parameter tab…
Browse files Browse the repository at this point in the history
…le validation fires and has to correct the data
  • Loading branch information
dragonmux committed Dec 7, 2023
1 parent 63a9e9e commit 73977b8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sfdp.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,18 @@ namespace bmpflash::sfdp
if (actualLength == expectedLength)
return;

console.warn("Found mismatched basic parameters table length, got "sv, actualLength, ", expected "sv,
expectedLength);
// If the table is longer than it should be for the stated version, truncate it
if (actualLength > expectedLength)
{
console.warn("Adjusting table length to correct"sv);
tableLengthInU32s = static_cast<uint8_t>(expectedLength / 4U);
}
// Otherwise fix the version number to match the one for the actual length
else
{
console.warn("Adjusting table version number to correct"sv);
// 24 uint32_t's -> v1.8
if (expectedLength == 96U)
{
Expand Down

0 comments on commit 73977b8

Please sign in to comment.