This function requests connection to the smart card or the reader, using the appropriate reset type and protocol.
The SCardConnectfunction requests access to the smart card or the reader. Upon success, it is then possible to call SCardTransmit.
If AccessMode is set to SCARD_AM_READER, PreferredProtocols must be set to SCARD_PROTOCOL_UNDEFINED and CardAction to SCARD_CA_NORESET else function fails with EFI_INVALID_PARAMETER.
- Parameters
-
[in] | This | Indicates a pointer to the calling context. |
[in] | AccessMode | Codes of access mode. |
[in] | CardAction | SCARD_CA_NORESET, SCARD_CA_COLDRESET or SCARD_CA_WARMRESET. |
[in] | PreferredProtocols | Bitmask of acceptable protocols. |
[out] | ActiveProtocol | A flag that indicates the active protocol. |
- Return values
-
EFI_SUCCESS | The requested command completed successfully. |
EFI_INVALID_PARAMETER | This is NULL |
EFI_INVALID_PARAMETER | AccessMode is not valid. |
EFI_INVALID_PARAMETER | CardAction is not valid. |
EFI_INVALID_PARAMETER | Invalid combination of AccessMode/CardAction/ PreferredProtocols. |
EFI_NOT_READY | A smart card is inserted but failed to return an ATR. |
EFI_UNSUPPORTED | PreferredProtocols does not contain an available protocol to use. |
EFI_NO_MEDIA | AccessMode is set to SCARD_AM_CARD but there is no smart card inserted. |
EFI_ACCESS_DENIED | Access is already locked by a previous SCardConnectcall. |
EFI_DEVICE_ERROR | Any other error condition, typically a reader removal. |
This function releases a connection previously taken by SCardConnect.
The SCardDisconnect function releases the lock previously taken by SCardConnect. In case the smart card has been removed before this call, thisfunction returns EFI_SUCCESS. If there is no previous call to SCardConnect, this function returns EFI_SUCCESS.
- Parameters
-
[in] | This | Indicates a pointer to the calling context. |
[in] | CardAction | Codes for card action. |
- Return values
-
EFI_SUCCESS | The requested command completed successfully. |
EFI_INVALID_PARAMETER | This is NULL |
EFI_INVALID_PARAMETER | CardAction value is unknown. |
EFI_UNSUPPORTED | Reader does not support Eject card feature (disconnect was not performed). |
EFI_DEVICE_ERROR | Any other error condition, typically a reader removal. |
This function retrieves some basic information about the smart card and reader.
The SCardStatusfunction retrieves basic reader and card information.
If ReaderName, State, CardProtocolor Atris NULL, the function does not fail but does not fill in such variables.
If EFI_SUCCESS is not returned, ReaderName and Atr contents shall not be considered as valid.
- Parameters
-
[in] | This | Indicates a pointer to the calling context. |
[out] | ReaderName | A pointer to a NULL terminated string that will contain the reader name. |
[in,out] | ReaderNameLength | On input, a pointer to the variablethat holds the maximal size, in bytes,of ReaderName. On output, the required size, in bytes, for ReaderName. |
[out] | State | Current state of the smart card reader. |
[out] | CardProtocol | Current protocol used to communicate with the smart card. |
[out] | Atr | A pointer to retrieve the ATR of the smart card. |
[in,out] | AtrLength | On input, a pointer to hold the maximum size, in bytes, of Atr(usually 33). On output, the required size, inbytes, for the smart card ATR. |
- Return values
-
EFI_SUCCESS | The requested command completed successfully. |
EFI_INVALID_PARAMETER | This is NULL |
EFI_INVALID_PARAMETER | ReaderName is not NULL but ReaderNameLength is NULL |
EFI_INVALID_PARAMETER | Atr is not NULL but AtrLength is NULL |
EFI_BUFFER_TOO_SMALL | ReaderNameLength is not big enough to hold the reader name. ReaderNameLength has been updated to the required value. |
EFI_BUFFER_TOO_SMALL | AtrLength is not big enough to hold the ATR. AtrLength has been updated to the required value. |
EFI_DEVICE_ERROR | Any other error condition, typically a reader removal. |
This function sends a command to the card or reader and returns its response.
The protocol to use to communicate with the smart card has been selected through SCardConnectcall.
In case RAPDULength indicates a buffer too small to holdthe response APDU, the function fails with EFI_BUFFER_TOO_SMALL.
- Parameters
-
[in] | This | A pointer to the EFI_USBFN_IO_PROTOCOLinstance. |
[in] | CAPDU | A pointer to a byte array thatcontains the Command APDU to send to the smart card or reader. |
[in] | CAPDULength | Command APDU size, in bytes. |
[out] | RAPDU | A pointer to a byte array that will contain the Response APDU. |
[in,out] | RAPDULength | On input, the maximum size, inbytes, of the Response APDU. On output, the size, in bytes, of the Response APDU. |
- Return values
-
EFI_SUCCESS | The requested command completed successfully. |
EFI_INVALID_PARAMETER | This is NULL. |
EFI_INVALID_PARAMETER | CAPDU is NULL or CAPDULength is 0. |
EFI_BUFFER_TOO_SMALL | RAPDULength is not big enough to hold the response APDU. RAPDULength has been updated to the required value. |
EFI_NO_MEDIA | There is no card in the reader. |
EFI_NOT_READY | Card is not powered. |
EFI_PROTOCOL_ERROR | A protocol error has occurred. |
EFI_TIMEOUT | The reader did not respond. |
EFI_ACCESS_DENIED | A communication with the reader/card is already pending. |
EFI_DEVICE_ERROR | Any other error condition, typically a reader removal. |
This function provides direct access to the reader.
This function gives direct control to send commands to the driver or the reader. The ControlCode to use is vendor dependant; the only standard code defined is the one to get PC/SC part 10 features.
InBuffer and Outbuffer may be NULL when ControlCode operation does not require them.
- Parameters
-
[in] | This | Indicates a pointer to the calling context. |
[in] | ControlCode | The control code for the operation to perform. |
[in] | InBuffer | A pointer to the input parameters. |
[in] | InBufferLength | Size, in bytes, of input parameters. |
[out] | OutBuffer | A pointer to the output parameters. |
[in,out] | OutBufferLength | On input, maximal size, in bytes, to store output parameters. On output, the size, in bytes, of output parameters. |
- Return values
-
EFI_SUCCESS | The requested command completed successfully. |
EFI_INVALID_PARAMETER | This is NULL. |
EFI_INVALID_PARAMETER | ControlCode requires input parameters but: InBuffer is NULL or InBufferLenth is NULL or InBuffer is not NULL but InBufferLenth is less than expected. |
EFI_INVALID_PARAMETER | OutBuffer is not NULL but OutBufferLength is NULL. |
EFI_UNSUPPORTED | ControlCode is not supported. |
EFI_BUFFER_TOO_SMALL | OutBufferLength is not big enough to hold the output parameters. OutBufferLength has been updated to the required value. |
EFI_NO_MEDIA | There is no card in the reader and the control code specified requires one. |
EFI_NOT_READY | ControlCode requires a powered card to operate. |
EFI_PROTOCOL_ERROR | A protocol error has occurred. |
EFI_TIMEOUT | The reader did not respond. |
EFI_ACCESS_DENIED | A communication with the reader/card is already pending. |
EFI_DEVICE_ERROR | Any other error condition, typically a reader removal. |
This function retrieves a reader or smart card attribute.
Possibly supported attrib values are listed in "PC/SC specification, Part 3:
Requirements for PC-Connected Interface Devices".
- Parameters
-
[in] | This | Indicates a pointer to the calling context. |
[in] | Attrib | Identifier for the attribute to retrieve. |
[out] | OutBuffer | A pointer to a buffer that will contain attribute data. |
[in,out] | OutBufferLength | On input, maximal size, in bytes, to store attribute data. On output, the size, in bytes, of attribute data. |
- Return values
-
EFI_SUCCESS | The requested command completed successfully. |
EFI_INVALID_PARAMETER | This is NULL. |
EFI_INVALID_PARAMETER | OutBuffer is NULL or OutBufferLength is 0. |
EFI_BUFFER_TOO_SMALL | OutBufferLength is not big enough to hold the output parameters. OutBufferLength has been updated to the required value. |
EFI_UNSUPPORTED | Attribis not supported |
EFI_NO_MEDIA | There is no card in the reader and Attrib value requires one. |
EFI_NOT_READY | Attrib requires a powered card to operate. |
EFI_PROTOCOL_ERROR | A protocol error has occurred. |
EFI_TIMEOUT | The reader did not respond. |
EFI_DEVICE_ERROR | Any other error condition, typically a reader removal. |