find nvme with lsblk

This commit is contained in:
Hendrik Schutter 2024-04-14 11:13:00 +02:00
parent 2306d34e91
commit aa7ddf8b36
2 changed files with 14 additions and 5 deletions

View File

@ -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 "bV1.1.0"
// 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 2024" #define DESCRIPTION "reHDD - Copyright Hendrik Schutter 2022"
#define DEVICE_ID "generic" #define DEVICE_ID "generic"
#define SOFTWARE_VERSION "alpha" #define SOFTWARE_VERSION "alpha"
#define HARDWARE_VERSION "generic" #define HARDWARE_VERSION "generic"
@ -31,7 +31,7 @@
#endif #endif
// Logic // Logic
//#define DRYRUN //don´t touch the drives #define DRYRUN //don´t touch the drives
#define FROZEN_ALERT //show alert if drive is frozen #define FROZEN_ALERT //show alert if drive is frozen
#define ZERO_CHECK //check drive after shred if all bytes are zero, show alert if this fails #define ZERO_CHECK //check drive after shred if all bytes are zero, show alert if this fails

View File

@ -305,7 +305,7 @@ void reHDD::searchDrives(list <Drive>* plistDrives)
char * cLine = NULL; char * cLine = NULL;
size_t len = 0; size_t len = 0;
FILE* outputfileHwinfo = popen("lsblk -I 8 -d -o NAME", "r"); FILE* outputfileHwinfo = popen("lsblk -e 11 -d -o NAME", "r");
if (outputfileHwinfo == NULL) if (outputfileHwinfo == NULL)
{ {
@ -321,7 +321,16 @@ void reHDD::searchDrives(list <Drive>* plistDrives)
tmpDrive->state = Drive::NONE; tmpDrive->state = Drive::NONE;
tmpDrive->bIsOffline = false; tmpDrive->bIsOffline = false;
plistDrives->push_back(*tmpDrive); plistDrives->push_back(*tmpDrive);
//Logger::logThis()->info("drive found: " + tmpDrive->getPath()); //Logger::logThis()->info("SATA drive found: " + tmpDrive->getPath());
}
if (string(cLine).length() == 8)
{
Drive* tmpDrive = new Drive("/dev/" + string(cLine).substr(0, 7));
tmpDrive->state = Drive::NONE;
tmpDrive->bIsOffline = false;
plistDrives->push_back(*tmpDrive);
//Logger::logThis()->info("NVME drive found: " + tmpDrive->getPath());
} }
} }
pclose(outputfileHwinfo); pclose(outputfileHwinfo);