Logo Search packages:      
Sourcecode: pcsc-lite version File versions  Download package

LONG IFDControl ( READER_CONTEXT rContext,
DWORD  ControlCode,
LPCVOID  TxBuffer,
DWORD  TxLength,
LPVOID  RxBuffer,
DWORD  RxLength,
LPDWORD  BytesReturned 
)

Provide a means for toggling a specific action on the reader such as swallow, eject, biometric.

Definition at line 419 of file ifdwrapper.c.

References IFD_ERROR_INSUFFICIENT_BUFFER, IFD_NO_SUCH_DEVICE, IFD_NOT_SUPPORTED, IFD_SUCCESS, IFDHControl(), ReaderContext::mMutex, ReaderContext::psFunctions, ReaderContext::psFunctions_v3, SCARD_E_INSUFFICIENT_BUFFER, SCARD_E_NOT_TRANSACTED, SCARD_E_READER_UNAVAILABLE, SCARD_E_UNSUPPORTED_FEATURE, SCARD_S_SUCCESS, ReaderContext::slot, and ReaderContext::version.

Referenced by SCardControl().

{
      RESPONSECODE rv = IFD_SUCCESS;

#ifndef PCSCLITE_STATIC_DRIVER
      RESPONSECODE(*IFDH_control) (DWORD, DWORD, LPCVOID, DWORD, LPVOID, DWORD, LPDWORD);
#endif

      if (rContext->version < IFD_HVERSION_3_0)
            return SCARD_E_UNSUPPORTED_FEATURE;

#ifndef PCSCLITE_STATIC_DRIVER
      IFDH_control = rContext->psFunctions.psFunctions_v3.pvfControl;
#endif

      /* LOCK THIS CODE REGION */
      (void)pthread_mutex_lock(rContext->mMutex);

#ifndef PCSCLITE_STATIC_DRIVER
      rv = (*IFDH_control) (rContext->slot, ControlCode, TxBuffer,
            TxLength, RxBuffer, RxLength, BytesReturned);
#elif defined(IFDHANDLERv3)
      rv = IFDHControl(rContext->slot, ControlCode, TxBuffer,
            TxLength, RxBuffer, RxLength, BytesReturned);
#endif

      /* END OF LOCKED REGION */
      (void)pthread_mutex_unlock(rContext->mMutex);

      if (rv == IFD_SUCCESS)
            return SCARD_S_SUCCESS;
      else
      {
            Log2(PCSC_LOG_ERROR, "Card not transacted: %ld", rv);
            Log3(PCSC_LOG_DEBUG, "ControlCode: 0x%.8lX BytesReturned: %ld",
                  ControlCode, *BytesReturned);
            LogXxd(PCSC_LOG_DEBUG, "TxBuffer ", TxBuffer, TxLength);
            LogXxd(PCSC_LOG_DEBUG, "RxBuffer ", RxBuffer, *BytesReturned);

            if (rv == IFD_NO_SUCH_DEVICE)
            {
                  (void)SendHotplugSignal();
                  return SCARD_E_READER_UNAVAILABLE;
            }

            if ((IFD_ERROR_NOT_SUPPORTED == rv) || (IFD_NOT_SUPPORTED == rv))
                  return SCARD_E_UNSUPPORTED_FEATURE;

        if (IFD_ERROR_INSUFFICIENT_BUFFER ==rv)
            return SCARD_E_INSUFFICIENT_BUFFER;

            return SCARD_E_NOT_TRANSACTED;
      }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index