Alan, Thank you for explaining this error. I have two machines that I use for development and I couldn't figure out why the application would run on one but not the other. This seems to explain everything. I looked everywhere for the definition of 8010002e and couldn't find one. Good job hunting it down.
After further investigation it appears that the card terminal factories listed in the opencard.properties file are responsible for adding entries to the global opencard registry. Maybe the PC/SC factory is to blame. In SmartCard.configureTerminalRegistry() there is a call to createCardTerminals(terminalRegistry, params) that tells a specific terminal factory to create a card terminal and register it to the CardTerminalRegistry. This appears to be implemented in Pcsc10CardTerminalFactory by calling ListReaders() which calls SCardListReaders(). Is it possible that ScardListReaders is returning a list that includes readers that are not plugged in? Jon -----Original Message----- From: Alan Kozlay [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 6:33 AM To: [EMAIL PROTECTED] Subject: [OCF] Found cause of errors in PC/SC bridge Sorry if I have posted this before but I'm having trouble posting to the site. I'm a veteran PC/SC programmer and I've written CardServices for the Datakey 330 card. My code worked fine with my current USB reader (reader type doesn't matter) then I installed a 2nd USB reader and I received the error below. This error also shows up if you only have 1 installed USB reader but remove it before running OpenCard. - Please confirm this with your code !!!!! ------------------------------------------------------------------------ ------------ Pcsc10CardTerminal: PCSC Exception in method SCardGetStatusChange: error executing SCardGetStatusChange return code = 8010002e I found the reference to the error code in: Microsoft Embedded\wce300\Pocket PC 2002\include\WINERROR.H Don't ask me why it was in that compiler and not Visual C++ 5.0's. Anyway, it's the SCARD_E_NO_READERS_AVAILABLE error. Why?, here's why: In line 133 of class: opencard.core.event.EventGenerator() there is the following method: public void createEventsForPresentCards(CTListener ctListener) throws CardTerminalException { Enumeration e = CardTerminalRegistry.getRegistry().getCardTerminals(); while (e.hasMoreElements()) { CardTerminal ct = (CardTerminal)e.nextElement(); int slots = ct.getSlots(); for (int i=0; i<slots; i++) { if (ct.isCardPresent(i)) { ctListener.cardInserted(new CardTerminalEvent(ct, CardTerminalEvent.CARD_INSERTED, i)); } } } } This method gets the list of readers to search through from the system registry. That's incorrect because not all of those registered readers will be plugged into the computer at that time. This method should get the list of readers from PC/SC's SCardListReaders() which returns the CURRENTLY PLUGGED IN READERS!!!!!!!!!. As soon as ct.getSlots() is called on a reader that is not plugged into the system you get the error. Why doesn't everyone get this error? Because it depends on how far down the list of readers it gets before it hits one that's not really plugged into the computer. If you've only installed one reader, you won't get this error. Windows OS comes with 4 virtual readers installed that are always "connected". Then there's your intended USB reader (installed and plugged in) and then, say, one more USB reader installed but not plugged into the computer at that time. If this method tries your intended (and plugged in) reader before trying the not-plugged in reader then the error will not show up. But it's really luck of the draw. In essence, if two USB readers are installed then only the 1st one listed in the registry will work. Even if your application seems to work fine now, it might fail when a 2nd USB reader is installed in the user's machine. (depending on where is falls in the registry) This could also be the cause of other errors when retrieving reader information such as how many readers and their names, ect. Please confirm. -Alan Alan Kozlay Software/Hardware Engineer Biometric Associates, Inc. [EMAIL PROTECTED] www.biometricassociates.com 9475 Deerco Rd. Suite 410 Lutherville, MD 21093 (410) 252-7210 desk (410) 252-7214 fax --- > Visit the OpenCard web site at http://www.opencard.org/ for more > information on OpenCard---binaries, source code, documents. > This list is being archived at http://www.opencard.org/archive/opencard/ ! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email ! to ! [EMAIL PROTECTED] ! containing the word ! unsubscribe ! in the body. --- > Visit the OpenCard web site at http://www.opencard.org/ for more > information on OpenCard---binaries, source code, documents. > This list is being archived at http://www.opencard.org/archive/opencard/ ! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email ! to ! [EMAIL PROTECTED] ! containing the word ! unsubscribe ! in the body.
