Hi,

On Tue, 17 Apr 2001, David Corcoran wrote:

> Hi,
>
> The ATR is parsed because the Resource Manager has to determine which
> protocols can be used on the card and is in charge of sending a PTS when
> the application has the choice of T=0 or T=1 and chooses the one that is
> not default.  The driver could also do this instead of the RM but when I
> proposed that I didn't get very positive results from the responses : )
>

In my opinion it would be better if the PCSC neither care about
T=0, T=1 or memory card detection. Then it would be driver
resposibility to:

* On card initialization determine card type and ATR if it exists.
* Store status information and ATR in some kind of internal hash table
correlated to the ctn (in CT-API) or lun (in ifd handler), so it can be
looked up when a command is sent to this particular ctn/lun number.

Some drivers works like this and in fact ignore protocol information
passed back by the pcsc, because they already have it.

However not all drivers works this way. So I think the pcscd can just
_try_ to parse the ATR in order to provide card type/protocol information
to the drivers that don't do this by themselves. If the parsing fails,
pcscd shouldn't modify the ATR neither return any error.

>
> I think an easy way to do this is to send back a bogus ATR such as
>
> Say your ATR for a memory card is: AD FE AC DE
>
>
> 3B 04 ad fe ac de
>
> 1) You must send 3B.
> 2) Then send the memory card's ATR as historical bytes in
>     this bogus ATR .....
>

Most memory cards (mainly 2 wire and 3 wire) have an scheme to encode
it's size on the ATR. The parsing routine should be able to recoginze this
format (see http://www.panstruga.de/ct-api/spec/spec_v09.html Part 5). For
I2C cards without ATR we can either return 0 length ATR or
format a bogus ATR following 2 wire / 3 wire rules.

***************************************************************
Linux Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/smartcard/index.html
***************************************************************

Reply via email to