Compare commits
4 Commits
b545f9e326
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 47c0236129 | |||
| 56aa4a2721 | |||
| 731a00a644 | |||
| b85ff21648 |
@ -4,7 +4,7 @@
|
|||||||
- Receive data from [reHDD](https://git.mosad.xyz/localhorst/reHDD) via IPC message queue.
|
- Receive data from [reHDD](https://git.mosad.xyz/localhorst/reHDD) via IPC message queue.
|
||||||
|
|
||||||
## Example Label
|
## Example Label
|
||||||

|

|
||||||
|
|
||||||
## Install ##
|
## Install ##
|
||||||
|
|
||||||
|
|||||||
@ -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];
|
||||||
|
|||||||
BIN
output.png
BIN
output.png
Binary file not shown.
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
@ -43,10 +43,10 @@ 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),
|
||||||
("caDriveConnectionType", ctypes.c_char * STR_BUFFER_SIZE),
|
|
||||||
("caDriveReHddVersion", ctypes.c_char * STR_BUFFER_SIZE),
|
("caDriveReHddVersion", ctypes.c_char * STR_BUFFER_SIZE),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -102,12 +102,12 @@ def create_drive_objects(drive_info):
|
|||||||
modelname=drive_info["driveModelName"],
|
modelname=drive_info["driveModelName"],
|
||||||
capacity=int(drive_info["driveCapacity"]),
|
capacity=int(drive_info["driveCapacity"]),
|
||||||
serialnumber=drive_info["driveSerialnumber"],
|
serialnumber=drive_info["driveSerialnumber"],
|
||||||
drive_connection_type=drive_info["driveConnectionType"],
|
|
||||||
power_on_hours=int(drive_info["driveHours"]),
|
power_on_hours=int(drive_info["driveHours"]),
|
||||||
power_cycle=int(drive_info["driveCycles"]),
|
power_cycle=int(drive_info["driveCycles"]),
|
||||||
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"]),
|
||||||
|
drive_connection_type=drive_info["driveConnectionType"],
|
||||||
)
|
)
|
||||||
|
|
||||||
rehdd_info = layouter.ReHddInfo(
|
rehdd_info = layouter.ReHddInfo(
|
||||||
@ -132,6 +132,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",
|
||||||
@ -166,10 +167,15 @@ 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"),
|
||||||
"driveConnectionType": d.caDriveConnectionType.decode().strip("\x00"),
|
"driveConnectionType": d.caDriveConnectionType.decode().strip(
|
||||||
|
"\x00"
|
||||||
|
),
|
||||||
"driveReHddVersion": d.caDriveReHddVersion.decode().strip("\x00"),
|
"driveReHddVersion": d.caDriveReHddVersion.decode().strip("\x00"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user