add support for some samsung drives

This commit is contained in:
2026-06-03 12:54:18 -07:00
parent 2333cb36bc
commit 9096e7adde
7 changed files with 125 additions and 26 deletions

View File

@ -138,12 +138,22 @@ def return_sector_size(drive_id):
sector_size_result = subprocess.run(sector_size_command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return int(sector_size_result.stdout.decode("utf-8"))
# this had to be updated to allow for inconsistent SMART data
def return_ls_written(data):
pages = data.get("ata_device_statistics", {}).get("pages", [])
for page in pages:
for entry in page.get("table", []):
if entry.get("name") == "Logical Sectors Written":
return entry.get("value")
if "ata_device_statistics" in data:
pages = data.get("ata_device_statistics", {}).get("pages", [])
for page in pages:
for entry in page.get("table", []):
if entry.get("name") == "Logical Sectors Written":
return entry.get("value")
if "ata_smart_attributes" in data:
print("type two")
pages = data.get("ata_smart_attributes", [])
for entry in pages.get("table", []):
if entry.get("name") == "Total_LBAs_Written":
print(entry.get("value").get("raw", {}))
return entry.get("raw").get("value")
# Function to return all drive records in database
def get_all_drive_records():