CrystalDiskInfo icon indicating copy to clipboard operation
CrystalDiskInfo copied to clipboard

How do I calculate the C5 values of different hard disks from the attribute values of ATA_SMART_INFO?

Open lwei2 opened this issue 2 years ago • 3 comments

For example,The specific code is as follows. How to directly calculate the value of SmartC5 through Raw values? /////////////////////////////////////////////////////////////////////////////////////////////////// int i, SMARTC5 = 0; for (i = 0; i < vars.AttributeCount; i++) { if (vars.Attribute[i].Id == 0xC5) break; }

if (vars.DiskVendorId == SSD_VENDOR_SANDFORCE)
{
	SMARTC5 =
		((UINT64)vars.Attribute[i].Reserved << 48) +
		((UINT64)vars.Attribute[i].RawValue[5] << 40) +
		((UINT64)vars.Attribute[i].RawValue[4] << 32) +
		((UINT64)vars.Attribute[i].RawValue[3] << 24) +
		((UINT64)vars.Attribute[i].RawValue[2] << 16) +
		((UINT64)vars.Attribute[i].RawValue[1] << 8) +
		(UINT64)vars.Attribute[i].RawValue[0];
}
else if (vars.DiskVendorId == SSD_VENDOR_JMICRON && vars.IsRawValues8)
{
	SMARTC5 =
		((UINT64)vars.Attribute[i].Reserved << 56) +
		((UINT64)vars.Attribute[i].RawValue[5] << 48) +
		((UINT64)vars.Attribute[i].RawValue[4] << 40) +
		((UINT64)vars.Attribute[i].RawValue[3] << 32) +
		((UINT64)vars.Attribute[i].RawValue[2] << 24) +
		((UINT64)vars.Attribute[i].RawValue[1] << 16) +
		((UINT64)vars.Attribute[i].RawValue[0] << 8) +
		(UINT64)vars.Attribute[i].WorstValue;
}

.... ///////////////////////////////////////////////////////////////////////////////////////////////////

lwei2 avatar Jul 19 '21 03:07 lwei2

Try enabling the "10 [DEC]" in Function - Advanced Features - Raw Values, you may get a surprise. You may manually calculate it by like Windows 10 Calculator's Program Mode, but it is cumbersome, not recommended.

yfdyh000 avatar Oct 06 '21 02:10 yfdyh000

Try enabling the "10 [DEC]" in Function - Advanced Features - Raw Values, you may get a surprise. You may manually calculate it by like Windows 10 Calculator's Program Mode, but it is cumbersome, not recommended. Thank you. In general, how is the value of Smart C5 calculated?

lwei2 avatar Oct 08 '21 02:10 lwei2

Thank you. In general, how is the value of Smart C5 calculated?

I am not sure about the device and format. It is 0 for most normal devices.

yfdyh000 avatar Oct 08 '21 06:10 yfdyh000