Check if device is active

This forum is for general developer support questions.

Check if device is active

Postby mritter0 » Mon May 29, 2017 9:03 pm

I am having no luck at scanning the device list and skipping the ones that are not fully mounted yet (Activate=0; in mountlist and not accessed yet). All the functions I have been using activates it when it should be skipping it.

How do I skip them?
Code: Select all
   if ((ADOList=IDOS->AllocDosObjectTags(DOS_VOLUMELIST,
      ADO_Type,                        LDF_DEVICES|LDF_READ,
      ADO_AddColon,                     FALSE,
   TAG_DONE)))
   {
      for(node=IExec->GetHead(ADOList); node; node=IExec->GetSucc(node))
      {
         if ((dl=IDOS->LockDosList(LDF_DEVICES|LDF_READ)))
         {
            if ((dl=IDOS->FindDosEntry(dl,node->ln_Name,LDF_DEVICES|LDF_READ) ))
            {
               if (dl->dol_Type==DLT_DEVICE)
               {
// if not fully mounted (Activate=0;) then skip
// else add to list
               }
            }

            IDOS->UnLockDosList(LDF_DEVICES|LDF_READ);
         }
      }

      IDOS->FreeDosObject(DOS_VOLUMELIST,ADOList);
   }
Workbench Explorer - A better way to browse drawers
User avatar
mritter0
 
Posts: 183
Joined: Mon Aug 25, 2014 10:41 pm
Location: Bettendorf, IA, USA

Re: Check if device is active

Postby thomasrapp » Tue May 30, 2017 8:30 am

I guess that dol_Port would be NULL if the device is not active.
User avatar
thomasrapp
 
Posts: 238
Joined: Sun Jun 19, 2011 12:22 am

Re: Check if device is active

Postby mritter0 » Wed May 31, 2017 12:37 am

You are correct, sir. Thank you.
Workbench Explorer - A better way to browse drawers
User avatar
mritter0
 
Posts: 183
Joined: Mon Aug 25, 2014 10:41 pm
Location: Bettendorf, IA, USA

Re: Check if device is active

Postby colinw » Wed May 31, 2017 2:09 am

I wrote the ACTION_STARTUP dospacket documentation to show how it all works...
Also, "if (dl->dol_Type==DLT_DEVICE)" is redundant, because the FindDosEntry() filters by flags.

====================================================================
* FUNCTION
* This action has the same value as ACTION_NIL (0)
* however it is always used by dos.library as a handshake mechanism
* to start up handlers and filesystems.
*
* When dos.library sends this packet to the process message port of a
* handler or filesystem, the following sequence will occur.
*
* (1) DOS will first check if this handler is already running by looking
* to see if devicenode->dn_Port != NULL then (6), otherwise ...
*
* (2) DOS library will check if the module requires loading by looking
* to see if the devicenode->dn_SegList != ZERO, if it is already
* loaded then (4), otherwise ...
*
* (3) DOS will obtain the loadable name from devicenode->dn_Handler,
* if that is valid, DOS will attempt to IDOS->LoadSeg() it,
* once loaded, the devicenode->dn_SegList will be initialised.
*
* (4) A DOS process will be started for this handler device, the name of
* this process will default to the same as the devicenode->dn_Name,
* from V53.102 handler version information is appended to the name.
*
* (5) The ACTION_STARTUP packet will be sent to the default process
* message port, DOS will wait for the packet to return.
*
* (6) The message port will be extracted from either the result of
* the startup packet (from dp_Arg4) or the devicenode->dn_Port.
* (See notes below).
*
====================================================================
User avatar
colinw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 155
Joined: Mon Aug 15, 2011 10:20 am
Location: Brisbane, QLD. Australia.


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron