Hi, here is a new patch that:
1. adds a new function 'reset' that calls SCardUnload().
2. puts back code in SCardReconnect that was earlier commented out.

Now you can disconnect and reconnect.It works fine for me on 32 and 64 bit linux.

There are other methods that are commented out, but I don't have code that tests those, so I didn't dare comment them in again. In the corrent state they will always throw an error though. SCardControl and SCardGetAttrib, IMO it would be better to use the code, at least it can't behave worse than today :-)

Cheers,
Tomas
Index: OCFPCSC1.cpp
===================================================================
--- OCFPCSC1.cpp        (revision 1684)
+++ OCFPCSC1.cpp        (arbetskopia)
@@ -205,13 +205,13 @@
     return;
   }
 
-  /*
+  
   returnCode = SCardReconnect((SCARDHANDLE)card,
                                                (DWORD)shareMode,
                                                (DWORD)preferredProtocols,
                                                (DWORD)initialization,
                                                (LPDWORD)&activeProtocol);
-  */
+  
 
   if (returnCode != SCARD_S_SUCCESS) {
     throwPcscException(env, obj, "SCardReconnect", "PC/SC Error 
SCardReconnect", returnCode);
@@ -723,6 +723,16 @@
   return jRecvBuf;
 }
 
+/*
+ * Class:     com_ibm_opencard_terminal_pcsc10_OCFPCSC1
+ * Method:    reset
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_ibm_opencard_terminal_pcsc10_OCFPCSC1_reset
+  (JNIEnv *env, jobject obj) {
+    removeAllContexts();
+    SCardUnload();
+}
 
 
 
Index: OCFPCSC1.h
===================================================================
--- OCFPCSC1.h  (revision 1684)
+++ OCFPCSC1.h  (arbetskopia)
@@ -95,6 +95,14 @@
 JNIEXPORT jbyteArray JNICALL 
Java_com_ibm_opencard_terminal_pcsc10_OCFPCSC1_SCardTransmit
   (JNIEnv *, jobject, jlong, jbyteArray);
 
+/*
+ * Class:     com_ibm_opencard_terminal_pcsc10_OCFPCSC1
+ * Method:    reset
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_com_ibm_opencard_terminal_pcsc10_OCFPCSC1_reset
+  (JNIEnv *, jobject);
+
 #ifdef __cplusplus
 }
 #endif
 
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to