[Pcsclite-cvs-commit] CVS Drivers/ccid/src
CVS User rousseau
ludovic.rousseau@free.fr
Wed, 27 Apr 2005 14:04:38 +0000
Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory haydn:/tmp/cvs-serv24351
Modified Files:
ccid_usb.c
Log Message:
get_data_rates(): if the CCID command GET DATA RATES is nto supported
the array of supported rates contains only the default and max data
rates
--- /cvsroot/pcsclite/Drivers/ccid/src/ccid_usb.c 2005/04/27 13:55:52 1.53
+++ /cvsroot/pcsclite/Drivers/ccid/src/ccid_usb.c 2005/04/27 14:04:38 1.54
@@ -18,7 +18,7 @@
*/
/*
- * $Id: ccid_usb.c,v 1.53 2005/04/27 13:55:52 rousseau Exp $
+ * $Id: ccid_usb.c,v 1.54 2005/04/27 14:04:38 rousseau Exp $
*/
#define __CCID_USB__
@@ -710,8 +710,31 @@
/* we got an error? */
if (n <= 0)
{
- DEBUG_CRITICAL2("IFD does not support GET_DATA_RATES request but should: %s", strerror(errno));
- return NULL;
+ struct usb_interface *usb_interface;
+
+ DEBUG_INFO2("IFD does not support GET_DATA_RATES request: %s",
+ strerror(errno));
+
+ /* we create a minimal array */
+ int_array = calloc(3, sizeof(int));
+ if (NULL == int_array)
+ {
+ DEBUG_CRITICAL("Memory allocation failed");
+ return NULL;
+ }
+
+ usb_interface = get_ccid_usb_interface(usbDevice[reader_index].dev);
+
+ /* dwDataRate (default data rate) */
+ int_array[0] = dw2i(usb_interface->altsetting->extra, 19);
+
+ /* dwMaxDataRate */
+ int_array[1] = dw2i(usb_interface->altsetting->extra, 23);
+
+ /* end of array marker */
+ int_array[2] = 0;
+
+ return int_array;
}
/* allocate the buffer (including the end marker) */