Add Checkbox connection type (SATA/NVME) to label #22
@ -18,7 +18,6 @@ IPC_CREAT = 0o1000
|
|||||||
|
|
||||||
terminate = False
|
terminate = False
|
||||||
|
|
||||||
|
|
||||||
class TDriveData(ctypes.Structure):
|
class TDriveData(ctypes.Structure):
|
||||||
_fields_ = [
|
_fields_ = [
|
||||||
("caDriveIndex", ctypes.c_char * STR_BUFFER_SIZE),
|
("caDriveIndex", ctypes.c_char * STR_BUFFER_SIZE),
|
||||||
@ -29,6 +28,7 @@ class TDriveData(ctypes.Structure):
|
|||||||
("caDriveShredDuration", ctypes.c_char * STR_BUFFER_SIZE),
|
("caDriveShredDuration", ctypes.c_char * STR_BUFFER_SIZE),
|
||||||
("caDriveCapacity", ctypes.c_char * STR_BUFFER_SIZE),
|
("caDriveCapacity", ctypes.c_char * STR_BUFFER_SIZE),
|
||||||
("caDriveState", 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),
|
("caDriveModelFamily", ctypes.c_char * STR_BUFFER_SIZE),
|
||||||
("caDriveModelName", ctypes.c_char * STR_BUFFER_SIZE),
|
("caDriveModelName", ctypes.c_char * STR_BUFFER_SIZE),
|
||||||
("caDriveSerialnumber", 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"]),
|
smart_error_count=int(drive_info["driveErrors"]),
|
||||||
shred_timestamp=int(drive_info["driveShredTimestamp"]),
|
shred_timestamp=int(drive_info["driveShredTimestamp"]),
|
||||||
shred_duration=int(drive_info["driveShredDuration"]),
|
shred_duration=int(drive_info["driveShredDuration"]),
|
||||||
|
connection_type=drive_info["driveConnectionType"],
|
||||||
)
|
)
|
||||||
|
|
||||||
rehdd_info = layouter.ReHddInfo(
|
rehdd_info = layouter.ReHddInfo(
|
||||||
@ -88,8 +89,8 @@ def create_drive_objects(drive_info):
|
|||||||
def worker(queue_id, test_mode=False):
|
def worker(queue_id, test_mode=False):
|
||||||
try:
|
try:
|
||||||
while not terminate:
|
while not terminate:
|
||||||
|
time.sleep(3)
|
||||||
if test_mode:
|
if test_mode:
|
||||||
time.sleep(3)
|
|
||||||
drive_info = {
|
drive_info = {
|
||||||
"driveIndex": "42",
|
"driveIndex": "42",
|
||||||
"driveHours": 44,
|
"driveHours": 44,
|
||||||
@ -99,6 +100,7 @@ def worker(queue_id, test_mode=False):
|
|||||||
"driveShredDuration": 0,
|
"driveShredDuration": 0,
|
||||||
"driveCapacity": 42,
|
"driveCapacity": 42,
|
||||||
"driveState": "shredded",
|
"driveState": "shredded",
|
||||||
|
"driveConnectionType": "sata",
|
||||||
"driveModelFamily": "modelFamily",
|
"driveModelFamily": "modelFamily",
|
||||||
"driveModelName": "modelName",
|
"driveModelName": "modelName",
|
||||||
"driveSerialnumber": "serial",
|
"driveSerialnumber": "serial",
|
||||||
@ -145,6 +147,7 @@ def worker(queue_id, test_mode=False):
|
|||||||
),
|
),
|
||||||
"driveCapacity": int(d.caDriveCapacity.decode().strip("\x00")),
|
"driveCapacity": int(d.caDriveCapacity.decode().strip("\x00")),
|
||||||
"driveState": d.caDriveState.decode().strip("\x00"),
|
"driveState": d.caDriveState.decode().strip("\x00"),
|
||||||
|
"driveConnectionType": d.caDriveConnectionType.decode().strip("\x00"),
|
||||||
"driveModelFamily": d.caDriveModelFamily.decode().strip("\x00"),
|
"driveModelFamily": d.caDriveModelFamily.decode().strip("\x00"),
|
||||||
"driveModelName": d.caDriveModelName.decode().strip("\x00"),
|
"driveModelName": d.caDriveModelName.decode().strip("\x00"),
|
||||||
"driveSerialnumber": d.caDriveSerialnumber.decode().strip("\x00"),
|
"driveSerialnumber": d.caDriveSerialnumber.decode().strip("\x00"),
|
||||||
|
|||||||
@ -43,23 +43,7 @@ int main(void)
|
|||||||
sprintf(msgQueueData.driveData.caDriveErrors, "%i", 1);
|
sprintf(msgQueueData.driveData.caDriveErrors, "%i", 1);
|
||||||
sprintf(msgQueueData.driveData.caDriveShredTimestamp, "%li", 71718LU);
|
sprintf(msgQueueData.driveData.caDriveShredTimestamp, "%li", 71718LU);
|
||||||
sprintf(msgQueueData.driveData.caDriveShredDuration, "%li", 81718LU);
|
sprintf(msgQueueData.driveData.caDriveShredDuration, "%li", 81718LU);
|
||||||
/*
|
strcpy(msgQueueData.driveData.caDriveConnectionType, "sata");
|
||||||
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);
|
||||||
|
|
||||||
std::cout << "Sending message to queue..." << std::endl;
|
std::cout << "Sending message to queue..." << std::endl;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ 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 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];
|
||||||
|
|||||||
Reference in New Issue
Block a user