2005-03-02 00:30:24 +00:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
2005-02-23 02:52:20 +00:00
|
|
|
<refentry id="scchecksw">
|
2005-03-02 00:30:24 +00:00
|
|
|
<refentryinfo><title>OpenSC API Reference</title></refentryinfo>
|
2005-02-23 02:52:20 +00:00
|
|
|
<refmeta>
|
|
|
|
<refentrytitle>sc_check_sw</refentrytitle>
|
|
|
|
<manvolnum>3</manvolnum>
|
|
|
|
<refmiscinfo>opensc</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
<refnamediv>
|
|
|
|
<refname>sc_check_sw</refname>
|
|
|
|
<refpurpose>Check return status from a card transaction</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Synopsis</title>
|
|
|
|
<para>
|
|
|
|
<programlisting>
|
|
|
|
#include <opensc.h>
|
|
|
|
|
|
|
|
int sc_check_sw(struct sc_card *card, int sw1, int sw2);
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<para>
|
|
|
|
This function checks the return status as given in <emphasis>sw1</emphasis>
|
|
|
|
and <emphasis>sw2</emphasis> against the card-specific errors of
|
|
|
|
<emphasis>card</emphasis>. These are set by <link
|
|
|
|
linkend="sctransmitapdu">sc_transmit_apdu()</link> in the
|
|
|
|
<structfield>apdu.sw1</structfield> and <structfield>apdu.sw2</structfield>
|
|
|
|
fields, respectively.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The function should be called after every APDU transmission, to convert the
|
|
|
|
card's status code to an OpenSC error code.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Return value</title>
|
|
|
|
<para>
|
|
|
|
Returns 0 if successful, or a negative value in case of error.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|