Page 1 of 3

S.M.A.R.T.

Posted: Sun Nov 27, 2005 4:04 pm
by Droopy
SMART = Self-Monitoring Analysis and Reporting Technology

This Lib / Example can monitor your Hard Disk Smart function.

The source code is from Rings and Max (viewtopic.php?t=6599)
I just add a GUI and made it easier to use ( for library purpose).

You can download a first sample here.

Posted: Sun Nov 27, 2005 4:41 pm
by Num3
WoW !!!

Image

Posted: Sun Nov 27, 2005 9:41 pm
by Tranquil
Nice lib but my HD has a temperatur of 134°C

There is maybe something wrong. :-)

Mike

Posted: Sun Nov 27, 2005 10:48 pm
by Droopy
Tranquil wrote:Nice lib but my HD has a temperatur of 134°C

There is maybe something wrong. :-)

Mike
Value is returned by the Disk an may be wrong.
In this case try reading Raw Value :wink:

( My disk return 105 as temperature, but Raw Value = 35C )

Posted: Mon Nov 28, 2005 5:33 pm
by gnozal
It don't work with Win9x/Me, because of

Code: Select all

hdh = CreateFile_("\\.\PhysicalDrive" + Str(Drive),#GENERIC_READ | #GENERIC_WRITE, #FILE_SHARE_READ | #FILE_SHARE_WRITE,0, #OPEN_EXISTING, 0, 0) 
Maybe it would work with

Code: Select all

hdh = CreateFile_("\\.\SMARTVSD", #GENERIC_READ, #FILE_SHARE_READ, 0, #OPEN_EXISTING, 0, 0)
Like :

Code: Select all

    VersionInfo\dwOSVersionInfoSize = SizeOf(OSVERSIONINFO)
    Platform = GetVersionEx_(VersionInfo)
    If Platform
      If VersionInfo\dwPlatformId = #VER_PLATFORM_WIN32_WINDOWS ; Win9x/Me
        hdh = CreateFile_("\\.\SMARTVSD", #GENERIC_READ, #FILE_SHARE_READ, 0, #OPEN_EXISTING, 0, 0)
      Else ; NT kernel
        hdh = CreateFile_("\\.\PhysicalDrive" + Str(Drive), #GENERIC_READ | #GENERIC_WRITE, #FILE_SHARE_READ | #FILE_SHARE_WRITE, 0, #OPEN_EXISTING, 0, 0)
      EndIf
    EndIf
    If hdh <> #INVALID_HANDLE_VALUE
      etc ...

Posted: Tue Nov 29, 2005 8:34 pm
by GeoTrail
39 degrees on my first drive. VERY cool lib :)

Posted: Tue Nov 29, 2005 11:24 pm
by Max.
GeoTrail wrote:39 degrees on my first drive. VERY cool lib :)
Very cool Lib?

Give the credits to Rings mostly, as he did the really hard work about accessing the Physical Drive.

I did the entire retrieval of the S.M.A.R.T. attributes in extension to Rings code.

Droopy wrapped around it and added some constants. You guys should really learn to give the kudos, where it belongs to. What you do is close to stealing intellectual property. As coder you should understand that this is the worst in this business.

Recycling top, innovation flop!

And stop calling everything a Lib. Just because I take some other people's code and add a gui doesn't make it a lib, ffs.

Posted: Wed Nov 30, 2005 12:32 am
by dagcrack
Well, I can't disagree with Max.

Hmm is this supossed to work with SATA drives anyway?

In any case... any real programmer would know how to handle errors, at line 185 you should add this (on the next, blank, line, of, course)..

Code: Select all

If CountList(SmartLList()) < 1 ;use = 0 if it makes you horny though.
      ProcedureReturn 0
EndIf
So if there arent any items, break. In my case with the SATA drives I dont get any output from the list, so thats why you should have this kind of error checking. You shouldnt avoid error checking, ever. (Even less if you're going to release something to public).

Posted: Wed Nov 30, 2005 1:07 am
by rsts
You might want to be a little careful with this one - hung me tight - had to reset/reboot.

cheers

Posted: Wed Nov 30, 2005 4:16 am
by dagcrack
Woot?, it will crash (the program itself) since it has no error checking, but crashing the OS? which OS are you using? 9x ?

Not that I care though (about this 'lib' crashing people's systems)..

Posted: Wed Nov 30, 2005 4:24 am
by rsts
The program hung my system - winxp sp2.

Hour glass on the program could not access task manager or even move the mouse. Had to reset/reboot the system.

I do have drives attached via a pci interface card as well as through the normal motherboard ide connector.

cheers,

Posted: Wed Nov 30, 2005 4:35 am
by dagcrack
Well here havent got any output from it.. using 2 SATA drives. Also I have a couple of IDE ones at another system, one of them has SMART (the other is very old and therefore doesnt have SMART support).. anyway the program doesnt detect it at all, nor the sata ones..

Posted: Wed Nov 30, 2005 12:14 pm
by Droopy
Give the credits to Rings mostly, as he did the really hard work about accessing the Physical Drive.
In the source code the credit is done to Rings and you, sorry to omit this in the post.
And stop calling everything a Lib. Just because I take some other people's code and add a gui doesn't make it a lib, ffs.
This code is for including in the Droopy Lib, i'll compile it with tailbite / add documentation in chm format for each functions / add credit to for each author.
Recycling top, innovation flop!
I add Status State : (Test done by destroying some hard disk, i need to check smart status, it's a major value for me )

Code: Select all

If Smart\Value < Smart\Threshold 
  Status= "BAD" 
Else 
  Status="OK" 
EndIf

I have a dead disk, wich Smart status is OK, but Smart Error Log report many errors. (With SmartMonTools http://smartmontools.sourceforge.net/
I want to retrieve SMART Error Log, someone know how to do this ?

Posted: Wed Nov 30, 2005 12:22 pm
by GeoTrail
Max. wrote:Very cool Lib?

Give the credits to Rings mostly, as he did the really hard work about accessing the Physical Drive.

I did the entire retrieval of the S.M.A.R.T. attributes in extension to Rings code.

Droopy wrapped around it and added some constants. You guys should really learn to give the kudos, where it belongs to. What you do is close to stealing intellectual property. As coder you should understand that this is the worst in this business.

Recycling top, innovation flop!

And stop calling everything a Lib. Just because I take some other people's code and add a gui doesn't make it a lib, ffs.
Then why are you quoting me? It isn't my responsibility to check who the original author is before I say something is cool :!:

Posted: Wed Nov 30, 2005 12:45 pm
by Max.
My beef with what you did (and also do with other people's stuff) is:

1. This is a Tips & Tricks section. I understand this as sharing new source codes/snippets for people to learn & use and not to announce libraries or applications, even more if there was nothing really new.

2. If you like to enhance stuff of others, add it to their threads, so people learn to know where it comes from and also maybe get hints from the development history.

3. If you recycle, use proper credits. This is more than mentioning a bunch of names in the source code only without a clear indicator who did what.

4. If you intend to Tailbite stuff of others in order to distribute it, I'd consider it good style if you asked for the original coders consent.

5. If you quote, like you did in the source code, do it in an appropriate way.
;{- ORIGINAL POST : viewtopic.php?t=6599&postdays=0&postorder=asc&start=15
; I extended Rings' snippet a bit so it reads also the S.M.A.R.T. data of an harddisk
; (If The HDD is capable of).
; The values are held in two structures.
; bAttrValue is The current value of an Attribute. Attribute means certain monitoring
; parameter, like temperature, Read errors And such.
; bWorstValue is speaking For itself.
; bRawValue is The value translated; for example, for Attribute 194 my system reports
; "104" as current value, "7" as worst (O_o), "0" as threshold And "39" as raw value.
; The "39" is "39 °C", as we are talking about temperatures.
; bWarrantyThreshold is The value defined by The vendor And The actual value should
; never be below.
;}
Without knowing better or rereading the entire thread, I'd think that it is you who said: "I extended Rings' snippet a bit so it reads also the S.M.A.R.T. data of an harddisk..."

6. Don't omit the origin in the posting. This is what people see.
SMART = Self-Monitoring Analysis and Reporting Technology

This Lib / Example can monitor your Hard Disk Smart function.

http://www.penguinbyte.com/apps/pbwebst ... /SMART.zip
and as with the good old tin-can phones, this is what results of it

http://forums.purebasic.com/german/view ... highlight=
Subject: S.M.A.R.T. von Droopy

Droopy hat folgendes geschrieben:
SMART = Self-Monitoring Analysis and Reporting Technology

This Lib / Example can monitor your Hard Disk Smart function.


viewtopic.php?t=17974

Grüße ... Kiffi
----------------

Some might see things like that not as serious as I do, but for me, several incidents like this were reason enough not to share any more code since more than 1 year and this one confirms me. So...
I want to retrieve SMART Error Log, someone know how to do this ?
...:lol: