Merge branch 'master' into feature/adaptive-chunksize

This commit is contained in:
2026-05-01 15:11:42 +02:00
9 changed files with 676 additions and 342 deletions
+11 -2
View File
@@ -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
View File
@@ -8,7 +8,7 @@
#ifndef REHDD_H_
#define REHDD_H_
#define REHDD_VERSION "V1.3.0"
#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
View File
@@ -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_
+11 -11
View File
@@ -67,17 +67,17 @@ private:
WINDOW* dialog;
WINDOW* smartWarning;
static void centerTitle(WINDOW* pwin, const char* title);
static WINDOW* createOverViewWindow(int iXSize, int iYSize);
static WINDOW* createDetailViewWindow(int iXSize, int iYSize, int iXStart, Drive& drive);
static WINDOW* overwriteDetailViewWindow(int iXSize, int iYSize, int iXStart);
static WINDOW* createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart, int iListIndex, std::string sModelFamily, std::string sSerial, std::string sCapacity, std::string sState, std::string sTime, std::string sSpeed, std::string sTemp, std::string sConnection, bool bSelected);
static WINDOW* createSystemStats(int iXSize, int iYSize, int iXStart, int iYStart);
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* createZeroChecksumWarning(int iXSize, int iYSize, int iXStart, int iYStart, std::string sPath, std::string sModelFamily, std::string sModelName, std::string sSerial, uint32_t u32Checksum);
static void centerTitle(WINDOW *pwin, const char *title);
static WINDOW *createOverViewWindow(int iXSize, int iYSize);
static WINDOW *createDetailViewWindow(int iXSize, int iYSize, int iXStart, Drive &drive);
static WINDOW *overwriteDetailViewWindow(int iXSize, int iYSize, int iXStart);
static WINDOW *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart, int iListIndex, std::string sModelFamily, std::string sSerial, std::string sCapacity, std::string sState, std::string sTime, std::string sSpeed, std::string sTemp, std::string sConnection, bool bSelected);
static WINDOW *createSystemStats(int iXSize, int iYSize, int iXStart, int iYStart);
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, 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);
std::string formatTimeDuration(time_t u32Duration);