OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Dariusz Piatkowski on April 13, 2020, 03:20:08 pm

Title: OS2AHCI interface?
Post by: Dariusz Piatkowski on April 13, 2020, 03:20:08 pm
Having recently made the move from DANIS506 to AHCI I've lost some of the IDE reporting functionality that was provided through little utilities like DiskMon, or even SmartMon.

So I thought I'd take a stab at building the AHCI versions of these, first one up being DiskMon since that provides a real-time snapshot of drive's throughput and temperature metrics, and I thought it would be a good excercise to try out my current GCC environment.

Alright, so here is the thing, I know I need to 're-point' the interface to the OS2AHCI, namely something like this:

Code: [Select]
  rc = DosOpen ("\\DEV\\IBMS506$", &hDevice, &ActionTaken, 0,  FILE_SYSTEM,
OPEN_ACTION_OPEN_IF_EXISTS, OPEN_SHARE_DENYNONE |
OPEN_FLAGS_NOINHERIT | OPEN_ACCESS_READONLY, NULL);
  if (rc) exit (rc);

needs to read more along the lines of this:

Code: [Select]
  rc = DosOpen ("\\DEV\\OS2AHCI$", &hDevice, &ActionTaken, 0,  FILE_SYSTEM,
OPEN_ACTION_OPEN_IF_EXISTS, OPEN_SHARE_DENYNONE |
OPEN_FLAGS_NOINHERIT | OPEN_ACCESS_READONLY, NULL);
  if (rc) exit (rc);

But i'm guessing it's nowhere near as simple as that. I mean I did make the change, the program succeesfully built and attempting to run it locked up the machine...LOL, I was expecting that. Strangely where it locked up was on a temperature fetch, and that may be more due to the fact that DiskMon is using the SMART reporting functionality of SmartMon (or so say the comments). I'm sure it's more complicated, but that is at least my starting point.

OK, so back to the post subject line: where do I obtain the definition of OS2AHCI interface?

I guess the only thing I can compare it to are the code samples that are included with the DANIS506 stuff, and those are very clear. I found nothing on the AOS pages on this, but before I log a ticket or post to the Testers' List I thought I'd ask here first.

Thanks!
Title: Re: OS2AHCI interface?
Post by: Neil Waldhauer on April 13, 2020, 03:42:39 pm
First, try smartmontools.

http://hobbes.nmsu.edu/download/pub/os2/util/disk/smartmontools-6.6-r4424.zip (http://hobbes.nmsu.edu/download/pub/os2/util/disk/smartmontools-6.6-r4424.zip)

Go here for information and source code.

www.smartmontools.org (http://www.smartmontools.org)
Title: Re: OS2AHCI interface?
Post by: ivan on April 13, 2020, 04:31:57 pm
Hi Dariusz,

It sounds as if you are looking at that which I was looking for way back last year - some way to get smartctl.exe from smartmontools to display the output of smartctl -a ahci1 without having to pipe it to a file and then read that file, in other words just like smartmon from Dani's IDE driver package.

No one came up with a way of doing that when I asked so maybe you could produce the necessary graphical interface needed.
 
Title: Re: OS2AHCI interface?
Post by: Lars on April 13, 2020, 04:46:14 pm
There were versions of OS2AHCI.ADD that would lock up the machine when the IOCTL was called (or the driver opened, for that matter).
What version of OS2AHCI.ADD are you using ? Make sure you use version >= 2.04.
I have smartahci.exe and that seems to work, at least to the extent that it outputs some info without completely freezing the system.
Title: Re: OS2AHCI interface?
Post by: Dave Yeo on April 13, 2020, 04:49:47 pm
Hi Ivan, just pipe it through less. Would be nice to have colour support, perhaps Dariusz can find some macros or such to enable the ANSI colours.
Code: [Select]
SMARTAHCI.EXE -a hd0 | less
Title: Re: OS2AHCI interface?
Post by: Pete on April 13, 2020, 08:20:47 pm
Hi All

Hi Dariusz,

It sounds as if you are looking at that which I was looking for way back last year - some way to get smartctl.exe from smartmontools to display the output of smartctl -a ahci1 without having to pipe it to a file and then read that file, in other words just like smartmon from Dani's IDE driver package.

No one came up with a way of doing that when I asked so maybe you could produce the necessary graphical interface needed.


It is funny you should mention that as I started playing around with something I call PMsmartctl as a result of your post.

It is a simple frontend for smartctl and displays selected information in the Text Editor (e.exe) which gives you the option of Saving and Printing - with minimal work by me  :-)

NOTE:  Only works with http://hobbes.nmsu.edu/download/pub/os2/util/disk/smartmontools-6.6-r4424.zip

If anyone feels like testing and reporting - along with suggestions for improvement - I attach PMsmartctl_Beta_0_1.zip


Regards

Pete


Title: Re: OS2AHCI interface?
Post by: David Graser on April 13, 2020, 11:44:58 pm
Hi Pete

Works great.
Title: Re: OS2AHCI interface?
Post by: Dariusz Piatkowski on April 14, 2020, 04:20:22 am
Hey you guys!

Awesome conversation.

So let me shed a bit more light on what I had in mind. Way waaaayyy back when, I was heavily using the HPFS386 fs, I wrote some small stuff that basically allowed me to pull a bunch of cache details. I basically wanted to learn more about the fs internals and wasn't happy with the 'cache386 /stats:d' output.

Now fast fwd a bit and currently I'm using JFS, but I've moved on to the OS2AHCI driver, v2.07.

This means that any previous disk monitoring utilities that relied on DANIS506$ to be present are no longer working.

I currently use smartmontools RPM package, which works quite fine and supports both IDE and AHCI devices:

Code: [Select]
Name        : smartmontools
Arch        : pentium4
Epoch       : 1
Version     : 7.0
Release     : 1.oc00
Size        : 1.0 M
Repo        : installed

So from that perspective I will stick with this and won't be going back to the smartmontools-6.6-r4424.zip release.

However, to convert the PMDskMon utility to AHCI mode I need to understand what needs to be changed from the current DANIS506 interface. I wish I could find where the source for the RPM release of smartmontools is, because that clearly has a working AHCI interface. But given the lack of this information I'm taking a stab at removing all S.M.A.R.T. data collection functionality from the PMDskMon utility itself first to see if simply re-pointing it to OS2AHCI$ might work.

If this fails my next step is to look at the Netlabs project page for OS2AHCI which can be found here => http://trac.netlabs.org/ahci (http://trac.netlabs.org/ahci), I will do a SVN source pull and will take a look at the driver details (for what it's worth, as I expect much of this to be over my head lol).

Eventually I'd like to actually write a new utility that really exposes all the pertinent details a storage device has. There are numerous such non-OS/2 utilities out there, so some good interfaces to pick from. More importantly I would like this to also have some of the fs specific stuff in there, so things that pertain to JFS cache for example, etc. This is a very long-term plan though, so I'm happy to see that we already have some alternatives created by our very own!!!  ;)
Title: Re: OS2AHCI interface?
Post by: Dave Yeo on April 14, 2020, 05:04:07 am
The source is here, http://rpm.netlabs.org/experimental/00/i386/SRPMS/smartmontools-7.0-1.oc00.src.rpm (http://rpm.netlabs.org/experimental/00/i386/SRPMS/smartmontools-7.0-1.oc00.src.rpm)
Title: Re: OS2AHCI interface?
Post by: Pete on April 14, 2020, 11:06:07 am
Hi All

I have just quickly tested the smartmontools-7_0-1 package (from http://rpm.netlabs.org/experimental/00/zip/smartmontools-7_0-1_oc00.zip) and, so far, it seems that PMsmartctl is happy to use that release.


Regards

Pete
Title: Re: OS2AHCI interface?
Post by: Dariusz Piatkowski on April 14, 2020, 05:20:04 pm
Hey Pete,

Hi All

I have just quickly tested the smartmontools-7_0-1 package (from http://rpm.netlabs.org/experimental/00/zip/smartmontools-7_0-1_oc00.zip) and, so far, it seems that PMsmartctl is happy to use that release...

I just tried your app here, it comes up fine, but once it does the window is non-responsive. It is in the foreground, no information is populated, it is waiting for me to tell it where to find smartctl but I can not actually push the Browse button.

So I manually updated the INI file, this now has the app showing me active radio buttons for PATA hd0 and SATA ahci0-ahci2, but I sitll can not click anywhere in the window itself.

Hmm...strange I thought, but hey, running in SMP mode here and it's not like that hasn't been a problem here and there. So I shut off 4 of the 5 CPU cores, re-started the app and indeed things work!!! So I would guess for some reason the app is not SMP-safe...

Otherwise it looks pretty nice, looking fwd to more testing Pete!
Title: Re: OS2AHCI interface?
Post by: Pete on April 14, 2020, 06:44:53 pm
Hi Darriusz

Seems to be SMP safe here - developed on a system with an AMD FX 4300, all 4 cores active, not had that sort of problem - so far.

If I understand you correctly this happened the first time you started PMsmartctl - you had not previously run PMsmartctl and set the location of smartctl.exe ?

I do not think there is anything that is SMP unsafe in the startup code but will have a rummage through to see if I can find possible cause(s). At first glance the only thing that stands out is that I have not explicitly initialised a couple of variables...

That could make a difference if there is some "garbage" in the location used for the variable smartctlPath as that would mean the check for smartctlPath having a value would return True which would then set the smartctlFlag indicating smartctl.exe was available triggering a call to "smartctl --scan" which could cause the startup problem.

I'll have to do a little bit of re-coding and post a new build a little later for you to try. Will also have a rummage through underlying OS/2 API calls made during startup to see if there is anything known to be SMP unsafe but I do not think there is.

Out of interest will PMsmartctl run with 4 cores enabled on your system?


Regards

Pete

Title: Re: OS2AHCI interface?
Post by: Pete on April 14, 2020, 08:55:03 pm
Hi Darriusz

PMsmartctl_Test1.zip attached - Simply unzip over previous release and Delete existing PMsmartctl.INI file.


Regards

Pete
Title: Re: OS2AHCI interface?
Post by: Dariusz Piatkowski on April 14, 2020, 09:16:35 pm
Hi Pete,

Alright, you brought up some good questions and re-reading my previous post I can see that my description wasn't really clear.

Let me explain how I occasionally shut OFF cpu cores here. So my machine is AMD Phenom II X6 based box. 6 cores total, but when booting with 6 the WPS locks up at the blue-screen. So I have the 6th core disabled in BIOS and that allows me to boot up just fine. Never tracked this down, may have something to do with the motherboard having built-in video chipset, along with a few other things that my OS/2 configuratoin can not use.

Anyways, I boot up with 5 cores. Now, at times I need to shut off 4 of the 5 cores. For example, ANPM when started in full 5-core SMP mode will soft-lock the WPS, only CAD gets me out, but that's a system re-boot. So to avoid that outcome I flip to 1-core mode, start ANPM and the minute the window is built I flip back to 5-core mode. Again, haven't figured this out yet, tried playing with numerous approaches such as setting the EXE to SMP-unsafe, etc. I suspect somewhere on my machine is either a DLL, or perhaps a hardware setup that's the root cause.

To do this OFF/ON flip I use setproc.exe, which is a most handy utility by Yuri Dario.

Ok, so now let me answer below...

...If I understand you correctly this happened the first time you started PMsmartctl - you had not previously run PMsmartctl and set the location of smartctl.exe ?

As long as I am in the full SMP mode, so more than a single core active this always happens. Even after I manually edited the INI file and had the correct path to the smartctl.exe file, having re-started the program I still resulted in having a frozen non-responsive window.

The only time the app actually works is when I run in the limitted 1-core mode, as described above. So basically any other time I start it again, it will only work if I'm running in that 1-core mode, all other times it goes back to the soft-lock where just the app is non responsive. I can close it down with lSwitcher's Close=>Quit and do not have to use the harsher SIGKILL.

...I do not think there is anything that is SMP unsafe in the startup code but will have a rummage through to see if I can find possible cause(s). At first glance the only thing that stands out is that I have not explicitly initialised a couple of variables...

Hmm, good to hear that it is working fine on your end. It would trully be the icing on the cake if troubleshooting this issue would allow me to also figure out why full-core SMP mode here occasinally causes the problems I see. Right now my issue is limitted to impacting just your app, it does not lock up the whole WPS as it most often does with a handful of other apps I have.

...That could make a difference if there is some "garbage" in the location used for the variable smartctlPath as that would mean the check for smartctlPath having a value would return True which would then set the smartctlFlag indicating smartctl.exe was available triggering a call to "smartctl --scan" which could cause the startup problem...

OK, so on this subject I am curious about something. Once the path to smartctl.exe is provided the app continues to do something before I hit my lock. After all, the normally grayed out PATA and SATA fields do actually un-gray and I should be able to select which device I want to pull up the information for. So in your code the lock I see must happen after this point in time, which I'm guessing happens once smartctl (perhaps?) returns some valid list of devices maybe???

...I'll have to do a little bit of re-coding and post a new build a little later for you to try. Will also have a rummage through underlying OS/2 API calls made during startup to see if there is anything known to be SMP unsafe but I do not think there is...

Since we are in the coding forum, care to share your code? i ask b/c I pulled the source for smartmontools that Dave pointed me to. There is a specific OS/2 section in there (see os_os2.cpp and os_os2.h) which I am working throught right now to understand the differences between DANIS506 and OS2AHCI, I think I may have spotted something but I'm not quite sure yet. Given that your app does successfully allow me to pick one of my AHCI devices though would imply that your code at least knows how to differentiate between them and therefore must be issuing some call to determine what device is hooked to what controller. I'd love to see that code.

...Out of interest will PMsmartctl run with 4 cores enabled on your system?...

It runs, but goes into that non-responsive mode (I call soft-lock). Othewrise, only 1-core mode allows me to actually use it normally.
Title: Re: OS2AHCI interface?
Post by: ivan on April 14, 2020, 10:24:34 pm
Hi Pete,

Your PMsmartctl.exe works here on my Ryzen based units.  Thanks, you software guys look to be getting there, us hardware guys can only sit back and say thanks.

Only one complaint, it would be nice if the table items were shown it columns.
Title: Re: OS2AHCI interface?
Post by: Pete on April 15, 2020, 12:48:13 am
Hi ivan

The output shown is "as it comes" from smartctl.exe

What "table items" would you like in columns? - a lot of the output is already in columns.


Regards

Pete
Title: Re: OS2AHCI interface?
Post by: Pete on April 15, 2020, 01:33:06 am
Hi Darriusz

Given that I have seen other posts about you having to switch cores off on your Phenom X6 to get things working at times I suspect there may be a problem somewhere with hardware/acpi interaction(s) on that system - at least it is not just my app :-)

Glad to hear PMsmartcl does not take out the system but Not sure what I can do to help resolve the issues with the Phenom X6...

As regards where the "softlock" occurs with PMsmartctl:

When the path to smartctl.exe has been entered PMsmartctl calls "smartctl --scan > SCAN.TXT" to create a file containing the list of available disks. SCAN.TXT is then read and disk radio buttons  are Enabled for those disks found.

Do the PATA/SATA Radio Buttons corresponding to the installed disks get Enabled? Looking at your previous post it looks like they do... Which could indicate some simple code fails, possibly:-

   // Close text file
      CloseFile(F);

I do not know  a "workaround" if using CloseFile on the SCAN.TXT file is where the "softlock" occurs...

Does the following text get displayed in the top left area of the app?

   1] Locate smartctl.exe
   2] Select Disk
   3] Select Information
   4] Click Show

If "No" then my guess is something goes wrong with CloseFile(F) or thereabouts.

If "Yes" - quite simply, no ideas... The app should be sitting waiting for a user to select disk and information required before clicking the "Show" button.

PMsmartctl uses the following command to get the list of drives:-

   smartctl --scan > SCAN.TXT

Copy'n'Paste the above in a command window opened in your smartctl directory.

The above does not tell you which disk is on what controller though, for that you need to ask the driver what it found at boot ie:-

Copy OS2AHCI$ K:\TEMP\SATA.TRC


Below is the output of both OS2AHC$ (using older 1.32 release as it shows unused ports as well) and smartctl --scan which shows that the disk reported by OS2AHCI$ on Adapter 1 Port 1 is seen as ahci4 by smartctl.exe


OS2AHCI$ output:-

BldLevel: @#Arca Noae LLC:1.32#@##1## 16 Nov 2014 08:16:06     DAZAR1    ::::::@@AHCI Driver (c) 2014 Arca Noae LLC
CmdLine: OS2AHCI.ADD
Adapter 0: PCI=0:17:0 ID=1002:4391 AMD SB700/800 irq=19 addr=0xfeb0b000 version=10200
  Port 0:
    Drive 0: 14593 cylinders, 255 heads, 63 sectors per track (114470MB) (LVM)
  Port 1:
    Drive 0: 60321 cylinders, 255 heads, 127 sectors per track (953855MB) (LVM)
  Port 2:
    Drive 0: atapi removable Drive present but no information available. Not queried by OS.
  Port 3:
    Drive 0: atapi removable Drive present but no information available. Not queried by OS.
  Port 4:
    No drive present
  Port 5:
    No drive present
Adapter 1: PCI=3:0:0 ID=1b4b:9172 Generic Generic irq=47 addr=0xfe810000 version=10000
  Port 0:
    No drive present
  Port 1:
    Drive 0: 30042 cylinders, 255 heads, 255 sectors per track (953848MB) (LVM)


smartctl --scan output:-

ahci0 -d ata # ahci0, ATA device
ahci1 -d ata # ahci1, ATA device
ahci2 -d ata # ahci2, ATA device
ahci3 -d ata # ahci3, ATA device
ahci4 -d ata # ahci4, ATA device


As regards sharing my code: No Problem - was thinking about writing an article on creating a relatively simple WDSibyl application using this app and asking Martin if he wants to "publish" it on os2world so was planning to "open source" PMsmartctl. I suspect your main interest would be the "smartctl --scan" and "copy OS2AHCI$" bits above though.

Incidentially, have you checked whether BS_Info "exposes all the pertinent details a storage device has"  - https://www.wdsibyl.org/index.php?module=Downloads&func=sublevel&cid=24&lang=en


Regards

Pete

Title: Re: OS2AHCI interface?
Post by: ivan on April 15, 2020, 01:35:41 am
Hi Pete,

A couple of examples attached.

The first is as it comes and the second (from Danie's smartmon) is in a much more readable view.
Title: Re: OS2AHCI interface?
Post by: Pete on April 15, 2020, 04:17:15 am
Hi ivan

Doubt I'll get into the colour side of things - unless I get really bored and decide to write code to display the output rather than using e.exe... OTOH as with Darriusz you are welcome to the source code - just in case you get bored  :-)

Of possible interest is the output I get for Attributes is a bit neater, organised nicely in columns without me coding a thing, see attached Petes_Output.jpg

I currently have no idea why the output on your system is not as neatly organised... Text Editor (e.exe) in use here is AE v1.9.8


Regards

Pete
Title: Re: OS2AHCI interface?
Post by: Dave Yeo on April 15, 2020, 04:37:08 am
Hi Pete. works well here. The font needs to be monospaced to get the nice columns, system vio seems to work and seems to be the default here for the system text editor. Be nice to pick the editor :)

As for colour output, I quickly looked at the source of smartmontools looking for a ANSI colour option but didn't see one. Might be hidden in Windows source where you have to load ANSI.SYS IIRC to get colours whereas for us, they usually just work. Have to find the source for the older smartmon.
Title: Re: OS2AHCI interface?
Post by: ivan on April 15, 2020, 01:09:38 pm
Hi Pete,

Not worried about the colour, just want the columns.

Here e.exe is actually e.exe so I would echo Dave's statement
Quote
Be nice to pick the editor
.

If I had spare time I would most probably design an AMD based motherboard specifically for use with OS/2.  As it is I am seeing a stack of Win based computers of friends that are working from home and their computers are not up to the task - Bill Gates should be shot for allowing the abomination that is WIN 10 lose on the world.
Title: Re: OS2AHCI interface?
Post by: Dariusz Piatkowski on April 15, 2020, 04:54:37 pm
Pete,
...PMsmartctl_Test1.zip attached - Simply unzip over previous release and Delete existing PMsmartctl.INI file...

No, that did not make any difference.

I'm curious, what is this written in? I'm trying to make the changes to PMDskmon which is written in C, as is the smartmontools utility. 

I think this is WDSibyl right, so that's PASCAL, or PASCAL-like?

In the meantime I continued on with my debugging here...looks like I'm either not passing the right parameter in my DosDevIOCtl call, or (most likely) the data structure mapping the utility originally had does not account for differences between DANIS506 and OS2AHCI.

So the next step is to pull the OS2AHCI sources (gotta get SVN setup for that first) and review those first.
Title: Re: OS2AHCI interface?
Post by: Pete on April 15, 2020, 10:31:38 pm
Hi All

Dave and ivans point about choice of editor noted.

I selected to use the Text Editor - either of the e.exe versions - simply because it is likely to exist on most systems. However, as the app develops I see no reason to not offer the user a choice of editor. As the output of smartctl was intended for a command window whatever editor is chosen will have to be set to System VIO font to maintain the output format.

Yes, the IBM e.exe original version can be set to use that font and the smartctl output format is then maintained.


@Dariusz
Sorry PMsmartctl_Test1 has not worked for you, not sure where to look for the problem... Can you post a screenshot of the app suffering a "softlock".
Yes, written using WDSibyl so a sort of Delphi-like version of (Object) Pascal - a fairly easy language/development system to get to grips with.


Regards

Pete
Title: Re: OS2AHCI interface?
Post by: Dariusz Piatkowski on April 16, 2020, 05:15:01 am
Hi Pete!

@Dariusz
Sorry PMsmartctl_Test1 has not worked for you, not sure where to look for the problem... Can you post a screenshot of the app suffering a "softlock".
Yes, written using WDSibyl so a sort of Delphi-like version of (Object) Pascal - a fairly easy language/development system to get to grips with...

EUREKA!!!

Yeah, that moment when you've done everything you could think of and then it dawns on you "...I've got that little app running here that's got an EXCEPTION list for a reason...".

That app is X-it, great helper add-on, but it is known for having a potential issue with some applications, most notably those which use VisualREXX DLLs. Not the case for your app, but I gave it a try none the less.

Indeed, that was the fix. Your app now works, no problem. Nice and clean, I can pull up the S.M.A.R.T. details on all the devices.

If there is one suggestion I would make, it is the following: for ATAPI devices (so CD/DVD) perhaps there is a way to identify them accordingly?

In my case I have 3 storage devices on separate AHCI channel ports and a single DVD drive on SATA/IDE channel. But your application shows the DVD as PATA device (which it is not), it is hooked up to a SATA IDE channel after all.

Not sure how easy (or hard) it is to detect this based on smartctl response. I do see it coming back as ATA/ATAPI-7 device with no ATA SMART support, see below.

Code: [Select]
smartctl 7.0 (build date Oct 19 2019) [i386-pc-os2-emx] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     HL-DT-ST DVDRAM GH22NS50
Serial Number:    K2ZA3OC1424
Firmware Version: TN02
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA/ATAPI-7 T13/1532D revision 4a
SATA Version is:  SATA 2.6, 1.5 Gb/s
Local Time is:    Wed Apr 15 23:07:44 2020 EDT
SMART support is: Unavailable - Packet Interface Devices [this device: CD/DVD] don't support ATA SMART
AAM feature is:   Unavailable
APM feature is:   Unavailable
Rd look-ahead is: Unavailable
Write cache is:   Unavailable
DSN feature is:   Unavailable
ATA Security is:  Unavailable
Wt Cache Reorder: Unavailable

A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.

Anyways, thank you, appreciate your willingness to help me in debugging this issue!
Title: Re: OS2AHCI interface?
Post by: Pete on April 16, 2020, 06:14:26 am
Hi Dariusz

Glad you got PMsmartctl running although why it should need to be on an exception list of some sort I have no idea...

PMsmartctl simply shows whatever "smartctl --scan" finds. If the DVD shows as PATA then it is being reported as PATA by the smartctl output. My guess is a SATA DVD connected to a SATA controller port but using the PATA (danis506) driver could be the cause of that. In which case, for the purposes of both smartctl and the OS, it is considered a PATA drive.

The output you posted contains more lines than I would expect for a SATA connected SATA DVD using the AHCI driver:-

=== START OF INFORMATION SECTION ===
Device Model:     HL-DT-ST DVDRAM GH24NSC0
Serial Number:    K1RE93A5355
LU WWN Device Id: 5 001480 000000000
Firmware Version: LK00
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA8-ACS (unknown minor revision code: 0x0210)
SATA Version is:  SATA 3.0, 1.5 Gb/s
Local Time is:    Thu Apr 16 04:43:33 2020 BST
SMART support is: Unavailable - Packet Interface Devices [this device: CD/DVD] don't support ATA SMART


Yes, I use LG DVD drives as well  :-)

Here is a simple way to check the smartctl output is reported "correctly" by PMsmartctl:
After starting PMsmartctl a file will exist in your TEMP directory called SCAN.TXT Open the file with an editor and I think it will show the 3 SATA drives as ahci0 to ahci2 and the DVD as hd0 (presuming it is the only "PATA" drive connected).

Probably should add a note about this to the PMsmartctl readme.


Regards

Pete

Title: Re: OS2AHCI interface?
Post by: Dave Yeo on April 16, 2020, 06:32:11 am
It's interesting the differences in DVD drive output, mine
Code: [Select]
=== START OF INFORMATION SECTION ===
Device Model:     TSSTcorp CDDVDW SH-S243D
Serial Number:    R4116GDB400519
Firmware Version: SB00
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA/ATAPI-7 (unknown minor revision code: 0x0210)
Local Time is:    Wed Apr 15 21:23:48 2020 PDT
SMART support is: Unavailable - Packet Interface Devices [this device: CD/DVD] don't support ATA SMART
AAM feature is:   Unavailable
APM feature is:   Unavailable
Rd look-ahead is: Unavailable
Write cache is:   Unavailable
DSN feature is:   Unavailable
ATA Security is:  Unavailable
Wt Cache Reorder: Unavailable

A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.

Note nothing about the SATA support.
Meanwhile I just spent an hour trying various drive combinations before DDGing. Smartctl showed my 1 TB drive as the only one hooked up as SATA 3, and I thought that 2 ports were SATA 3. Turned out only port 0 is SATA 3, now with my SSD plugged in. Did slightly slow down the 1TB drive though.
Title: Re: OS2AHCI interface?
Post by: Pete on April 16, 2020, 02:39:37 pm
Hi Dave

No mention of SATA in your cd/dvd info output certainly stops 1 idea in it's tracks...

Guess I could add a "Drives" button which when clicked would query danis506$ and os2ahci$ to see what physical drives are attached to what controllers and display that info.

I am a bit confused by part of your post. It seems you are saying that your mainboard has a number of SATA ports but only Port 0 is SATA3 capable? Seems strange - all SATA3 controllers on several mainboards here have all ports SATA3 capable but will work with earlier SATA spec drives, obviously at the lower spec speed eg SATA2.


Regards

Pete
Title: Re: OS2AHCI interface?
Post by: ivan on April 16, 2020, 03:31:59 pm
Hi Pete,

I don't know if this info from the DVD drive on my test machine will be of help or not (it is connected to the first SATA port.

smartctl 6.6 2017-04-23 r4424 [i386-pc-os2-emx] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     ATAPI   iHAS124   F
Serial Number:    3524728 2H8806500197
Firmware Version: CL9N
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA8-ACS (minor revision not indicated)
SATA Version is:  SATA 2.6, 1.5 Gb/s
Local Time is:    Thu Apr 16 14:01:50 2020 CDT
SMART support is: Unavailable - Packet Interface Devices [this device: CD/DVD] don't support ATA SMART
AAM feature is:   Unavailable
APM feature is:   Unavailable
Rd look-ahead is: Unavailable
Write cache is:   Unavailable
DSN feature is:   Unavailable
ATA Security is:  Unavailable
Wt Cache Reorder: Unavailable

A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.

Regarding different speed SATA ports, I have seen that especially where there is more than one SATA controller chipset involved - one of them is usually a lower spec unit, hence the lower speed or may require a specific driver to get the higher speed.
 
Title: Re: OS2AHCI interface?
Post by: Dave Yeo on April 16, 2020, 04:35:23 pm
Hi Pete, my question about SATA was answered here, https://www.dell.com/community/Desktops-General-Read-Only/Optiplex-790-What-SATA-Port-is-SATA-3-0/td-p/3966182 (https://www.dell.com/community/Desktops-General-Read-Only/Optiplex-790-What-SATA-Port-is-SATA-3-0/td-p/3966182) seems the Q65 chipset supports 2 SATA 3 ports ot 4 SATA 2 ports and Dell compromised.
As for detecting DVD's, perhaps the fact that none seem to be in the smart database or that they all seem to fail a smart command?
Title: Re: OS2AHCI interface?
Post by: Pete on April 16, 2020, 06:14:51 pm
Hi Dave

Bit of a naff decision by Dell - cannot have saved them more than a penny or 2.

As I understand it CD/DVD devices do not have SMART support so I would expect them to successfully *fail* to perform a SMART command. Guess it could be used to identify CD/DVD drives but could falsely identify a failing hard disk as CD/DVD - and we would still have Dariusz problem of a PATA detected SATA DVD drive...

Had a busy day so far, not even looked at any coding. Had to clamber up a ladder and replace a broken gutter bracket before gutter fell off. Should have been a quick job but I am still recovering from double hernia repair surgery so had to take it slow and easy.

Just finished the gutter and was having coffee when my replacement monitor power supply board turned up so had a go at fixing my ancient Dell 1707FPf monitor. That went really well, took about 20 minutes and I am currently using it - not sure where the 4 screws left over after reassembly belong but monitor displays DVI or VGA successfully and the USB hub works :-)


Now to try out a few ideas with PMsmartctl - could be a couple of days before all the coding comes together though...


Regards

Pete


Title: Re: OS2AHCI interface?
Post by: Dariusz Piatkowski on April 16, 2020, 08:15:16 pm
Hi Pete!

...Glad you got PMsmartctl running although why it should need to be on an exception list of some sort I have no idea...

Oh, the need to toss your app into an exception list is not at all driven by the app itself. X-it is a handy little utility that tosses things like the little arrow up/down icon onto each and every window. That allows you to collapse a whole window into just the title bar. It has a pile of other things as well, such as folder freshes, sorting, etc. For that reason - since it interacts with each particular window - it may at times hit an app which does NOT like this. In such cases the said app may act weirdly, or not run at all. Well, in your case that's exactly what was hapenning. Once I tossed it onto the X-it list that prevented X-it from attempting to hi-jack your apps title bar.

...PMsmartctl simply shows whatever "smartctl --scan" finds. If the DVD shows as PATA then it is being reported as PATA by the smartctl output. My guess is a SATA DVD connected to a SATA controller port but using the PATA (danis506) driver could be the cause of that. In which case, for the purposes of both smartctl and the OS, it is considered a PATA drive...

Hmm, good point, so here is the 'smartctl --scan' output:

Code: [Select]
[G:\]smartctl --scan
ahci0 -d ata # ahci0, ATA device
hd0 -d ata # hd0, ATA device
ahci1 -d ata # ahci1, ATA device
ahci2 -d ata # ahci2, ATA device

You will note that the three hard-drive storage devices are all on a AHCI controller, while the DVD is on the IDE controller.

That means:
1) AHCI - supported by OS2AHCI driver
2) IDE - supported by DANIS506 driver

You are right though, based on what comes back here you simply can not tell what type of a device any of these are. This was a good reminder of what smartctl produces. I have a long time ago switched to running the monitoring through smartd (daemon mode) and logging all outputs to my NAS box.

But...looking further into smartctl I found the following: issuing the '--identify' parameter will in fact tell you whether a given device is an ATA (hard-drive storage) or ATAPI (device reader), following 'smartctl --identify hd0' gives:

Code: [Select]
smartctl 7.0 (build date Oct 19 2019) [i386-pc-os2-emx] (local build)
Copyright (C) 2002-18, Bruce Allen, Christian Franke, www.smartmontools.org

=== ATA IDENTIFY DATA ===
Word     Bit     Value   Description

   0      -     0x85c0   General configuration
   0     15          1   Device identifier: 0 = ATA, 1 = ATAPI
   0     12:8     0x05   ATAPI: Command set: 0x05 = CD/DVD
   0      7          1   Removable media device [OBS-8]
   0      6:5      0x2   ATAPI: DRQ after PACKET cmd: 0x0 = 3ms, 0x2 = 50us
...

The following are two key pieces of info:

1)    0     15          1   Device identifier: 0 = ATA, 1 = ATAPI
2)    0      7          1   Removable media device [OBS-8]

Now...do you want to get into this level of pre-processing before your window comes up with the mapping of the devices into logical groupings though?...sure enough that app is quickly transforming into a storage device quasi-sysinfo type of a thing..but it would rock!!!

Also, the above is just a front end section, but further on at the very tail-end of the output you will find the following:

Code: [Select]
...
222      -     0x101f   Transport major version number
222     15:12     0x1   Transport: 0x0 = Parallel, 0x1 = Serial, 0xe = PCIe
222      4          1   Reserved    | SATA 2.6
222      3          1   Reserved    | SATA 2.5
222      2          1   Reserved    | SATA II: Extensions
222      1          1   ATA/ATAPI-7 | SATA 1.0a
222      0          1   ATA8-APT    | ATA8-AST
...

And in this case you can actually tell whether it's a Parallel, Serial or even PCIe device.
Title: Re: OS2AHCI interface?
Post by: Pete on April 20, 2020, 09:03:42 pm
Hi Dariusz

I knew I had bumped into the X-it problem somewhere before but had to dig up a copy of USBcfg readme to check. When I first released USBcfg someone reported a problem starting USBcfg which turned out to be X-it related.

Not knowing X-it myself I wonder why there is a problem with USBcfg and PMsmartcl. What the 2 apps have in common is that they are both developed using WDSibyl and, probably more to the point, both use a non-resizeable window with only Minimise and Close icons. I suspect X-it is not able to add it's icon to this type of window.

Out of Interest: Why is your SATA DVD connected to a SATA Adapter but using the IDE driver rather than AHCI?

Thanks for pointing out the smartctl '--identify' option, not sure how I missed it before, now added to PMsmartcl options also added code for choosing a Text Editor, should be releasing an update soon - just need to work out a bit more code.

Not sure about developing "a storage device quasi-sysinfo type of a thing" though...


Regards

Pete
Title: Re: OS2AHCI interface?
Post by: Sean Casey on April 21, 2020, 01:17:53 am
I suspect X-it is not able to add it's icon to this type of window.

Xit has a feature called an exception list, containing the names of programs that Xit should not perform its title bar functions on.
Title: Re: OS2AHCI interface?
Post by: Pete on April 21, 2020, 11:15:29 am
Hi Sean

Yes, my question is: What do the apps that need to go on the X-it exception list have in common? - I suspect it may be the window type ie a non-resizeable window with only Minimise and Close icons.


Regards

Pete
Title: Re: OS2AHCI interface?
Post by: Pete on April 22, 2020, 12:04:45 am
Hi All

Tweaked PMsmartctl a little:- 

Interface modifications:
  Added a Help button
  Added the "Identify" Radio Button to the Show Information options
  Added option allowing user to select preferred Text Editor
Added a Help file
Modified readme.txt

I have attached PMsmartctlBetaV0.2 for testing.


Regards

Pete
Title: Re: OS2AHCI interface?
Post by: Dariusz Piatkowski on April 22, 2020, 05:43:40 am
Hey Pete!

Hi All

Tweaked PMsmartctl a little:- 
...
I have attached PMsmartctlBetaV0.2 for testing.
...

Nice, works great here, thank you!
Title: Re: OS2AHCI interface?
Post by: David Graser on April 22, 2020, 06:06:03 pm
Hey Pete!

Hi All

Tweaked PMsmartctl a little:- 
...
I have attached PMsmartctlBetaV0.2 for testing.
...

Nice, works great here, thank you!

Hi Pete, I like what you have done.  There is one small matter.  In the text boxes, one cannot delete or backspace on the text.  One has to use the browse button to select the locations. One canot manually enter the exe location or editor location.  Maybe have a checkbox listing default editor is EPM.exe.  Uncheck and the box to select another editor becomes available.  However, it is much appreciated what you have done. It does do everything you intended it to do.  What I suggest is just a suggestion and nothing more. Thanks!
Title: Re: OS2AHCI interface?
Post by: Pete on April 22, 2020, 07:59:55 pm
Hi David

The entryfields for smartctl.exe and Text Editor force the user to use the file dialog to locate the required app - much better than having a "support issue" due to a user typo  :-)

However, as I plan to use the app in an article to illustrate building applications with WDSibyl I will be making the full source code available. You will then be able to change the behaviour of the entryfields - and anything else - to suit your way of doing things.

Sorry I do not have a time frame for this but bear with me for a few weeks.

Regards

Pete
Title: Re: OS2AHCI interface?
Post by: ivan on April 23, 2020, 12:47:11 am
Hi Pete,

Thanks for the editor selection, using EPM I can select mono font and get a well formatted display.
Title: Re: OS2AHCI interface?
Post by: Pete on April 23, 2020, 02:35:48 pm
Hi ivan

Glad it meets with your approval  :-)

Pete