add support for some samsung drives
This commit is contained in:
@ -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():
|
||||
|
||||
Reference in New Issue
Block a user