Compare commits
7 Commits
1.2.0
...
80ffb3c6c3
| Author | SHA1 | Date | |
|---|---|---|---|
| 80ffb3c6c3 | |||
| ebe0ef9ec1 | |||
| 86660cb112 | |||
| 47ab9cc36f | |||
| aaf4695656 | |||
| 664582f01d | |||
| 9f6cfc17f8 |
@ -26,11 +26,11 @@ typedef struct
|
|||||||
char caDriveShredDuration[STR_BUFFER_SIZE];
|
char caDriveShredDuration[STR_BUFFER_SIZE];
|
||||||
char caDriveCapacity[STR_BUFFER_SIZE];
|
char caDriveCapacity[STR_BUFFER_SIZE];
|
||||||
char caDriveState[STR_BUFFER_SIZE];
|
char caDriveState[STR_BUFFER_SIZE];
|
||||||
|
char caDriveConnectionType[STR_BUFFER_SIZE];
|
||||||
char caDriveModelFamily[STR_BUFFER_SIZE];
|
char caDriveModelFamily[STR_BUFFER_SIZE];
|
||||||
char caDriveModelName[STR_BUFFER_SIZE];
|
char caDriveModelName[STR_BUFFER_SIZE];
|
||||||
char caDriveSerialnumber[STR_BUFFER_SIZE];
|
char caDriveSerialnumber[STR_BUFFER_SIZE];
|
||||||
char caDriveReHddVersion[STR_BUFFER_SIZE];
|
char caDriveReHddVersion[STR_BUFFER_SIZE];
|
||||||
|
|
||||||
} t_driveData;
|
} t_driveData;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#ifndef REHDD_H_
|
#ifndef REHDD_H_
|
||||||
#define REHDD_H_
|
#define REHDD_H_
|
||||||
|
|
||||||
#define REHDD_VERSION "V1.2.0"
|
#define REHDD_VERSION "V1.2.1"
|
||||||
|
|
||||||
// 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
|
||||||
|
|||||||
@ -51,6 +51,8 @@ public:
|
|||||||
|
|
||||||
static enum UserInput readUserInput();
|
static enum UserInput readUserInput();
|
||||||
|
|
||||||
|
static void terminateTUI();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static string sCpuUsage;
|
static string sCpuUsage;
|
||||||
static string sRamUsage;
|
static string sRamUsage;
|
||||||
@ -80,4 +82,4 @@ private:
|
|||||||
string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes);
|
string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes);
|
||||||
static void vTruncateText(string *psText, uint16_t u16MaxLenght);
|
static void vTruncateText(string *psText, uint16_t u16MaxLenght);
|
||||||
};
|
};
|
||||||
#endif // TUI_H_
|
#endif // TUI_H_
|
||||||
|
|||||||
@ -53,6 +53,23 @@ void Printer::print(Drive *drive)
|
|||||||
sprintf(msgQueueData.driveData.caDriveErrors, "%i", drive->getErrorCount());
|
sprintf(msgQueueData.driveData.caDriveErrors, "%i", drive->getErrorCount());
|
||||||
sprintf(msgQueueData.driveData.caDriveShredTimestamp, "%li", drive->getActionStartTimestamp());
|
sprintf(msgQueueData.driveData.caDriveShredTimestamp, "%li", drive->getActionStartTimestamp());
|
||||||
sprintf(msgQueueData.driveData.caDriveShredDuration, "%li", drive->getTaskDuration());
|
sprintf(msgQueueData.driveData.caDriveShredDuration, "%li", drive->getTaskDuration());
|
||||||
|
|
||||||
|
switch (drive->connectionType)
|
||||||
|
{
|
||||||
|
case Drive::USB:
|
||||||
|
strcpy(msgQueueData.driveData.caDriveConnectionType, "usb");
|
||||||
|
break;
|
||||||
|
case Drive::SATA:
|
||||||
|
strcpy(msgQueueData.driveData.caDriveConnectionType, "sata");
|
||||||
|
break;
|
||||||
|
case Drive::NVME:
|
||||||
|
strcpy(msgQueueData.driveData.caDriveConnectionType, "nvme");
|
||||||
|
break;
|
||||||
|
case Drive::UNKNOWN:
|
||||||
|
default:
|
||||||
|
strcpy(msgQueueData.driveData.caDriveConnectionType, "na");
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(msgQueueData.driveData.caDriveReHddVersion, REHDD_VERSION);
|
sprintf(msgQueueData.driveData.caDriveReHddVersion, REHDD_VERSION);
|
||||||
|
|
||||||
if (-1 == msgsnd(this->msqid, &msgQueueData, sizeof(t_msgQueueData) - sizeof(long), 0))
|
if (-1 == msgsnd(this->msqid, &msgQueueData, sizeof(t_msgQueueData) - sizeof(long), 0))
|
||||||
|
|||||||
@ -198,8 +198,9 @@ void reHDD::ThreadUserInput()
|
|||||||
ui->updateTUI(&listDrives, u8SelectedEntry);
|
ui->updateTUI(&listDrives, u8SelectedEntry);
|
||||||
break;
|
break;
|
||||||
case TUI::UserInput::Terminate:
|
case TUI::UserInput::Terminate:
|
||||||
cout << "Terminate" << endl;
|
// cout << "Terminate" << endl;
|
||||||
stopShredAllDrives(&listDrives);
|
stopShredAllDrives(&listDrives);
|
||||||
|
ui->terminateTUI();
|
||||||
sleep(5); // sleep 5 sec
|
sleep(5); // sleep 5 sec
|
||||||
std::exit(1); // Terminates main, doesn't wait for threads
|
std::exit(1); // Terminates main, doesn't wait for threads
|
||||||
break;
|
break;
|
||||||
@ -408,10 +409,11 @@ void reHDD::filterIgnoredDrives(list<Drive> *plistDrives)
|
|||||||
|
|
||||||
while ((getline(&cLine, &len, outputfileBlkid)) != -1) // parse UUID from blkid
|
while ((getline(&cLine, &len, outputfileBlkid)) != -1) // parse UUID from blkid
|
||||||
{
|
{
|
||||||
if (string(cLine).find("PTUUID") != string::npos)
|
size_t ptuuidPos = string(cLine).find("PTUUID");
|
||||||
|
if (ptuuidPos != string::npos)
|
||||||
{
|
{
|
||||||
string sBlkidOut = string(cLine);
|
string sBlkidOut = string(cLine);
|
||||||
sBlkidOut.erase(0, 18);
|
sBlkidOut.erase(0, ptuuidPos + 8);
|
||||||
sBlkidOut.erase(8, sBlkidOut.length());
|
sBlkidOut.erase(8, sBlkidOut.length());
|
||||||
sUUID = sBlkidOut;
|
sUUID = sBlkidOut;
|
||||||
// cout << "blkid uuid:" << sUUID << endl;
|
// cout << "blkid uuid:" << sUUID << endl;
|
||||||
@ -724,4 +726,4 @@ bool reHDD::getSystemDrive(string &systemDrive)
|
|||||||
pclose(outputfileHwinfo);
|
pclose(outputfileHwinfo);
|
||||||
|
|
||||||
return systemDriveFound;
|
return systemDriveFound;
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/tui.cpp
10
src/tui.cpp
@ -63,6 +63,11 @@ void TUI::initTUI()
|
|||||||
|
|
||||||
void TUI::updateTUI(list<Drive> *plistDrives, uint8_t u8SelectedEntry)
|
void TUI::updateTUI(list<Drive> *plistDrives, uint8_t u8SelectedEntry)
|
||||||
{
|
{
|
||||||
|
if (isendwin())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mxUIrefresh.lock();
|
mxUIrefresh.lock();
|
||||||
uint16_t u16StdscrX, u16StdscrY;
|
uint16_t u16StdscrX, u16StdscrY;
|
||||||
getmaxyx(stdscr, u16StdscrY, u16StdscrX);
|
getmaxyx(stdscr, u16StdscrY, u16StdscrX);
|
||||||
@ -250,6 +255,11 @@ enum TUI::UserInput TUI::readUserInput()
|
|||||||
return TUI::UserInput::Undefined;
|
return TUI::UserInput::Undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TUI::terminateTUI()
|
||||||
|
{
|
||||||
|
endwin();
|
||||||
|
}
|
||||||
|
|
||||||
void TUI::centerTitle(WINDOW *pwin, const char *title)
|
void TUI::centerTitle(WINDOW *pwin, const char *title)
|
||||||
{
|
{
|
||||||
int x, maxX, stringSize;
|
int x, maxX, stringSize;
|
||||||
|
|||||||
Reference in New Issue
Block a user