~ubuntu-branches/ubuntu/utopic/acsccid/utopic-proposed

« back to all changes in this revision

Viewing changes to src/ifdhandler.c

  • Committer: Package Import Robot
  • Author(s): Godfrey Chung
  • Date: 2014-07-03 14:12:36 UTC
  • mfrom: (7.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20140703141236-vwlwpdan0n9b7xtv
Tags: 1.0.8-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1065
1065
                                        // Cold reset
1066
1066
                                        atrLen = sizeof(atrBuffer);
1067
1067
                                        (void)IFDHPowerICC(Lun, IFD_POWER_DOWN, atrBuffer, &atrLen);
1068
 
                                        usleep(100 * 1000);
 
1068
                                        usleep(10 * 1000);
1069
1069
                                        atrLen = sizeof(atrBuffer);
1070
1070
                                        ret = IFDHPowerICC(Lun, IFD_POWER_UP, atrBuffer, &atrLen);
1071
1071
                                        if (ret != IFD_SUCCESS)
1168
1168
 
1169
1169
                DEBUG_COMM2("Timeout: %d seconds", ccid_desc->readTimeout);
1170
1170
 
1171
 
                // Set parameters if not specific mode
1172
 
                if (!specificMode)
 
1171
                ret = ccid_slot->pSetParameters(reader_index, 1, sizeof(param), param);
 
1172
                if (IFD_SUCCESS != ret)
1173
1173
                {
1174
 
                        ret = ccid_slot->pSetParameters(reader_index, 1, sizeof(param), param);
1175
 
                        if (IFD_SUCCESS != ret)
 
1174
                        DEBUG_INFO("SetParameters (T1) Failed");
 
1175
 
 
1176
                        if (param[0] != 0x11)
1176
1177
                        {
1177
 
                                DEBUG_INFO("SetParameters (T1) Failed");
1178
 
 
1179
 
                                if (param[0] != 0x11)
1180
 
                                {
1181
 
                                        // Cold reset
1182
 
                                        atrLen = sizeof(atrBuffer);
1183
 
                                        (void)IFDHPowerICC(Lun, IFD_POWER_DOWN, atrBuffer, &atrLen);
1184
 
                                        usleep(100 * 1000);
1185
 
                                        atrLen = sizeof(atrBuffer);
1186
 
                                        ret = IFDHPowerICC(Lun, IFD_POWER_UP, atrBuffer, &atrLen);
1187
 
                                        if (ret != IFD_SUCCESS)
1188
 
                                                return ret;
1189
 
 
1190
 
                                        // Try default Fl/Dl
1191
 
                                        pps[2] = 0x11;
1192
 
                                        goto again;
1193
 
                                }
1194
 
                                else
 
1178
                                // Cold reset
 
1179
                                atrLen = sizeof(atrBuffer);
 
1180
                                (void)IFDHPowerICC(Lun, IFD_POWER_DOWN, atrBuffer, &atrLen);
 
1181
                                usleep(10 * 1000);
 
1182
                                atrLen = sizeof(atrBuffer);
 
1183
                                ret = IFDHPowerICC(Lun, IFD_POWER_UP, atrBuffer, &atrLen);
 
1184
                                if (ret != IFD_SUCCESS)
1195
1185
                                        return ret;
 
1186
 
 
1187
                                // Try default Fl/Dl
 
1188
                                pps[2] = 0x11;
 
1189
                                goto again;
1196
1190
                        }
 
1191
                        else
 
1192
                                return ret;
1197
1193
                }
1198
1194
        }
1199
1195
        else
1234
1230
                DEBUG_COMM2("Communication timeout: %d seconds",
1235
1231
                        ccid_desc->readTimeout);
1236
1232
 
1237
 
                // Set parameters if not specific mode
1238
 
                if (!specificMode)
 
1233
                ret = ccid_slot->pSetParameters(reader_index, 0, sizeof(param), param);
 
1234
                if (IFD_SUCCESS != ret)
1239
1235
                {
1240
 
                        ret = ccid_slot->pSetParameters(reader_index, 0, sizeof(param), param);
1241
 
                        if (IFD_SUCCESS != ret)
 
1236
                        DEBUG_INFO("SetParameters (T0) Failed");
 
1237
 
 
1238
                        if (param[0] != 0x11)
1242
1239
                        {
1243
 
                                DEBUG_INFO("SetParameters (T0) Failed");
1244
 
 
1245
 
                                if (param[0] != 0x11)
1246
 
                                {
1247
 
                                        // Cold reset
1248
 
                                        atrLen = sizeof(atrBuffer);
1249
 
                                        (void)IFDHPowerICC(Lun, IFD_POWER_DOWN, atrBuffer, &atrLen);
1250
 
                                        usleep(100 * 1000);
1251
 
                                        atrLen = sizeof(atrBuffer);
1252
 
                                        ret = IFDHPowerICC(Lun, IFD_POWER_UP, atrBuffer, &atrLen);
1253
 
                                        if (ret != IFD_SUCCESS)
1254
 
                                                return ret;
1255
 
 
1256
 
                                        // Try default Fl/Dl
1257
 
                                        pps[2] = 0x11;
1258
 
                                        goto again;
1259
 
                                }
1260
 
                                else
 
1240
                                // Cold reset
 
1241
                                atrLen = sizeof(atrBuffer);
 
1242
                                (void)IFDHPowerICC(Lun, IFD_POWER_DOWN, atrBuffer, &atrLen);
 
1243
                                usleep(10 * 1000);
 
1244
                                atrLen = sizeof(atrBuffer);
 
1245
                                ret = IFDHPowerICC(Lun, IFD_POWER_UP, atrBuffer, &atrLen);
 
1246
                                if (ret != IFD_SUCCESS)
1261
1247
                                        return ret;
 
1248
 
 
1249
                                // Try default Fl/Dl
 
1250
                                pps[2] = 0x11;
 
1251
                                goto again;
1262
1252
                        }
 
1253
                        else
 
1254
                                return ret;
1263
1255
                }
1264
1256
        }
1265
1257
 
1421
1413
                                        while ((return_value != IFD_SUCCESS) || (nlength == 0))
1422
1414
                                        {
1423
1415
                                                (void)CcidSlots[reader_index].pPowerOff(reader_index);
1424
 
                                                usleep(100 * 1000);
 
1416
                                                usleep(10 * 1000);
1425
1417
                                                nlength = sizeof(pcbuffer);
1426
1418
                                                return_value = CcidSlots[reader_index].pPowerOn(reader_index, &nlength, pcbuffer,
1427
1419
                                                        PowerOnVoltage);