[Pcsclite-cvs-commit] CVS Drivers/ccid/src
CVS User rousseau
ludovic.rousseau@free.fr
Thu, 30 Sep 2004 07:57:08 -0600
Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory haydn:/tmp/cvs-serv29974
Modified Files:
ccid_usb.c
Log Message:
get_ccid_usb_interface(): the O2Micro OZ776S reader has a wrong USB
descriptor. The extra[] field is associated with the last endpoint instead
of the main USB descriptor.
--- /cvsroot/pcsclite/Drivers/ccid/src/ccid_usb.c 2004/08/06 11:18:41 1.39
+++ /cvsroot/pcsclite/Drivers/ccid/src/ccid_usb.c 2004/09/30 13:57:07 1.40
@@ -18,7 +18,7 @@
*/
/*
- * $Id: ccid_usb.c,v 1.39 2004/08/06 11:18:41 rousseau Exp $
+ * $Id: ccid_usb.c,v 1.40 2004/09/30 13:57:07 rousseau Exp $
*/
#define __CCID_USB__
@@ -58,6 +58,13 @@
* Manufacturer and Product ID are also used to identify the device */
#define ALLOW_PROPRIETARY_CLASS
+/*
+ * The O2Micro OZ776S reader has a wrong USB descriptor
+ * The extra[] field is associated with the last endpoint instead of the
+ * main USB descriptor
+ */
+#define O2MICRO_OZ776_PATCH
+
#define BUS_DEVICE_STRSIZE 32
typedef struct
@@ -588,9 +595,32 @@
}
}
else
- /* we keep this in case a reader reports a bad class value */
+ /* only one interface found */
usb_interface = dev->config->interface;
+#ifdef O2MICRO_OZ776_PATCH
+ if (usb_interface != NULL
+ && (OZ776 == (dev->descriptor.idVendor << 16)
+ + dev->descriptor.idProduct)
+ && (0 == usb_interface->altsetting->extralen)) /* this is the bug */
+ {
+ int i;
+
+ for (i=0; i<usb_interface->altsetting->bNumEndpoints; i++)
+ {
+ /* find the extra[] array */
+ if (54 == usb_interface->altsetting->endpoint[i].extralen)
+ {
+ /* get the extra[] from the endpoint */
+ usb_interface->altsetting->extralen = 54;
+ usb_interface->altsetting->extra =
+ usb_interface->altsetting->endpoint[i].extra;
+ break;
+ }
+ }
+ }
+#endif
+
return usb_interface;
} /* get_ccid_usb_interface */