users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with gplpcsc (PC/SC for Prolog)


From: Ludovic Rousseau
Subject: Re: Problem with gplpcsc (PC/SC for Prolog)
Date: Fri, 3 Oct 2008 11:24:13 +0200

On Thu, Oct 2, 2008 at 10:35 AM, Daniel Diaz <address@hidden> wrote:
> Hi Ludovic,
>
> I also saw the mail is no longer valid. I don't know PS/SC so I'm of little
> help. However, from the Prolog part, if a solution is missing maybe you
> should force a backtrack to obtain it.
> Try to change your code as follows:
>
> :- initialization(start0).
>
> start0 :-
>       start,
>       fail.
> start0 :-
>       write('no more solutions'), nl.
>
> NB: the initialization now calls start0 which calls start and force
> backtracking with fail. When no more solution exists the second clause of
> start0 is executed, which simply shows a message.
>
> Hope this helps

In was not a bug in the PC/SC wrapper but a bug in my Prolog code. I
did not wrote Prolog code since 10 or 15 years ago :-)
I think Prolog was trying to unified the two Commande variable but
they had two different values.

My program is now working and is:

:- 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, _ApduOut1, _Sw1, _Time1),

        print_hex_list(_ApduOut1),
        print_hex_list(_Sw1), nl,

        scard_transmit([0xA0,0x0,0,0,0], _ApduOut2, _Sw2, _Time2),

        print_hex_list(_ApduOut2),
        print_hex_list(_Sw2), nl.

:- initialization(start).


Thanks for your time

-- 
 Dr. Ludovic Rousseau




reply via email to

[Prev in Thread] Current Thread [Next in Thread]