Hello,

I am writing an article about different PC/SC wrapper and found the
Prolog wrapper at [1].

I try to use it but can't make my sample to work. I attach my sample program.
The output I get is:
ATR: [3B FA 94 00 00 81 31 20 43 80 65 A2 01 01 01 3D 72 D6 43 21 ]
tr: 00a404000aa00000006203010c0601 - 9000, t= 14ms.
Réponse : []
SW : [144,0]
Application error in transmit APDU de test
Réponse : []
SW : [144,0]
GNU Prolog 1.3.0
By Daniel Diaz
Copyright (C) 1999-2007 Daniel Diaz
| ?-

I traced the APDU at the pcsc-lite level and the second APDU is not sent.
In some cases I could send the two APDU but after restarting the
program it failed again.

I am not a Prolog expert or even user. I learnt Prolog more than 10
years ago at school :-)

Can you help debug my sample?
And I have to submit my article in 2 days :-(

Thanks a lot for any help,

[1] http://gprolog.cvs.sourceforge.net/gprolog/contribs/gplpcsc/

-- 
 Dr. Ludovic Rousseau
:- include('pcsc/muscle').

start :-
        scard_establish_context,
        scard_connect,

        % print ATR data
        scard_status(_, Atr),
        print('ATR: '), print_hex_list(Atr), nl, 

        % enable trace
        scard_enable_verbose(true),

        (
                Commande = [0,0xA4,4,0,0x0A,0xA0,0,0,0,0x62,3,1,0x0C,6,1],
                scard_transmit(Commande, _Reponse, _Sw, _Time) -> true
        ;
                print('Application error in transmit Select Applet'), nl 
        ),
        print('Réponse : '), print(_Reponse), nl,
        print('SW : '), print(_Sw), nl,

        (
                Commande = [0,0,0,0],
                scard_transmit(Commande, _Reponse, _Sw, _Time) -> true
        ;
                print('Application error in transmit APDU de test'), nl 
        ),
        print('Réponse : '), print(_Reponse), nl,
        print('SW : '), print(_Sw), nl.

:- initialization(start).
_______________________________________________
Users-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/users-prolog

Reply via email to