From 6e035c33f3fd6e14963c884ad6bab680a0848795 Mon Sep 17 00:00:00 2001 From: jpwidera Date: Thu, 5 Sep 2019 22:32:03 +0200 Subject: [PATCH] Re-enabled claim If there are alternative interfaces, claim interface 0. Otherwise skip this step. --- libnfc/drivers/acr122_usb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libnfc/drivers/acr122_usb.c b/libnfc/drivers/acr122_usb.c index 609a495..8931aab 100644 --- a/libnfc/drivers/acr122_usb.c +++ b/libnfc/drivers/acr122_usb.c @@ -427,6 +427,17 @@ acr122_usb_open(const nfc_context *context, const nfc_connstring connstring) goto free_mem; } + // Check if there are more than 0 alternative interfaces and claim the first one + if (dev->config->interface->altsetting->bAlternateSetting > 0) { + res = usb_set_altinterface(data.pudh, 0); + if (res < 0) { + log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to set alternate setting on USB interface (%s)", _usb_strerror(res)); + usb_close(data.pudh); + // we failed to use the specified device + goto free_mem; + } + } + // Allocate memory for the device info and specification, fill it and return the info pnd = nfc_device_new(context, connstring); if (!pnd) {