Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lwei2 opened this issue Jul 19, 2021 · 3 comments

Comments

@lwei2
Copy link

lwei2 commented Jul 19, 2021

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;
}

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

@yfdyh000
Copy link
Contributor

yfdyh000 commented Oct 6, 2021

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.

@lwei2
Copy link
Author

lwei2 commented Oct 8, 2021

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?

@yfdyh000
Copy link
Contributor

yfdyh000 commented Oct 8, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants