Add Checkbox connection type (SATA/NVME) to label #22

Merged
localhorst merged 6 commits from feature/drive-type-marker into main 2025-12-06 23:38:30 +01:00
6 changed files with 65 additions and 25 deletions
Showing only changes of commit b85ff21648 - Show all commits

View File

@ -18,7 +18,6 @@ IPC_CREAT = 0o1000
terminate = False
class TDriveData(ctypes.Structure):
_fields_ = [
("caDriveIndex", ctypes.c_char * STR_BUFFER_SIZE),
@ -29,6 +28,7 @@ class TDriveData(ctypes.Structure):
("caDriveShredDuration", ctypes.c_char * STR_BUFFER_SIZE),
("caDriveCapacity", ctypes.c_char * STR_BUFFER_SIZE),
("caDriveState", ctypes.c_char * STR_BUFFER_SIZE),
("caDriveConnectionType", ctypes.c_char * STR_BUFFER_SIZE),
("caDriveModelFamily", ctypes.c_char * STR_BUFFER_SIZE),
("caDriveModelName", ctypes.c_char * STR_BUFFER_SIZE),
("caDriveSerialnumber", ctypes.c_char * STR_BUFFER_SIZE),
@ -75,6 +75,7 @@ def create_drive_objects(drive_info):
smart_error_count=int(drive_info["driveErrors"]),
shred_timestamp=int(drive_info["driveShredTimestamp"]),
shred_duration=int(drive_info["driveShredDuration"]),
connection_type=drive_info["driveConnectionType"],
)
rehdd_info = layouter.ReHddInfo(
@ -88,8 +89,8 @@ def create_drive_objects(drive_info):
def worker(queue_id, test_mode=False):
try:
while not terminate:
if test_mode:
time.sleep(3)
if test_mode:
drive_info = {
"driveIndex": "42",
"driveHours": 44,
@ -99,6 +100,7 @@ def worker(queue_id, test_mode=False):
"driveShredDuration": 0,
"driveCapacity": 42,
"driveState": "shredded",
"driveConnectionType": "sata",
"driveModelFamily": "modelFamily",
"driveModelName": "modelName",
"driveSerialnumber": "serial",
@ -145,6 +147,7 @@ def worker(queue_id, test_mode=False):
),
"driveCapacity": int(d.caDriveCapacity.decode().strip("\x00")),
"driveState": d.caDriveState.decode().strip("\x00"),
"driveConnectionType": d.caDriveConnectionType.decode().strip("\x00"),
"driveModelFamily": d.caDriveModelFamily.decode().strip("\x00"),
"driveModelName": d.caDriveModelName.decode().strip("\x00"),
"driveSerialnumber": d.caDriveSerialnumber.decode().strip("\x00"),

View File

@ -43,23 +43,7 @@ int main(void)
sprintf(msgQueueData.driveData.caDriveErrors, "%i", 1);
sprintf(msgQueueData.driveData.caDriveShredTimestamp, "%li", 71718LU);
sprintf(msgQueueData.driveData.caDriveShredDuration, "%li", 81718LU);
/*
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);
std::cout << "Sending message to queue..." << std::endl;

View File

@ -28,7 +28,7 @@ typedef struct
char caDriveShredDuration[STR_BUFFER_SIZE];
char caDriveCapacity[STR_BUFFER_SIZE];
char caDriveState[STR_BUFFER_SIZE];
// char caDriveConnectionType[STR_BUFFER_SIZE];
char caDriveConnectionType[STR_BUFFER_SIZE];
char caDriveModelFamily[STR_BUFFER_SIZE];
char caDriveModelName[STR_BUFFER_SIZE];
char caDriveSerialnumber[STR_BUFFER_SIZE];