Project

General

Profile

Actions

Bug #4815

closed

PowerUp when no card is inserted fails after a very long delay: 60 seconds

Added by rousseau over 3 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Low
Assignee:
Target version:
-
Start date:
10/17/2020
Due date:
% Done:

100%

Spec Reference:

Description

If I insert a card connector but without a SIM card in the card connector then the reader (sysmoOCTSIM in my case) reports a card present.
My CCID driver then tries to power up the card. The reader does not respond before 60 seconds. I think that is a very long delay.

00000008 [140021143160576] ifdhandler.c:1885:IFDHICCPresence() usb:1d50/6141:libudev:0:/dev/bus/usb/001/008 (lun: 20001)
00000010 [140021143160576] -> 000003 65 00 00 00 00 01 32 00 00 00 
00000531 [140021143160576] <- 000003 81 00 00 00 00 01 32 01 00 00 
00000020 [140021143160576] ifdhandler.c:2006:IFDHICCPresence() Card present
00000009 [140021143160576] ifdhandler.c:1184:IFDHPowerICC() action: PowerUp, usb:1d50/6141:libudev:0:/dev/bus/usb/001/008 (lun: 20001)
00000010 [140021143160576] -> 000003 62 00 00 00 00 01 33 01 00 00 
58660283 [140021143160576] <- 000003 80 00 00 00 00 01 33 41 FE 00 
00000020 [140021143160576] commands.c:246:CmdPowerOn Card absent or mute
00000009 [140021143160576] commands.c:275:CmdPowerOn() Power up with 5V failed. Try with auto.
00000009 [140021143160576] -> 000003 62 00 00 00 00 01 34 03 00 00 
58660581 [140021143160576] <- 000003 80 00 00 00 00 01 34 41 FE 00 
00000023 [140021143160576] commands.c:246:CmdPowerOn Card absent or mute
00000008 [140021143160576] commands.c:275:CmdPowerOn() Power up with 1.8V failed. Try with 3V.
00000010 [140021143160576] -> 000003 62 00 00 00 00 01 35 02 00 00 
58660339 [140021143160576] <- 000003 80 00 00 00 00 01 35 41 FE 00 
00000024 [140021143160576] commands.c:246:CmdPowerOn Card absent or mute
00000008 [140021143160576] commands.c:275:CmdPowerOn() Power up with 3V failed. Try with 5V.
00000006 [140021143160576] ifdhandler.c:1251:IFDHPowerICC() PowerUp failed

From the logs you can see that the reader answers with the "Card absent or mute" status only after 58660283 µs (or 59 seconds).

I have not checked the ISO 76816-3 to know the maximum delay allowed for the card to send the first ATR byte (TS).
I think 60 seconds is very long. I guess a timeout of 1 second is enough.

Actions #1

Updated by Hoernchen over 3 years ago

  • Priority changed from Normal to Low

Yes, the timeouts might be longer than what the spec says in some cases, since they are mostly major errors and the actual time does not really matter, and I think the manual mentions that empty trays should not be inserted into the octsim...

Actions #2

Updated by Hoernchen over 3 years ago

...That being said the timeout does appears to be a bit too long, it is usually the whole time required for the whole expected transfer, so in this case 33 bytes * 9600 ETU -> ~5 seconds for the 6720 baud default rate at 2.5mhz is what I'd expect to see here...

Actions #3

Updated by rousseau over 3 years ago

Hoernchen wrote:

...That being said the timeout does appears to be a bit too long, it is usually the whole time required for the whole expected transfer, so in this case 33 bytes * 9600 ETU -> ~5 seconds for the 6720 baud default rate at 2.5mhz is what I'd expect to see here...

If the card does not send the first ATR byte within the 9600 ETU then the reader could declare the card to be mute.
No need to wait for 33 bytes. The timeout could be much shorter than ~5 seconds (33 times shorter).

Actions #4

Updated by Hoernchen over 3 years ago

Should be fixed by https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/20710 - my original WT calculation was using GT instead of WT so it was ~90 times less, which was fine at the time, but then i forgot to update it after fixing the timeouts, so it was now suddenly far too long.

Actions #5

Updated by rousseau over 3 years ago

Wonderful, and fast correction.

I guess it is possible to update the reader firmware. Can you provide me a documentation and a new firmware?

Actions #6

Updated by Hoernchen over 3 years ago

The patches are not yet merged - new firmware ends up at https://ftp.osmocom.org/binaries/osmo-ccid-firmware/latest/ so as soon as the patches are merged and the nightly firmware build is done you can grab the bin file from there + use dfu-util (something like sudo dfu-util -d 1d50:6141 -D sysmoOCTSIM-0.2.9-e060.bin -R) to flash the octsim, it features a dfu runtime descriptor so you do not need to push the button for that.

Actions #7

Updated by rousseau over 3 years ago

I upgraded the firmware to version from 22-Oct-2020, version sysmoOCTSIM 0.2.48-4c76.
The problem is now fixed. I get:

00000014 [139939605890816] ifdhandler.c:1890:IFDHICCPresence() usb:1d50/6141:libudev:0:/dev/bus/usb/001/009 (lun: 20000)
00000009 [139939605890816] -> 000002 65 00 00 00 00 00 12 00 00 00 
00000372 [139939605890816] <- 000002 81 00 00 00 00 00 12 01 00 00 
00000017 [139939605890816] ifdhandler.c:2011:IFDHICCPresence() Card present
00000017 [139939605890816] ifdhandler.c:1189:IFDHPowerICC() action: PowerUp, usb:1d50/6141:libudev:0:/dev/bus/usb/001/009 (lun: 20000)
00000010 [139939605890816] -> 000002 62 00 00 00 00 00 13 01 00 00 
01443288 [139939605890816] <- 000002 80 00 00 00 00 00 13 41 FE 00 
00000023 [139939605890816] commands.c:246:CmdPowerOn Card absent or mute
00000008 [139939605890816] commands.c:275:CmdPowerOn() Power up with 5V failed. Try with auto.
00000010 [139939605890816] -> 000002 62 00 00 00 00 00 14 03 00 00 
01443014 [139939605890816] <- 000002 80 00 00 00 00 00 14 41 FE 00 
00000024 [139939605890816] commands.c:246:CmdPowerOn Card absent or mute
00000008 [139939605890816] commands.c:275:CmdPowerOn() Power up with 1.8V failed. Try with 3V.
00000010 [139939605890816] -> 000002 62 00 00 00 00 00 15 02 00 00 
01442970 [139939605890816] <- 000002 80 00 00 00 00 00 15 41 FE 00 
00000023 [139939605890816] commands.c:246:CmdPowerOn Card absent or mute
00000008 [139939605890816] commands.c:275:CmdPowerOn() Power up with 3V failed. Try with 5V.
00000006 [139939605890816] ifdhandler.c:1256:IFDHPowerICC() PowerUp failed

As expected the timeout is now of 1.44 s. Much better.

I let you close the bug.

Actions #8

Updated by mschramm over 3 years ago

  • Status changed from New to In Progress
  • Assignee set to Hoernchen
Actions #9

Updated by Hoernchen over 3 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)