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