[Gpa-commits] r940 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 27 16:58:38 CET 2009


Author: werner
Date: 2009-01-27 16:58:37 +0100 (Tue, 27 Jan 2009)
New Revision: 940

Modified:
   trunk/src/ChangeLog
   trunk/src/cardman.c
Log:
Hack to display data from a Geldkarte.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-01-26 14:17:00 UTC (rev 939)
+++ trunk/src/ChangeLog	2009-01-27 15:58:37 UTC (rev 940)
@@ -1,3 +1,8 @@
+2009-01-27  Werner Koch  <wk at g10code.com>
+
+	* cardman.c (opass_status_cb, get_serial_direct): Hack to display
+	data from a Geldkarte.
+
 2009-01-26  Werner Koch  <wk at g10code.com>
 
 	* cardman.c (ADD_TABLE_ROW): Replace macro by ..

Modified: trunk/src/cardman.c
===================================================================
--- trunk/src/cardman.c	2009-01-26 14:17:00 UTC (rev 939)
+++ trunk/src/cardman.c	2009-01-27 15:58:37 UTC (rev 940)
@@ -195,8 +195,13 @@
 {
   GpaCardManager *cardman = opaque;
 
+  /* Just for experiments, we also print some info from the Geldkarte. */
   if (!strcmp (status, "SERIALNO"))
     gtk_entry_set_text (GTK_ENTRY (cardman->entrySerialno), args);
+  else if (!strcmp (status, "X-BANKINFO"))
+    gtk_entry_set_text (GTK_ENTRY (cardman->entryManufacturer), args);
+  else if (!strcmp (status, "X-BALANCE"))
+    gtk_entry_set_text (GTK_ENTRY (cardman->entryVersion), args);
 
   return 0;
 }     
@@ -204,7 +209,7 @@
 
 
 static void
-get_serial_direct (GpaCardManager *cardman)
+get_serial_direct (GpaCardManager *cardman, int is_geldkarte)
 {
 #ifdef HAVE_GPGME_OP_ASSUAN_TRANSACT  
   gpg_error_t err;
@@ -221,9 +226,14 @@
   if (!err)
     err = gpgme_op_assuan_result (ctx);
 
-  /* Nothing to do because the status cb takes care of updating the
-     serialno.  */
+  if (is_geldkarte)
+    err = gpgme_op_assuan_transact (ctx, "SCD LEARN --force",
+                                    NULL, NULL, NULL, NULL,
+                                    opass_status_cb, cardman);
+  if (!err)
+    err = gpgme_op_assuan_result (ctx);
 
+
  leave:
   gpgme_release (ctx);
   if (err)
@@ -268,6 +278,8 @@
             cardman->cardtype = cardtype = "DINSIG";
           else if (!strcmp (string, "pkcs15-card"))
             cardman->cardtype = cardtype = "PKCS#15";
+          else if (!strcmp (string, "geldkarte-card"))
+            cardman->cardtype = cardtype = "Geldkarte";
           else
             cardtype = string;
 
@@ -278,7 +290,7 @@
               gtk_entry_set_text (GTK_ENTRY (cardman->entryVersion), "");
               gtk_entry_set_text (GTK_ENTRY (cardman->entryManufacturer), "");
               /* Try to get the serial number directly from the card.  */
-              get_serial_direct (cardman);
+              get_serial_direct (cardman, !strcmp (string, "geldkarte-card"));
             }
 
           update_info_visibility (cardman);



More information about the Gpa-commits mailing list