Hello,
I'm playing with a networked remsim setup. The remsim server, sim card reader and banks daemon sit on a RPI (rpi-cardem-1), while the client (and the simtrace2) sit on a different RPI (rpi-cardem-2).
The client is started like this, and keeps producing this output: root@rpi-cardem-2:~# osmo-remsim-client-st2 --server-ip remsim-server --server-port 9998 --client-id 1 --client-slot 1 --usb-vendor 1d50 --usb-product 60e3 --usb-config 1 --usb-interface 0 --usb-path "1-1.4"
DRSPRO INFO ../rspro_client_fsm.c:307 RSPRO_CLIENT(server){REESTABLISH}: Creating TCP connection to server at remsim-server:9998 DLINP NOTICE simtrace2_api.c:271 [0] <= osmo_st2_cardem_request_config(features=00000001) DLINP NOTICE input/ipa.c:141 remsim-server:9998 connection done DRSPRO NOTICE ../rspro_client_fsm.c:127 RSPRO_CLIENT(server){REESTABLISH}: RSPRO link to remsim-server:9998 UP DRSPRO INFO ../rspro_client_fsm.c:307 RSPRO_CLIENT(bankd){REESTABLISH}: Creating TCP connection to server at 192.168.1.111:9999 DLINP NOTICE input/ipa.c:141 192.168.1.111:9999 connection done DRSPRO NOTICE ../rspro_client_fsm.c:127 RSPRO_CLIENT(bankd){REESTABLISH}: RSPRO link to 192.168.1.111: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.1.111:9999 DLINP NOTICE input/ipa.c:141 192.168.1.111:9999 connection done DRSPRO NOTICE ../rspro_client_fsm.c:127 RSPRO_CLIENT(bankd){REESTABLISH}: RSPRO link to 192.168.1.111: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
This looks like bankd sends back an wrong state/event: DRSPRO ERROR ../rspro_client_fsm.c:297 RSPRO_CLIENT(bankd){REESTABLISH}: Event SRVC_E_KA_TERMINATED not permitted
On the bankd side, this is what I get: Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_main.c:955 [004 ACCEPTING] Accepted connection from 192.168.1.9:46281 Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_main.c:442 [004 ACCEPTING] Changing state to CONN_WAIT_ID Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_main.c:655 [004 CONN_WAIT_ID] Rx RSPRO connectClientReq(T=0, N='rpi-cardem-2', SW='remsim-client', VER='1.0.0') Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_main.c:442 [004 CONN_WAIT_ID] Changing state to CONN_CLIENT Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_main.c:625 [004 CONN_CLIENT] slotmap found: C(1:1) -> B(1:1) Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_main.c:450 [004 CONN_CLIENT] Changing state to CONN_CLIENT_MAPPED (timeout=10) Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_pcsc.c:261 [004 CONN_CLIENT_MAPPED] Attempting to open PC/SC context Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_pcsc.c:264 [004 CONN_CLIENT_MAPPED] SCardEstablishContext: OK Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_pcsc.c:215 [004 CONN_CLIENT_MAPPED] Attempting to find card/slot using regex 'SCM Microsystems Inc. SCR 3310 [CCID Interface] (53312144266274) 00 00' Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_main.c:967 [004 CONN_CLIENT_MAPPED] Error -2 occurred: Cleaning up state Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15208 DBANKDW INFO bankd_main.c:442 [004 CONN_CLIENT_MAPPED] Changing state to ACCEPTING Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_main.c:955 [001 ACCEPTING] Accepted connection from 192.168.1.9:40007 Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_main.c:442 [001 ACCEPTING] Changing state to CONN_WAIT_ID Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_main.c:655 [001 CONN_WAIT_ID] Rx RSPRO connectClientReq(T=0, N='rpi-cardem-2', SW='remsim-client', VER='1.0.0') Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_main.c:442 [001 CONN_WAIT_ID] Changing state to CONN_CLIENT Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_main.c:625 [001 CONN_CLIENT] slotmap found: C(1:1) -> B(1:1) Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_main.c:450 [001 CONN_CLIENT] Changing state to CONN_CLIENT_MAPPED (timeout=10) Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_pcsc.c:261 [001 CONN_CLIENT_MAPPED] Attempting to open PC/SC context Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_pcsc.c:264 [001 CONN_CLIENT_MAPPED] SCardEstablishContext: OK Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_pcsc.c:215 [001 CONN_CLIENT_MAPPED] Attempting to find card/slot using regex 'SCM Microsystems Inc. SCR 3310 [CCID Interface] (53312144266274) 00 00' Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_main.c:967 [001 CONN_CLIENT_MAPPED] Error -2 occurred: Cleaning up state Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_main.c:442 [001 CONN_CLIENT_MAPPED] Changing state to ACCEPTING
Here, this seems relevant: Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_pcsc.c:215 [001 CONN_CLIENT_MAPPED] Attempting to find card/slot using regex 'SCM Microsystems Inc. SCR 3310 [CCID Interface] (53312144266274) 00 00' Jul 12 14:33:20 rpi-cardem-1 osmo-remsim-bankd[15203]: 15205 DBANKDW INFO bankd_main.c:967 [001 CONN_CLIENT_MAPPED] Error -2 occurred: Cleaning up state
It searches for the reader but returns error -2.
This is the head of pcsc_scan: root@rpi-cardem-1:~# pcsc_scan | head Using reader plug'n play mechanism Scanning present readers... 0: SCM Microsystems Inc. SCR 3310 [CCID Interface] (53312144266274) 00 00
Wed Jul 12 14:36:26 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
Now - if it's using a regex to search for the reader string, the fact that my reader has [] and () in it will break the regex search, right?
I've changed /etc/osmocom/bankd_pcsc_slots.csv, and set just: "1","1","SCM Microsystems Inc. SCR 3310" as the reader name/mapping, leaving out the special characters, and it started ok.
I suggest making a note of this in the documentation, that special characters in the reader name are checked via regular expressions.
Cheers!
Dear Adrian,
On Wed, Jul 12, 2023 at 04:44:50PM +0300, Adrian Popa wrote:
Now - if it's using a regex to search for the reader string, the fact that my reader has [] and () in it will break the regex search, right?
yes.
I've changed /etc/osmocom/bankd_pcsc_slots.csv, and set just: "1","1","SCM Microsystems Inc. SCR 3310" as the reader name/mapping, leaving out the special characters, and it started ok.
I suggest making a note of this in the documentation, that special characters in the reader name are checked via regular expressions.
This is already documented rather explicitly, please see https://gitea.osmocom.org/sim-card/osmo-remsim/src/commit/958ae50de114def58e...
| NOTE:: If the reader name contains any special characters, they might need to be escaped according | to the extended POSIX regular expression syntax. See `man 7 regex` for a reference.
The example config file snippet just below it also contains [ style escaping
Thanks, I had missed that! Perhaps it would be helpful for bankd to explicitly log that no reader was found according to the regex - in my case the problem wasn't obvious, and the client would keep retrying in a loop.
On Wed, Jul 19, 2023, 13:29 Harald Welte laforge@osmocom.org wrote:
Dear Adrian,
On Wed, Jul 12, 2023 at 04:44:50PM +0300, Adrian Popa wrote:
Now - if it's using a regex to search for the reader string, the fact that my reader has [] and () in it will break the regex search, right?
yes.
I've changed /etc/osmocom/bankd_pcsc_slots.csv, and set just: "1","1","SCM Microsystems Inc. SCR 3310" as the reader name/mapping, leaving out the special characters, and it started ok.
I suggest making a note of this in the documentation, that special characters in the reader name are checked via regular expressions.
This is already documented rather explicitly, please see
https://gitea.osmocom.org/sim-card/osmo-remsim/src/commit/958ae50de114def58e...
| NOTE:: If the reader name contains any special characters, they might need to be escaped according | to the extended POSIX regular expression syntax. See `man 7 regex` for a reference.
The example config file snippet just below it also contains [ style escaping
--
- Harald Welte laforge@osmocom.org
============================================================================ "Privacy in residential applications is a desirable marketing option." (ETSI EN 300 175-7 Ch. A6)
Hi Adrian,
On Wed, Jul 19, 2023 at 03:20:06PM +0300, Adrian Popa wrote:
Thanks, I had missed that! Perhaps it would be helpful for bankd to explicitly log that no reader was found according to the regex - in my case the problem wasn't obvious, and the client would keep retrying in a loop.
I just checked the source code, and it contains the following log statement:
LOGW(worker, "Error: Cannot find PC/SC reader/slot matching using regex '%s'\n", worker->reader.name)
So you should have this "Cannot find PC/SC reader/slot matching ..." message in your log files.
Please let us know if the message did not show up, so we can investigate why it is not printed.