Dear osmocom team,
I am trying to set up the osmocom-remsim application. The goal is, that the phone uses the SIM inserted into the card reader and connects to my EPS. I am using a SCR 3310 Card Reader and the simtrace2 hardware. I setup the bankd and the slotmap according to the manual. It seems, that the mapping is fine although, when I start the client, the execution terminates with "USB OUT transfer failed, status=2". The phone does not recognize a SIM inserted.
Setup: Debian 11, simtrace plugged into the computer. Simtrace is attached to a mobile Phone (Samsung galaxy A90 5G or Apple iPhone 13). SCR 3310 has a sysmoISIM-SJA2 card inserted, which is configured to attach to a custom cell distributed via srsRAN. Note that the OS is hosted as a VM with KVM/QEMU. When using only the simtrace, without remism, the SIM Card which is inserted into the board works as intended and the phone connects with my EPS.
Configuration:
bankd_pcsc_slots.csv: "1", "0", "SCM Microsystems Inc. SCR 3310 [CCID Interface] (53311702704887) 00 00"
osmo-remsim-bankd: osmo-remsim-bankd -i 127.0.0.1 -b 1 -n 1 -d
osmo-remsim-client-st2: osmo-remsim-client-st2 -V 1d50 -P 60e3 -C 1 -H 1-2 -S 0 -I 0 -n 0 -c 0
apitool: ./remsim-apitool.py -m 1 0 0 0
output of ./remsim-apitool.py -a: /clients: {'clients': [{'peer': 'C0:0', 'state': 'CONNECTED_CLIENT', 'component_id': {'type_': 'remsimClient', 'name': 'debian', 'software': 'remsim-client', 'swVersion': '1.0.0.19-a563'}}]} /banks: {'banks': [{'peer': 'B1', 'state': 'CONNECTED_BANKD', 'component_id': {'type_': 'remsimBankd', 'name': 'debian', 'software': 'remsim-bankd', 'swVersion': '1.0.0.19-a563'}, 'bankId': 1, 'numberOfSlots': 1}]} /slotmaps: {'slotmaps': [{'bank': {'bankId': 1, 'slotNr': 0}, 'client': {'clientId': 0, 'slotNr': 0}, 'state': 'ACTIVE'}]}
output of client: DRSPRO INFO ../rspro_client_fsm.c:306 RSPRO_CLIENT(server){REESTABLISH}: Creating TCP connection to server at 127.0.0.1:9998 DLINP NOTICE simtrace2_api.c:267 [0] <= osmo_st2_cardem_request_config(features=00000001) DLINP NOTICE input/ipa.c:128 127.0.0.1:9998 connection done DRSPRO NOTICE ../rspro_client_fsm.c:124 RSPRO_CLIENT(server){REESTABLISH}: RSPRO link to 127.0.0.1:9998 UP DRSPRO INFO ../rspro_client_fsm.c:306 RSPRO_CLIENT(bankd){REESTABLISH}: Creating TCP connection to server at 127.0.0.1:9999 DLINP NOTICE input/ipa.c:128 127.0.0.1:9999 connection done DRSPRO NOTICE ../rspro_client_fsm.c:124 RSPRO_CLIENT(bankd){REESTABLISH}: RSPRO link to 127.0.0.1:9999 UP DLINP NOTICE simtrace2_api.c:168 [0] <= osmo_st2_cardem_request_card_insert(inserted=1) DLINP NOTICE simtrace2_api.c:317 [0] <= _modem_sim_select(remote_sim=1) DLINP NOTICE simtrace2_api.c:250 [0] <= osmo_st2_cardem_request_set_atr(3b 00 ) DLINP NOTICE simtrace2_api.c:284 [0] <= _modem_reset(asserted=2, pulse_ms=300) DLINP NOTICE simtrace2_api.c:250 [0] <= osmo_st2_cardem_request_set_atr(3b 9f 96 80 1f 87 80 31 e0 73 fe 21 1b 67 4a 4c 75 30 34 05 4b a9 ) USB OUT transfer failed, status=2
output bankd: Jun 27 13:20:08 debian osmo-remsim-bankd[433]: 452 DBANKDW INFO bankd_main.c:639 [000 CONN_CLIENT] slotmap found: C(0:0) -> B(1:0) Jun 27 13:20:08 debian osmo-remsim-bankd[433]: 452 DBANKDW INFO bankd_main.c:464 [000 CONN_CLIENT] Changing state to CONN_CLIENT_MAPPED (timeout=10) Jun 27 13:20:08 debian osmo-remsim-bankd[433]: 452 DBANKDW INFO bankd_pcsc.c:267 [000 CONN_CLIENT_MAPPED] Attempting to open PC/SC context Jun 27 13:20:08 debian osmo-remsim-bankd[433]: 452 DBANKDW INFO bankd_pcsc.c:270 [000 CONN_CLIENT_MAPPED] SCardEstablishContext: OK Jun 27 13:20:08 debian osmo-remsim-bankd[433]: 452 DBANKDW INFO bankd_pcsc.c:215 [000 CONN_CLIENT_MAPPED] Attempting to find card/slot using regex 'SCM Microsystems Inc. SCR 3310 [CCID Int> Jun 27 13:20:08 debian osmo-remsim-bankd[433]: 452 DBANKDW INFO bankd_pcsc.c:234 [000 CONN_CLIENT_MAPPED] Attempting to open card/slot 'SCM Microsystems Inc. SCR 3310 [CCID Interface] (53311> Jun 27 13:20:09 debian osmo-remsim-bankd[433]: 452 DBANKDW INFO bankd_pcsc.c:198 [000 CONN_CLIENT_MAPPED] SCardStatus: OK Jun 27 13:20:09 debian osmo-remsim-bankd[433]: 452 DBANKDW INFO bankd_pcsc.c:200 [000 CONN_CLIENT_MAPPED] Card ATR: 3b9f96801f878031e073fe211b674a4c753034054ba9 Jun 27 13:20:09 debian osmo-remsim-bankd[433]: 452 DBANKDW INFO bankd_main.c:456 [000 CONN_CLIENT_MAPPED] Changing state to CONN_CLIENT_MAPPED_CARD Jun 27 13:20:09 debian osmo-remsim-bankd[433]: 452 DBANKDW INFO bankd_main.c:794 [000 CONN_CLIENT_MAPPED_CARD] Rx RSPRO setAtrRes
I hope the information provided in this mail is sufficient. If not, I am happy to provide what is needed in order to solve the issue.
Kind regards Lorenz Dumanski
Hi Lorenz,
general comment: Using a VM with USB pass-through is never a good idea for any latency-sensitive use cases. If you must use a VM, I suggest to use srv-io to map the entire PCIe USB host controller into the VM. Better use a dedicated machine (could be a small embedded system) that natively runs Linux.
On Mon, Jun 27, 2022 at 02:33:10PM +0200, Lorenz Dumanski wrote:
Note that the OS is hosted as a VM with KVM/QEMU. When using only the simtrace, without remism, the SIM Card which is inserted into the board works as intended and the phone connects with my EPS.
Just to clarify: if you use the simtrace2 board with 'cardem' firmware to emulate a card, you should not have a physical card inserted into it!
You're only supposed to have a physical card inserted into simtrace2 internal slot if you use the sniffer/tracer firmware for passive tracing.
In general it would be good to get the serial console output of the simtrace2 device when you see those USB errors.
Regards, Harald