opensc/doc/api/init/sc_connect_card.xml

51 lines
1.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<refentry id="scconnectcard">
<refentryinfo><title>OpenSC API Reference</title></refentryinfo>
<refmeta>
<refentrytitle>sc_connect_card</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>opensc</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sc_connect_card</refname>
<refpurpose>Connect to smart card in reader</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<para>
<programlisting>
#include &lt;opensc.h&gt;
int sc_connect_card(sc_reader_t *reader, int slot, <link linkend="sccardt">sc_card_t</link> **card);
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Description</title>
<para>
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.
</para>
<para>
The <emphasis>slot</emphasis> parameter identifies the card reader's slot. Slots are numbered
consecutively, starting at 0.
</para>
<para>
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 <emphasis>card</emphasis> parameter. The card handle should be
released with <link linkend="scdisconnectcard">sc_disconnect_card</link> when no longer in use.
</para>
</refsect1>
<refsect1>
<title>Return value</title>
<para>Returns 0 if successful, or a negative value in case of error.</para>
</refsect1>
</refentry>