Detecting hard-disk (incl. SSD) related devices

This forum is for general developer support questions.
Post Reply
User avatar
abalaban
Beta Tester
Beta Tester
Posts: 456
Joined: Mon Dec 20, 2010 2:09 pm
Location: France
Contact:

Detecting hard-disk (incl. SSD) related devices

Post by abalaban »

For a project I have I should be able to detect amigaos devices with hard-disk related connected devices.
For now I'm using AllocDosObject(ADO_DEVICESLIST, ) but I'm rightly obtaining not HD related devices (printer.device, diskimage.device, etc.) too. I would want to be able to filter out those devices to only keep those I can handle.
In fact I am looking for getting the same device list that MediaToolBox presents at startup, how can I do that?
AmigaOne X1000 running AOS 4 beta
AmigaOne XE/G4
Amiga 1200/PPC 603e + BVision PPC
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: Detecting hard-disk (incl. SSD) related devices

Post by ssolie »

Try a NSCMD_DEVICEQUERY command and check for NSDEVTYPE_TRACKDISK devices. I believe all the devices on AmigaOS 4.x are NSD compliant.
ExecSG Team Lead
User avatar
colinw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 218
Joined: Mon Aug 15, 2011 10:20 am
Location: Brisbane, QLD. Australia.

Re: Detecting hard-disk (incl. SSD) related devices

Post by colinw »

Firstly it's; AllocDosObject(DOS_VOLUMELIST, ) [not ADO_DEVICELIST]
So, for this reply, I will assume you are actually using; DOS_VOLUMELIST with the tag; ADO_Type set to LDF_DEVICES.

If this is the case, you may wish to filter the devices returned first by using IDOS->IsFileSystem(),
that will at least filter out all the stream handlers and such like DOS devices.

If you are interested just in mounted volumes, then I would suggest LDF_VOLUMES would be
more appropriate, these would be only the volumes that appear on workbench.
User avatar
abalaban
Beta Tester
Beta Tester
Posts: 456
Joined: Mon Dec 20, 2010 2:09 pm
Location: France
Contact:

Re: Detecting hard-disk (incl. SSD) related devices

Post by abalaban »

Thank you Steven and Colin for your answer.

Steven for the NSCMD_DEVICEQUERY I had the impression it will be something like that but I was unable to find an autodoc on the subject. Now that I know what to look for I can see several articles on the subject in the wiki. Thanks, I'll look at them.

Colin, you are right it is DOS_VOLUMELIST, it was my mistake I wrote the message out of memory without access to my code or AmigaOS machine. Yes I'm querying LDF_DEVICES, then I'm calling GetDiskFileSystemData() to obtain the device name and unit number (which is the information I'm looking for). I would prefer to obtain any device even if there is no mounted or usable partition on it, so LDF_VOLUMES would not be good. Ideally a brand new HD connected to the Amiga should be detected, but that would not be the case with that method. We discussed the matter with Guillaume 'zzd10h' Boesel and in his SysMon tool he is using SysBase->DeviceList to retrieve the device list to use in his "IDETool" tab. That's probably what MTB is doing to show in his startup window but if I can avoid messing with system structures I will be happy ;-)
AmigaOne X1000 running AOS 4 beta
AmigaOne XE/G4
Amiga 1200/PPC 603e + BVision PPC
Post Reply