fix parsing and set dev version
This commit is contained in:
+2
-2
@@ -8,7 +8,7 @@
|
||||
#ifndef REHDD_H_
|
||||
#define REHDD_H_
|
||||
|
||||
#define REHDD_VERSION "V1.3.1"
|
||||
#define REHDD_VERSION "V1.4.0-dev"
|
||||
|
||||
// Drive handling Settings
|
||||
#define WORSE_HOURS 19200 // mark drive if at this limit or beyond
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
// Logger Settings
|
||||
#define LOG_PATH "./reHDD.log"
|
||||
#define DESCRIPTION "reHDD - Copyright Hendrik Schutter 2025"
|
||||
#define DESCRIPTION "reHDD - Copyright Hendrik Schutter 2026"
|
||||
#define DEVICE_ID "generic"
|
||||
#define SOFTWARE_VERSION REHDD_VERSION
|
||||
#define HARDWARE_VERSION "generic"
|
||||
|
||||
+15
-9
@@ -96,7 +96,8 @@ static uint64_t extractIntegerValue(const string &line)
|
||||
|
||||
// Remove whitespace, commas, braces
|
||||
valueStr.erase(remove_if(valueStr.begin(), valueStr.end(),
|
||||
[](char c) { return c == ' ' || c == ',' || c == '}' || c == '\n'; }),
|
||||
[](char c)
|
||||
{ return c == ' ' || c == ',' || c == '}' || c == '\n'; }),
|
||||
valueStr.end());
|
||||
|
||||
// Verify it's a valid number
|
||||
@@ -214,8 +215,9 @@ static void processLine(const string &line, SMARTParseContext &ctx)
|
||||
{
|
||||
ctx.state = SMARTParseContext::IN_RAW_SECTION;
|
||||
}
|
||||
// Look for end of attribute object
|
||||
else if (trimmed.find("},") == 0 || trimmed.find("}") == 0)
|
||||
// Look for end of attribute object (more indented closing brace = end of attribute)
|
||||
// " }," or " }" at attribute level (6 spaces)
|
||||
else if (line.find(" },") == 0 || line.find(" }") == 0)
|
||||
{
|
||||
ctx.state = SMARTParseContext::SEARCHING;
|
||||
ctx.currentAttributeId = 0;
|
||||
@@ -242,10 +244,15 @@ static void processLine(const string &line, SMARTParseContext &ctx)
|
||||
ctx.uncorrectableSectors = static_cast<uint32_t>(value);
|
||||
}
|
||||
|
||||
// Exit raw section after finding value
|
||||
ctx.state = (ctx.currentAttributeId == 5) ? SMARTParseContext::IN_ATTRIBUTE_5 :
|
||||
(ctx.currentAttributeId == 197) ? SMARTParseContext::IN_ATTRIBUTE_197 :
|
||||
SMARTParseContext::IN_ATTRIBUTE_198;
|
||||
// Stay in raw section - closing brace will exit
|
||||
}
|
||||
// Look for end of raw object (less indented = back to attribute level)
|
||||
// " }" at raw level (8 spaces)
|
||||
else if (line.find(" }") == 0)
|
||||
{
|
||||
// Return to attribute state (raw section closed)
|
||||
ctx.state = (ctx.currentAttributeId == 5) ? SMARTParseContext::IN_ATTRIBUTE_5 : (ctx.currentAttributeId == 197) ? SMARTParseContext::IN_ATTRIBUTE_197
|
||||
: SMARTParseContext::IN_ATTRIBUTE_198;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -376,6 +383,5 @@ void SMART::readSMARTData(Drive *drive)
|
||||
ctx.temperature,
|
||||
ctx.reallocatedSectors,
|
||||
ctx.pendingSectors,
|
||||
ctx.uncorrectableSectors
|
||||
);
|
||||
ctx.uncorrectableSectors);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user