OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Antwort: [Muscle] SCardEstablishContext question..

Martin.Fuehrlingeromnikey.com
Date: Mon Apr 04 2005 - 23:52:58 CDT


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 martin.fuehrlingeromnikey.com
Web www.omnikey.com

                                                                           
             "Naveen Mukkelli"
             <Naveenworldsmar
             t.com.au> An
             Gesendet von: <musclelists.musclecard.com>
             muscle-bouncesli Kopie
             sts.musclecard.co
             m Thema
                                        [Muscle] SCardEstablishContext
                                        question..
             05.04.2005 04:22
                                                                           
                                                                           
              Bitte antworten
                    an
                  MUSCLE
             <musclelists.mus
               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
Musclelists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle

_______________________________________________
Muscle mailing list
Musclelists.musclecard.com
http://lists.drizzle.com/mailman/listinfo/muscle