aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2017-01-23 07:12:41 +0000
committerNIIBE Yutaka <[email protected]>2017-01-23 07:12:41 +0000
commit21c9ebb908c2ad2e322e7a13e59e5880494c4d67 (patch)
tree6419a9779247eb8850305d33387a7ef22dd890ed
parentbuild: Print a commit id in the generated ChangeLog (diff)
downloadgnupg-21c9ebb908c2ad2e322e7a13e59e5880494c4d67.tar.gz
gnupg-21c9ebb908c2ad2e322e7a13e59e5880494c4d67.zip
scd: Fix INTERRUPT transfer.
* scd/ccid-driver.c (find_endpoint): Don't return Bulk endpoint as Interrupt endpoint. (ccid_poll): Call libusb_interrupt_transfer. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--scd/ccid-driver.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c
index 5e02628e1..b7f97edb0 100644
--- a/scd/ccid-driver.c
+++ b/scd/ccid-driver.c
@@ -1100,8 +1100,9 @@ find_endpoint (const struct libusb_interface_descriptor *ifcdesc, int mode)
== LIBUSB_TRANSFER_TYPE_INTERRUPT)
&& (ep->bEndpointAddress & 0x80))
return ep->bEndpointAddress;
- else if (((ep->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK)
- == LIBUSB_TRANSFER_TYPE_BULK)
+ else if ((mode == 0 || mode == 1)
+ && ((ep->bmAttributes & LIBUSB_TRANSFER_TYPE_MASK)
+ == LIBUSB_TRANSFER_TYPE_BULK)
&& (ep->bEndpointAddress & 0x80) == want_bulk_in)
return ep->bEndpointAddress;
}
@@ -2459,9 +2460,9 @@ ccid_poll (ccid_driver_t handle)
if (handle->idev)
{
- rc = libusb_bulk_transfer (handle->idev, handle->ep_intr,
- (char*)msg, sizeof msg, &msglen,
- 0 /* ms timeout */ );
+ rc = libusb_interrupt_transfer (handle->idev, handle->ep_intr,
+ (char*)msg, sizeof msg, &msglen,
+ 0 /* ms timeout */ );
if (rc == LIBUSB_ERROR_TIMEOUT)
return 0;
}