IOReturn
	VectorCommand::Submit()
	{
		IOReturn status = kIOReturnSuccess;
		
		if( mInflightCount != 0 )
		{ 
			status = kIOReturnNotReady;
		}
		
		CFIndex count = 0;
		if( status == kIOReturnSuccess )
		{
			count = CFArrayGetCount( mCommandArray );
			status = EnsureCapacity( count );
		}

		if( status == kIOReturnSuccess )
		{
			// reset vector status
			mStatus = kIOReturnSuccess;
			
			for( CFIndex index = 0; (status == kIOReturnSuccess) && (index < count); index++ )
			{
				IOFireWireLibCommandRef command = (IOFireWireLibCommandRef)CFArrayGetValueAtIndex( mCommandArray, index );
			
				Cmd * cmd = IOFireWireIUnknown::InterfaceMap<Cmd>::GetThis(command);
				
				status = cmd->PrepareForVectorSubmit( &mSubmitBuffer[index] );
			}
		}

		if( status == kIOReturnSuccess )
		{
			// send the requests to the kernel

			// async ref
			uint64_t async_ref[kOSAsyncRef64Count];
			async_ref[kIOAsyncCalloutFuncIndex] = (uint64_t) 0;
			async_ref[kIOAsyncCalloutRefconIndex] = (unsigned long) 0;

			// inputs
			const uint64_t inputs[2] = { (const uint64_t)&SVectorCompletionHandler,
										 (const uint64_t)this };
			// outputs
			uint32_t output_count = 0;

			status = IOConnectCallAsyncScalarMethod( mUserClient.GetUserClientConnection(),
												  mUserClient.MakeSelectorWithObject( kVectorCommandSubmit, mKernCommandRef ),
												  mUserClient.GetAsyncPort(),
												  async_ref, kOSAsyncRef64Count,
												  inputs, 2,
												  NULL, &output_count);

			mInflightCount = count;
			
//			printf( "VectorCommand::Submit - IOConnectCallAsyncStructMethod status = 0x%08lx\n", status );
		}

		if( status == kIOReturnSuccess )
		{
			for( CFIndex index = 0; (status == kIOReturnSuccess) && (index < count); index++ )
			{
				IOFireWireLibCommandRef command = (IOFireWireLibCommandRef)CFArrayGetValueAtIndex( mCommandArray, index );
			
				Cmd * cmd = IOFireWireIUnknown::InterfaceMap<Cmd>::GetThis(command);
				
				cmd->VectorIsExecuting();				
			}			
		}
		
#if 0						
		if( status == kIOReturnSuccess )
		{
			// reset vector status
			mStatus = kIOReturnSuccess;
			
			for( CFIndex index = 0; index < count; index++ )
			{
				IOFireWireLibCommandRef command = (IOFireWireLibCommandRef)CFArrayGetValueAtIndex( mCommandArray, index );
				mInflightCount++;
				(*command)->Submit( command );
				// our commands seem to call the completion handler on error
				// so pretend all was success
			}
		}
#endif
		
//		printf( "VectorCommand::Submit - status = 0x%08lx\n", status );
		
		return status;
	}