| 60 |
{ |
{ |
| 61 |
unsigned char cmd[] = "\xA0\x02"; |
unsigned char cmd[] = "\xA0\x02"; |
| 62 |
unsigned char res[10]; |
unsigned char res[10]; |
| 63 |
unsigned long length_res = sizeof(res); |
int length_res = sizeof(res); |
| 64 |
|
|
| 65 |
if (CmdEscape(lun, cmd, sizeof(cmd)-1, res, &length_res) == IFD_SUCCESS) |
if (CmdEscape(lun, cmd, sizeof(cmd)-1, res, &length_res) == IFD_SUCCESS) |
| 66 |
{ |
{ |
| 93 |
text = "Wrong command length"; |
text = "Wrong command length"; |
| 94 |
break; |
break; |
| 95 |
|
|
|
case 0x02: |
|
|
text = "Reader detects an excessive current. Card powered off"; |
|
|
break; |
|
|
|
|
|
case 0x03: |
|
|
text = "Reader detects a defective voltage. Card powered off"; |
|
|
break; |
|
|
|
|
| 96 |
case 0x05: |
case 0x05: |
| 97 |
text = "Slot number is invalid (it must be set to 0)"; |
text = "Invalid slot number"; |
|
break; |
|
|
|
|
|
case 0x07: |
|
|
case 0x08: |
|
|
case 0x09: |
|
|
case 0x0A: |
|
|
case 0x15: |
|
|
text = "Byte displayed is invalid"; |
|
| 98 |
break; |
break; |
| 99 |
|
|
| 100 |
case 0xA2: |
case 0xA2: |
| 105 |
text = "ATR too long (> 33)"; |
text = "ATR too long (> 33)"; |
| 106 |
break; |
break; |
| 107 |
|
|
| 108 |
|
case 0xAB: |
| 109 |
|
text = "No data exchanged"; |
| 110 |
|
break; |
| 111 |
|
|
| 112 |
case 0xB0: |
case 0xB0: |
| 113 |
text = "Reader in EMV mode and T=1 message too long"; |
text = "Reader in EMV mode and T=1 message too long"; |
| 114 |
break; |
break; |
| 125 |
text = "Wrong APDU command length"; |
text = "Wrong APDU command length"; |
| 126 |
break; |
break; |
| 127 |
|
|
| 128 |
|
case 0xE0: |
| 129 |
|
text = "Slot busy"; |
| 130 |
|
break; |
| 131 |
|
|
| 132 |
|
case 0xEF: |
| 133 |
|
text = "PIN cancelled"; |
| 134 |
|
break; |
| 135 |
|
|
| 136 |
|
case 0xF0: |
| 137 |
|
text = "PIN timeout"; |
| 138 |
|
break; |
| 139 |
|
|
| 140 |
|
case 0xF2: |
| 141 |
|
text = "Busy with autosequence"; |
| 142 |
|
break; |
| 143 |
|
|
| 144 |
|
case 0xF3: |
| 145 |
|
text = "Deactivated protocol"; |
| 146 |
|
break; |
| 147 |
|
|
| 148 |
case 0xF4: |
case 0xF4: |
| 149 |
text = "Procedure byte conflict"; |
text = "Procedure byte conflict"; |
| 150 |
break; |
break; |
| 151 |
|
|
| 152 |
|
case 0xF5: |
| 153 |
|
text = "Class not supported"; |
| 154 |
|
break; |
| 155 |
|
|
| 156 |
|
case 0xF6: |
| 157 |
|
text = "Protocol not supported"; |
| 158 |
|
break; |
| 159 |
|
|
| 160 |
case 0xF7: |
case 0xF7: |
| 161 |
text = "Invalid ATR checksum byte (TCK)"; |
text = "Invalid ATR checksum byte (TCK)"; |
| 162 |
break; |
break; |
| 165 |
text = "Invalid ATR first byte"; |
text = "Invalid ATR first byte"; |
| 166 |
break; |
break; |
| 167 |
|
|
| 168 |
|
case 0xFB: |
| 169 |
|
text = "Hardware error"; |
| 170 |
|
break; |
| 171 |
|
|
| 172 |
|
case 0xFC: |
| 173 |
|
text = "Overrun error"; |
| 174 |
|
break; |
| 175 |
|
|
| 176 |
case 0xFD: |
case 0xFD: |
| 177 |
text = "Parity error during exchange"; |
text = "Parity error during exchange"; |
| 178 |
break; |
break; |
| 181 |
text = "Card absent or mute"; |
text = "Card absent or mute"; |
| 182 |
break; |
break; |
| 183 |
|
|
| 184 |
default: |
case 0xFF: |
| 185 |
text = "Unknown CCID error"; |
text = "Activity aborted by Host"; |
| 186 |
break; |
break; |
| 187 |
|
|
| 188 |
|
default: |
| 189 |
|
if ((error >= 1) && (error <= 127)) |
| 190 |
|
{ |
| 191 |
|
char var_text[20]; |
| 192 |
|
|
| 193 |
|
sprintf(var_text, "error on byte %d", error); |
| 194 |
|
text = var_text; |
| 195 |
|
} |
| 196 |
|
else |
| 197 |
|
text = "Unknown CCID error"; |
| 198 |
|
break; |
| 199 |
} |
} |
| 200 |
debug_msg("%s:%d %s", file, line, text); |
debug_msg("%s:%d %s", file, line, text); |
| 201 |
|
|