Check if device is active

This forum is for general developer support questions.
Post Reply
User avatar
mritter0
Posts: 214
Joined: Mon Aug 25, 2014 9:41 pm
Location: Bettendorf, IA, USA

Check if device is active

Post by mritter0 »

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
thomasrapp
Posts: 286
Joined: Sat Jun 18, 2011 11:22 pm

Re: Check if device is active

Post by thomasrapp »

I guess that dol_Port would be NULL if the device is not active.

User avatar
mritter0
Posts: 214
Joined: Mon Aug 25, 2014 9:41 pm
Location: Bettendorf, IA, USA

Re: Check if device is active

Post by mritter0 »

You are correct, sir. Thank you.
Workbench Explorer - A better way to browse drawers

User avatar
colinw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 181
Joined: Mon Aug 15, 2011 9:20 am
Location: Brisbane, QLD. Australia.

Re: Check if device is active

Post by colinw »

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).
*
====================================================================

Post Reply