* "Felix C. Stegerman" <f...@obfusk.net> [2021-02-11 18:09]:
> I forgot to mention that I first tried removing the 
> 
>   handle->id_product == SCM_SPR532
> 
> check in ccid_vendor_specific_setup(), but that didn't work.

Which makes sense since SCM_SPR532 and SCM_SPR332 apparently have the
same product id.

I've attached an improved patch.

- Felix
--- gnupg2-2.2.27.orig/scd/ccid-driver.c
+++ gnupg2-2.2.27/scd/ccid-driver.c
@@ -1304,10 +1304,20 @@
 {
   if (handle->id_vendor == VENDOR_SCM && handle->id_product == SCM_SPR532)
     {
+      libusb_clear_halt (handle->idev, handle->ep_intr);
+    }
+  return 0;
+}
+
+
+static int
+ccid_vendor_specific_transceive_setup (ccid_driver_t handle)
+{
+  if (handle->id_vendor == VENDOR_SCM && handle->id_product == SCM_SPR532)
+    {
       DEBUGOUT ("sending escape sequence to switch to a case 1 APDU\n");
       send_escape_cmd (handle, (const unsigned char*)"\x80\x02\x00", 3,
                        NULL, 0, NULL);
-      libusb_clear_halt (handle->idev, handle->ep_intr);
     }
   return 0;
 }
@@ -3583,6 +3593,8 @@
   if (pininfo->fixedlen < 0 || pininfo->fixedlen >= 16)
     return CCID_DRIVER_ERR_NOT_SUPPORTED;
 
+  ccid_vendor_specific_transceive_setup (handle);
+
   msg = send_buffer;
   msg[0] = cherry_mode? 0x89 : PC_to_RDR_Secure;
   msg[5] = 0; /* slot */

Reply via email to