Changeset 1112


Ignore:
Timestamp:
01/03/09 11:11:16 (3 years ago)
Author:
alonbl
Message:

Avoid changing the altsetting if there is only one
In this state it somewhat safe to skip.
If altsetting is changed the ifdhandler cannot communicate with the reader
next time it executes unless usb reset is issued.

By Chaskiel Grundman.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ifd/ifd-ccid.c

    r1111 r1112  
    477477        ccid_status_t *st; 
    478478        ifd_device_params_t params; 
    479         int r, i, c, ifc, alt; 
     479        int r, i, c, ifc, alt, num_alt; 
    480480        struct ifd_usb_device_descriptor de; 
    481481        struct ifd_usb_config_descriptor conf; 
     
    515515 
    516516                for (ifc = 0; ifc < conf.bNumInterfaces; ifc++) { 
    517                         for (alt = 0; alt < conf.interface[ifc].num_altsetting; 
    518                             alt++) { 
     517                        num_alt = conf.interface[ifc].num_altsetting; 
     518                        for (alt = 0; alt < num_alt; alt++) { 
    519519                                int typeok = 0; 
    520520                                int ok = 0; 
     
    642642 
    643643        params.usb.interface = intf->bInterfaceNumber; 
    644         params.usb.altsetting = intf->bAlternateSetting; 
     644        if (num_alt > 1 || intf->bAlternateSetting > 0) 
     645                params.usb.altsetting = intf->bAlternateSetting; 
     646        else 
     647                params.usb.altsetting = -1; 
    645648 
    646649        r = ccid_parse_descriptor(&ccid, p, r - i); 
Note: See TracChangeset for help on using the changeset viewer.