Good Morning !

You need to run pcscd to use you SmartCard Reader, If it runs in background
or manually started with "pcscd -f -d stdout" doesn't matter.

pcsc is the demon which interacts with you CardReader, load the right
driver file and so on, just like the ResourceManager in Windows. if it is
not started, there is no interaction with your reader.

You need not insert a card to SCardEstablishContext(...), Card insertion is
needed by SCardConnect(...).

General Hint: If you do get any error from an SCard function print the
errorcode, f.e. "printf("SCardConnect returns: %08X",returncode);". It is
much easier to determine the problem you have with the right errormessage
instead of SUCCESS / FAILURE.

---
Mit freundlichen GrÃÃen
Best regards,

Martin FÃhrlinger
Software Developer

OMNIKEY
Ferihumerstrasse 13
A-4040 Linz
Austria

Tel        +43 (0) 732 / 602220  - 35
E-Mail    [EMAIL PROTECTED]
Web       www.omnikey.com


                                                                           
             "Naveen Mukkelli"                                             
             <[EMAIL PROTECTED]                                             
             t.com.au>                                                  An 
             Gesendet von:              <[email protected]>      
             [EMAIL PROTECTED]                                       Kopie 
             sts.musclecard.co                                             
             m                                                       Thema 
                                        [Muscle] SCardEstablishContext     
                                        question..                         
             05.04.2005 04:22                                              
                                                                           
                                                                           
              Bitte antworten                                              
                    an                                                     
                  MUSCLE                                                   
             <[EMAIL PROTECTED]                                             
               clecard.com>                                                
                                                                           
                                                                           




Hi,

 Iâm learning to write application for Smart cards using  âwinscard.hâ

 Iâve written the following code,


#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<unistd.h>
#include<string.h>

#include<PCSC/winscard.h>
#include<PCSC/wintypes.h>
#include<pcsclite.h>

int main()
{

            SCARDCONTEXT hContext;
            LONG         rv;


            rv =
SCardEstablishContext(SCARD_SCOPE_SYSTEM,NULL,NULL,&hContext);

            if( rv == SCARD_S_SUCCESS )
            {
                        printf("Success\n");
            }
            else
            {
                        printf("Failure\n");
            }
            return 0;
}

When I run this code, Iâm getting âFailureâ after couple of minutes. But
when I use âpcscd âf âd stdoutâ and insert the same card in the card
reader, it is working.  What could be the problem?

Kindly let me know.


Cheers,

Naveen.
 _______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to