How to read SMART parameters from a USB-HDD disk?
Preferably with code examples.
I read that programs like CrystalDiskInfo contain information on each SMART attribute for each manufacturer and that there is no uniform method for reading these parameters.
- onein general, .NET is not good friends with hardware, the specifics of the platform. Even in order to find out the banal size of a logical cluster, you have to connect unmanaged DLLs from WinAPI. Your task will most likely require the same. More unfortunately I can’t answer, but you can ask the same question to C ++ or Google specialists to find out the name of the necessary DLL and import parameters, and then adapt it to C #. - rdorn
- @rdorn: If I understand correctly, C ++ as a language is also not very friendly with "hardware", you need to connect external libraries (for example, from WinAPI). Another thing is that these libraries often have an interface in pure C (as historically it has already), and therefore it is more convenient to connect them to C ++ programs. But this is not a question of language, but a question of the convenience of interop. - VladD
- @VladD is not so bad, yes, there may not be ready-made functions, but direct access to memory works wonders, even without asm inserts, but it's true that shooting yourself is also easy or even easier =) - rdorn
|
2 answers
Of all the good things that I found - only this article (in English) with sample code: http://www.know24.net/blog/C+WMI+HDD+SMART+Information.aspx
Sample code working. Good luck.
- Thank! The code is working, but, unfortunately, only for HDD. As I understand it, the system (Windows in my case) is just the same as on the other end of the USB cable.
MSStorageDriver_FailurePredictDatacontains only data for internal HDD (IDE or SATA). - badc0de32
|
Try searching in open source. For example, something similar:
https://github.com/arhimondr/SMARTMonitoring/blob/master/src/atasmart.c
- Alas, this code raises more questions than answers. - badc0de32
- Isn't this code for the Linux API? - ߊߚߤߘ
|