Hi,
Now I understand.
I think that the problem arises from your clever layered design. T=0 was not
designed as an OSI layered protocol but as a state machine. This is why you
have to go back and forth between the layers.
-------------------------------------
if (rx_char & 0xf0 == 0x60)
> {
> rx_len = 2; /* This will overwrite rx_len = Le demanded by transport
> layer */
> }
> Like this driver will exit back to transport layer after 2 chars, as
> rx_len is now 2 and not Le.
>
> Is this what you suggesting, or I did not understand correctly ?
>
Exactly.
ISO7816 explicitly says about the procedure byte:
If the value is '6X' or '9X', except for '60', it is a SW1 byte. It requests
no action on data transfer. The
interface device shall wait for a character conveying a SW2 byte. There is
no restriction on SW2 value.
So as soon as you get this value, no data is transferred except SW2.
To make things as perfect as possible, my opinion is to change your driver
abstraction model to an upper level, and manage T=0 in a single "blob",
which can be seen as a layer by itself, but does not follow the OSI
concepts.
All experts around me agree that T=0 is not a "clean" protocol, but rather
something weird because of someone who did not notice the possible problems
before sending the document to ISO :-)
In ISO7816-3:2006, we can read about T=1:
The transmission protocol applies the principle of the OSI reference model.
Three layers are defined.
This may be a tip to all the people who complained about T=0 :-)
typical drivers provide an API like this one:
error_code_t exchange(unsigned char *command, int command_len /*known*/,
unsigned char *response, int *response_len /*discovered*/ );
Regards and sorry to partly destroy your vision :)
Sebastien
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle