sc_connect_card(3) Connect to smart card in reader

SYNOPSIS


#include <opensc.h>
int sc_connect_card(sc_reader_t *reader, int slot, sc_card_t **card);

DESCRIPTION

This function connects to a card in a reader, resets the card and retrieves the ATR (Answer To Reset). Based on the ATR, it tries to auto-detect which card driver to use.

The slot parameter identifies the card reader's slot. Slots are numbered consecutively, starting at 0.

If OpenSC was able to connect to the card, a pointer to the sc_card_t object is stored in the location pointer to by the card parameter. The card handle should be released with sc_disconnect_card when no longer in use.

RETURN VALUE

Returns 0 if successful, or a negative value in case of error.