Show HDD warnings based on sectors (#97)
If one of the following metrics is >0 an warning is shown * Reallocated_Sector_Count * Current_Pending_Sector * Offline_Uncorrectable Reviewed-on: #97 Co-authored-by: localhorst <localhorst@mosad.xyz> Co-committed-by: localhorst <localhorst@mosad.xyz>
This commit was merged in pull request #97.
This commit is contained in:
+11
-2
@@ -72,7 +72,10 @@ private:
|
||||
uint32_t u32ErrorCount = 0U;
|
||||
uint32_t u32PowerOnHours = 0U; // in hours
|
||||
uint32_t u32PowerCycles = 0U;
|
||||
uint32_t u32Temperature = 0U; // in Fahrenheit, just kidding: degree Celsius
|
||||
uint32_t u32Temperature = 0U; // in Fahrenheit, just kidding: degree Celsius
|
||||
uint32_t u32ReallocatedSectors = 0U; // ID 0x05 - Reallocated Sectors Count
|
||||
uint32_t u32PendingSectors = 0U; // ID 0xC5 - Current Pending Sector Count
|
||||
uint32_t u32UncorrectableSectors = 0U; // ID 0xC6 - Offline Uncorrectable Sector Count
|
||||
} sSmartData;
|
||||
|
||||
private:
|
||||
@@ -106,6 +109,9 @@ public:
|
||||
uint32_t getPowerOnHours(void); // in hours
|
||||
uint32_t getPowerCycles(void);
|
||||
uint32_t getTemperature(void); // in Fahrenheit, just kidding: degree Celsius
|
||||
uint32_t getReallocatedSectors(void);
|
||||
uint32_t getPendingSectors(void);
|
||||
uint32_t getUncorrectableSectors(void);
|
||||
void checkFrozenDrive(void);
|
||||
|
||||
void setDriveSMARTData(std::string modelFamily,
|
||||
@@ -115,7 +121,10 @@ public:
|
||||
uint32_t errorCount,
|
||||
uint32_t powerOnHours,
|
||||
uint32_t powerCycles,
|
||||
uint32_t temperature);
|
||||
uint32_t temperature,
|
||||
uint32_t reallocatedSectors,
|
||||
uint32_t pendingSectors,
|
||||
uint32_t uncorrectableSectors);
|
||||
|
||||
std::string sCapacityToText();
|
||||
std::string sErrorCountToText();
|
||||
|
||||
+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"
|
||||
|
||||
+17
-12
@@ -10,24 +10,29 @@
|
||||
|
||||
#include "reHDD.h"
|
||||
|
||||
/**
|
||||
* @brief SMART data reader for drives
|
||||
*
|
||||
* Parses smartctl JSON output to extract:
|
||||
* - Device information (model, serial, capacity)
|
||||
* - Power statistics (hours, cycles)
|
||||
* - Temperature
|
||||
* - Critical sector counts (reallocated, pending, uncorrectable)
|
||||
*
|
||||
* Uses deterministic state machine parser for reliable multi-line JSON parsing.
|
||||
*/
|
||||
class SMART
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
/**
|
||||
* @brief Read S.M.A.R.T. data from drive and populate Drive object
|
||||
* @param drive Pointer to Drive instance to populate with SMART data
|
||||
*/
|
||||
static void readSMARTData(Drive *drive);
|
||||
|
||||
private:
|
||||
SMART(void);
|
||||
|
||||
static bool parseExitStatus(std::string sLine, uint8_t &status);
|
||||
static bool parseModelFamily(std::string sLine, std::string &modelFamily);
|
||||
static bool parseModelName(std::string sLine, std::string &modelName);
|
||||
static bool parseSerial(std::string sLine, std::string &serial);
|
||||
static bool parseCapacity(std::string sLine, uint64_t &capacity);
|
||||
static bool parseErrorCount(std::string sLine, uint32_t &errorCount);
|
||||
static bool parsePowerOnHours(std::string sLine, uint32_t &powerOnHours);
|
||||
static bool parsePowerCycles(std::string sLine, uint32_t &powerCycles);
|
||||
static bool parseTemperature(std::string sLine, uint32_t &temperature);
|
||||
SMART(void); // Utility class - no instances
|
||||
};
|
||||
|
||||
#endif // SMART_H_
|
||||
#endif // SMART_H_
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ private:
|
||||
static WINDOW *createMenuView(int iXSize, int iYSize, int iXStart, int iYStart, struct MenuState menustate);
|
||||
static WINDOW *createDialog(int iXSize, int iYSize, int iXStart, int iYStart, std::string selectedTask, std::string optionA, std::string optionB);
|
||||
static WINDOW *createFrozenWarning(int iXSize, int iYSize, int iXStart, int iYStart, std::string sPath, std::string sModelFamily, std::string sModelName, std::string sSerial, std::string sProgress);
|
||||
static WINDOW *createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart, std::string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount, uint32_t u32Temperature);
|
||||
static WINDOW *createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart, std::string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount, uint32_t u32Temperature, uint32_t u32ReallocatedSectors, uint32_t u32PendingSectors, uint32_t u32UncorrectableSectors);
|
||||
static WINDOW *createZeroChecksumWarning(int iXSize, int iYSize, int iXStart, int iYStart, std::string sPath, std::string sModelFamily, std::string sModelName, std::string sSerial, uint32_t u32Checksum);
|
||||
|
||||
void displaySelectedDrive(Drive &drive, int stdscrX, int stdscrY);
|
||||
|
||||
Reference in New Issue
Block a user