Compare commits
5 Commits
1.2.0
...
ebe0ef9ec1
| Author | SHA1 | Date | |
|---|---|---|---|
| ebe0ef9ec1 | |||
| 86660cb112 | |||
| 47ab9cc36f | |||
| aaf4695656 | |||
| 9f6cfc17f8 |
@ -26,11 +26,11 @@ typedef struct
|
||||
char caDriveShredDuration[STR_BUFFER_SIZE];
|
||||
char caDriveCapacity[STR_BUFFER_SIZE];
|
||||
char caDriveState[STR_BUFFER_SIZE];
|
||||
char caDriveConnectionType[STR_BUFFER_SIZE];
|
||||
char caDriveModelFamily[STR_BUFFER_SIZE];
|
||||
char caDriveModelName[STR_BUFFER_SIZE];
|
||||
char caDriveSerialnumber[STR_BUFFER_SIZE];
|
||||
char caDriveReHddVersion[STR_BUFFER_SIZE];
|
||||
|
||||
} t_driveData;
|
||||
|
||||
typedef struct
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#ifndef REHDD_H_
|
||||
#define REHDD_H_
|
||||
|
||||
#define REHDD_VERSION "V1.2.0"
|
||||
#define REHDD_VERSION "V1.2.1"
|
||||
|
||||
// Drive handling Settings
|
||||
#define WORSE_HOURS 19200 // mark drive if at this limit or beyond
|
||||
|
||||
@ -51,6 +51,8 @@ public:
|
||||
|
||||
static enum UserInput readUserInput();
|
||||
|
||||
static void terminateTUI();
|
||||
|
||||
private:
|
||||
static string sCpuUsage;
|
||||
static string sRamUsage;
|
||||
@ -80,4 +82,4 @@ private:
|
||||
string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes);
|
||||
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.caDriveShredTimestamp, "%li", drive->getActionStartTimestamp());
|
||||
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);
|
||||
|
||||
if (-1 == msgsnd(this->msqid, &msgQueueData, sizeof(t_msgQueueData) - sizeof(long), 0))
|
||||
|
||||
@ -198,8 +198,9 @@ void reHDD::ThreadUserInput()
|
||||
ui->updateTUI(&listDrives, u8SelectedEntry);
|
||||
break;
|
||||
case TUI::UserInput::Terminate:
|
||||
cout << "Terminate" << endl;
|
||||
// cout << "Terminate" << endl;
|
||||
stopShredAllDrives(&listDrives);
|
||||
ui->terminateTUI();
|
||||
sleep(5); // sleep 5 sec
|
||||
std::exit(1); // Terminates main, doesn't wait for threads
|
||||
break;
|
||||
@ -724,4 +725,4 @@ bool reHDD::getSystemDrive(string &systemDrive)
|
||||
pclose(outputfileHwinfo);
|
||||
|
||||
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)
|
||||
{
|
||||
if (isendwin())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mxUIrefresh.lock();
|
||||
uint16_t u16StdscrX, u16StdscrY;
|
||||
getmaxyx(stdscr, u16StdscrY, u16StdscrX);
|
||||
@ -250,6 +255,11 @@ enum TUI::UserInput TUI::readUserInput()
|
||||
return TUI::UserInput::Undefined;
|
||||
}
|
||||
|
||||
void TUI::terminateTUI()
|
||||
{
|
||||
endwin();
|
||||
}
|
||||
|
||||
void TUI::centerTitle(WINDOW *pwin, const char *title)
|
||||
{
|
||||
int x, maxX, stringSize;
|
||||
|
||||
Reference in New Issue
Block a user