/[pcsclite]/trunk/Drivers/ccid/src/ccid_usb.c
ViewVC logotype

Diff of /trunk/Drivers/ccid/src/ccid_usb.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1286 by rousseau, Thu Oct 7 20:28:49 2004 UTC revision 1287 by rousseau, Tue Oct 19 08:40:42 2004 UTC
# Line 89  typedef struct Line 89  typedef struct
89  #include "ccid_usb.h"  #include "ccid_usb.h"
90    
91  static int get_end_points(struct usb_device *dev, _usbDevice *usb_device);  static int get_end_points(struct usb_device *dev, _usbDevice *usb_device);
92    int ccid_check_firmware(struct usb_device *dev);
93    
94  /* ne need to initialize to 0 since it is static */  /* ne need to initialize to 0 since it is static */
95  static _usbDevice usbDevice[CCID_DRIVER_MAX_READERS];  static _usbDevice usbDevice[CCID_DRIVER_MAX_READERS];
# Line 97  static _usbDevice usbDevice[CCID_DRIVER_ Line 98  static _usbDevice usbDevice[CCID_DRIVER_
98  #define PCSCLITE_PRODKEY_NAME                   "ifdProductID"  #define PCSCLITE_PRODKEY_NAME                   "ifdProductID"
99  #define PCSCLITE_NAMEKEY_NAME                   "ifdFriendlyName"  #define PCSCLITE_NAMEKEY_NAME                   "ifdFriendlyName"
100    
101    struct _bogus_firmware
102    {
103            int vendor;             /* idVendor */
104            int product;    /* idProduct */
105            int firmware;   /* bcdDevice: previous firmwares have bugs */
106    };
107    
108    static struct _bogus_firmware Bogus_firmwares[] = {
109            { 0x0b97, 0x7762, 0x0111 },     /* Oz776S */ /* the firmware version if not correct since I don't have received a working reader yet */
110            { 0x04e6, 0x5115, 0x0516 },     /* SCR 331 */
111            { 0x04e6, 0x5115, 0x0620 },     /* SCR 331-DI */
112            { 0x04e6, 0x5115, 0x0514 },     /* SCR 335 */
113            { 0x04e6, 0xe003, 0x0415 },     /* SPR 532 */
114    };
115    
116    
117  /*****************************************************************************  /*****************************************************************************
118   *   *
# Line 358  status_t OpenUSBByName(unsigned int read Line 374  status_t OpenUSBByName(unsigned int read
374                                          DEBUG_INFO3("Using USB bus/device: %s/%s",                                          DEBUG_INFO3("Using USB bus/device: %s/%s",
375                                                   bus->dirname, dev->filename);                                                   bus->dirname, dev->filename);
376    
377                                            /* check for firmware bugs */
378                                            if (ccid_check_firmware(dev))
379                                                    return STATUS_UNSUCCESSFUL;
380    
381                                          /* Get Endpoints values*/                                          /* Get Endpoints values*/
382                                          get_end_points(dev, &usbDevice[reader_index]);                                          get_end_points(dev, &usbDevice[reader_index]);
383    
# Line 626  static int get_end_points(struct usb_dev Line 646  static int get_end_points(struct usb_dev
646          return usb_interface;          return usb_interface;
647  } /* get_ccid_usb_interface */  } /* get_ccid_usb_interface */
648    
649    
650    /*****************************************************************************
651     *
652     *                                      ccid_check_firmware
653     *
654     ****************************************************************************/
655    int ccid_check_firmware(struct usb_device *dev)
656    {
657            int i;
658    
659            for (i=0; i<sizeof(Bogus_firmwares)/sizeof(Bogus_firmwares[0]); i++)
660            {
661                    if (dev->descriptor.idVendor != Bogus_firmwares[i].vendor)
662                                    continue;
663    
664                    if (dev->descriptor.idProduct != Bogus_firmwares[i].product)
665                            continue;
666    
667                    /* firmware too old and buggy */
668                    if (dev->descriptor.bcdDevice < Bogus_firmwares[i].firmware)
669                    {
670                            if (DriverOptions & DRIVER_OPTION_USE_BOGUS_FIRMWARE)
671                            {
672                                    DEBUG_INFO3("Firmware (%X.%02X) is bogus! but you choosed to use it",
673                                            dev->descriptor.bcdDevice >> 8,
674                                            dev->descriptor.bcdDevice & 0xFF);
675                                    return FALSE;
676                            }
677                            else
678                            {
679                                    DEBUG_CRITICAL3("Firmware (%X.%02X) is bogus! Upgrade the reader firmware or get a new reader.",
680                                            dev->descriptor.bcdDevice >> 8,
681                                            dev->descriptor.bcdDevice & 0xFF);
682                                    return TRUE;
683                            }
684                    }
685            }
686    
687            /* by default the firmware is not bogus */
688            return FALSE;
689    } /* ccid_check_firmware */
690    

Legend:
Removed from v.1286  
changed lines
  Added in v.1287

  ViewVC Help
Powered by ViewVC 1.1.5