Ok, I did some more tests, in order to rule out a bad FPC connection.
I flashed the trace dfu and used the simtrace board + the same FPC
connection, the same phone + a sim card in the board reader and ran
simtrace2-sniff to read traffic between phone and SIM, and it worked
ok:
root@rpi-cardem-2:~# simtrace2-sniff
simtrace2-sniff - Phone-SIM card communication sniffer
(C) 2010-2017 by Harald Welte <laforge(a)gnumonks.org>
(C) 2018 by Kevin Redon <kredon(a)sysmocom.de>
Using USB device 1d50:60e3 Addr=6, Path=1-1.3, Cfg=1, Intf=0, Alt=0:
255/1/0 (SIMtrace Sniffer)
Entering main loop
Card state change: reset de-asserted
ATR: 3b 9f 96 80 1f c7 80 31 e0 73 fe 21 13 67 98 07 02 10 01 01 01 54
PPS: ff 10 95 7a
PPS: ff 10 95 7a
Fi/Di switched to 512/16
TPDU: 00 a4 08 04 02 2f 00 61 24
TPDU: 00 c0 00 00 24 62 22 82 05 42 21 00 24 05 83 02 2f 00 a5 06 c0
01 00 de 01 00 8a 01 05 8b 03 2f 06 05 80 02 00 b4 88 01 f0 90 00
TPDU: 00 b2 01 04 24 61 18 4f 10 a0 00 00 00 87 10 02 ff 49 ff 01 89
00 00 01 00 50 04 55 53 49 4d ff ff ff ff ff ff ff ff ff ff 90 00
TPDU: 00 b2 02 04 24 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 90 00
TPDU: 00 b2 03 04 24 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 90 00
TPDU: 00 b2 04 04 24 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 90 00
TPDU: 00 b2 05 04 24 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 90 00
TPDU: 00 a4 00 04 02 3f 00 61 29
TPDU: 00 c0 00 00 29 62 27 82 02 78 21 83 02 3f 00 a5 07 80 01 71 83
02 98 5c 8a 01 05 8b 03 2f 06 02 c6 0c 90 01 60 83 01 01 83 01 0a 83
01 81 90 00
TPDU: 00 a4 08 04 02 2f 05 61 21
TPDU: 00 c0 00 00 21 62 1f 82 02 41 21 83 02 2f 05 a5 06 c0 01 00 de
01 00 8a 01 05 8b 03 2f 06 07 80 02 00 08 88 01 28 90 00
TPDU: 00 b0 00 00 08 65 6e 65 73 66 72 ff ff 90 00
TPDU: 80 10 00 00 17 ff ff ff ff 7f 0f 00 df ff 00 00 1f 42 03 10 46
03 00 00 00 00 00 40 90 00
...
So, this rules out a bad FPC connection/cable.
I will try getting a different reader.
When trying to read the card, the reader behaves the same way - its
led keeps flashing, bankd spams lots of reset messages (both cold
reset and warm reset). I wonder if there are additional debug messages
I can look for to see why it can't read the card. Again, here is the
card output from pcsc_scan - I don't see anything wrong with it,
though I'm not used to reading SIM cards...
root@rpi-cardem-1:~# pcsc_scan
Using reader plug'n play mechanism
Scanning present readers...
0: SCM Microsystems Inc. SCR 3310 [CCID Interface] (53312144266274) 00 00
Mon Jul 17 09:20:29 2023
Reader 0: SCM Microsystems Inc. SCR 3310 [CCID Interface]
(53312144266274) 00 00
Event number: 0
Card state: Card inserted,
ATR: 3B 9F 96 80 1F C7 80 31 E0 73 FE 21 13 67 98 07 02 10 01 01 01 54
ATR: 3B 9F 96 80 1F C7 80 31 E0 73 FE 21 13 67 98 07 02 10 01 01 01 54
+ TS = 3B --> Direct Convention
+ T0 = 9F, Y(1): 1001, K: 15 (historical bytes)
TA(1) = 96 --> Fi=512, Di=32, 16 cycles/ETU
250000 bits/s at 4 MHz, fMax for Fi = 5 MHz => 312500 bits/s
TD(1) = 80 --> Y(i+1) = 1000, Protocol T = 0
-----
TD(2) = 1F --> Y(i+1) = 0001, Protocol T = 15 - Global interface
bytes following
-----
TA(3) = C7 --> Clock stop: no preference - Class accepted by the
card: (3G) A 5V B 3V C 1.8V
+ Historical bytes: 80 31 E0 73 FE 21 13 67 98 07 02 10 01 01 01
Category indicator byte: 80 (compact TLV data object)
Tag: 3, len: 1 (card service data byte)
Card service data byte: E0
- Application selection: by full DF name
- Application selection: by partial DF name
- BER-TLV data objects available in EF.DIR
- EF.DIR and EF.ATR access services: by GET RECORD(s) command
- Card with MF
Tag: 7, len: 3 (card capabilities)
Selection methods: FE
- DF selection by full DF name
- DF selection by partial DF name
- DF selection by path
- DF selection by file identifier
- Implicit DF selection
- Short EF identifier supported
- Record number supported
Data coding byte: 21
- Behaviour of write functions: proprietary
- Value 'FF' for the first byte of BER-TLV tag fields: invalid
- Data unit in quartets: 2
Command chaining, length fields and logical channels: 13
- Logical channel number assignment: by the card
- Maximum number of logical channels: 4
Tag: 6, len: 7 (pre-issuing data)
Data: 98 07 02 10 01 01 01
+ TCK = 54 (correct checksum)
Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B 9F 96 80 1F C7 80 31 E0 73 FE 21 13 67 98 07 02 10 01 01 01 54
SIM Card (Carrier: BOB, Country: Austria) (Telecommunication)
https://www.bob.at
Cheers!
On Sat, Jul 15, 2023 at 7:03 AM <bianfang85(a)163.com> wrote:
DRSPRO NOTICE ../rspro_client_fsm.c:127 RSPRO_CLIENT(bankd){REESTABLISH}: RSPRO link to
192.168.2.131:9999 UP DRSPRO ERROR ../rspro_client_fsm.c:297
RSPRO_CLIENT(bankd){REESTABLISH}: Event SRVC_E_KA_TERMINATED not permitted DRSPRO INFO
../rspro_client_fsm.c:302 RSPRO_CLIENT(bankd){REESTABLISH}: Destroying existing connection
to server DRSPRO INFO ../rspro_client_fsm.c:307 RSPRO_CLIENT(bankd){REESTABLISH}: Creating
TCP connection to server at 192.168.2.131:9999 DLINP NOTICE input/ipa.c:141
192.168.2.131:9999 connection done
I think our problems are similar. My initial suspicion is that there is a problem with
our soft connection. Or there is a problem with the settings.