Hello Kévin, thanks for your reply.

I'm still stuck on the same error.
First of all this is the results of your suggestions:

> could you try with the following additional option:
> --usb-interface 0

```
root@linaro:/opt# osmo-remsim-client-st2 --usb-interface 0 --usb-vendor 1d50 --usb-product 60e3 --usb-path 1-1.3 --usb-config 1 --client-id 1 --client-slot 1 --server-ip 127.0.0.1 --server-port 9998 -d DMAIN,1:DST2,1:DRSPRO,1
DMAIN DEBUG fsm.c:456 CLIENT_MAIN(main){INIT}: Allocated
DRSPRO DEBUG fsm.c:456 RSPRO_CLIENT(server){INIT}: Allocated
DRSPRO DEBUG fsm.c:456 RSPRO_CLIENT(server){INIT}: Allocated
DRSPRO DEBUG remsim_client_main.c:185 RSPRO_CLIENT(server){INIT}: Received Event SRVC_E_ESTABLISH
DRSPRO DEBUG ../rspro_client_fsm.c:355 RSPRO_CLIENT(server){INIT}: state_chg to REESTABLISH
DRSPRO INFO ../rspro_client_fsm.c:308 RSPRO_CLIENT(server){REESTABLISH}: Creating TCP connection to server at 127.0.0.1:9998
DMAIN ERROR user_simtrace2.c:430 can't open USB device
```

> at first I thought about wrong access permissions (see USB permission in tutorial), but this can't be since it even fails with sudo.
> good initiative testing it.

So but permissions are already set for main user, sudo call was just to ensure we've got all rights to access the hardware

```
linaro@linaro:/opt$ id
uid=1000(linaro) gid=1000(linaro) groups=1000(linaro),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),30(dip),44(video),46(plugdev),50(staff),101(systemd-journal),110(bluetooth),111(netdev),116(pulse-access)

root@linaro:/opt# ls -la /etc/udev/rules.d/
total 20
drwxr-xr-x 2 root root 4096 Jan 10 14:20 .
drwxr-xr-x 4 root root 4096 Jul 25  2021 ..
-rw-r--r-- 1 root root 1033 Aug  2  2021 99-simtrace2.rules
```

> the other reason could be that someone else already claimed the device.
> to check if another process uses the USB device:

But no one is holding SIMtrace USB connection, `lsof` answers with a empty line

```
root@linaro:/opt# lsusb | grep SIMtrace
Bus 001 Device 016: ID 1d50:60e3 OpenMoko, Inc. Osmocom SIMtrace 2
root@linaro:/opt# lsof /dev/bus/usb/001/016
root@linaro:/opt#
```
Note. Other USB devices like Card Reader (used by the server side) was properly opened and communicates fine with the `osmo-remsim-bankd`on the same machine.

So trying to discover what is wrong, I connected a TTL UART to USB with configuration mentioned in this wiki (https://osmocom.org/projects/simtrace2/wiki/Wiki/31/annotate), and I've got this output:

```
=============================================================================
SIMtrace2 firmware 0.8.1.58-773d, BOARD=simtrace, APP=cardem
(C) 2010-2019 by Harald Welte, 2018-2019 by Kevin Redon
=============================================================================
-I- Chip ID: 0x299b0a60 (Ext 0x00000000)
-I- Serial Nr. 44203120-4c4b5136-32303031-30313034
-I- Reset Cause: general reset (first power-up reset)
-I- USB init...
USBD_Init
SetAddr(16) -W- Sta 0x888A8 [0] -W- _ -W- Sta 0x888A8 [0] -W- _ -W- Sta 0x888A8 [0] -W- _ SetCfg(1) cfgChanged1 -I- calling configure of all configurations...
-I- calling init of config 1...
-I- Modem 0: physical SIM
-I- 0: Use local/physical SIM
-I- entering main loop...
-I- USB is now configured
```

This really doesn't seem to make any sense, since it is possible to verify in the debug output an information that the USB was configured and no apparent errors were observed

Final note. I know that seeing the name 'linaro' in the results can cause some doubt as to the operating system used, but I can assure you that the tests were reproduced on an x86-64 desktop with Ubuntu and apparently neither the architecture nor the O.S. influence the result.

If you can point me to a tutorial so that I can follow and recompile the `osmo-remsim-client-st2` application, or even the SIMtrace firmware itself, maybe add some prints and be able to identify the point where the communication fails, maybe it can guide us to fix the problem.

Thanks a lot, Bruno Natali


Em sex., 20 de jan. de 2023 às 01:30, Kévin Redon <ml@mail.tsaitgaist.info> escreveu:
On Tue, Jan 10, 2023 at 12:43:27PM -0300, Bruno Natali wrote:
> I followed this steps (all of them)
> https://osmocom.org/projects/simtrace2/wiki/Cardem

very good following the tutorial and mentioning it.
this eliminates a lot of guessing.

> After I run this command:
> osmo-remsim-client-st2 --usb-vendor 1d50 --usb-product 60e3 --usb-path
> 1-2.2 --usb-config 1 --client-id 1 --client-slot 1 --server-ip 127.0.0.1
> --server-port 9998 -d DMAIN,1:DST2,1:DRSPRO,1

could you try with the following additional option:
--usb-interface 0

normally it would fail if this is not present and required, but it could help
Cannot claim interface: LIBUSB_ERROR_INVALID_PARAM

> I'm stuck in this error (even running as sudo):

at first I thought about wrong access permissions (see USB permission in tutorial), but this can't be since it even fails with sudo.
good initiative testing it.


> Sorry if this issue was addressed in another email, I even tried looking in
> the archives but the archives page is not very user friendly.

the other reason could be that someone else already claimed the device.
to check if another process uses the USB device:

# get bus and device number
lsusb | grep SIMtrace
Bus 001 Device 090: ID 1d50:60e3 OpenMoko, Inc. Osmocom SIMtrace 2
# list process using it
lsof /dev/bus/usb/001/090
COMMAND      PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
osmo-rems 470362 kevredon  mem    CHR 189,89          3242 /dev/bus/usb/001/090
osmo-rems 470362 kevredon    7u   CHR 189,89      0t0 3242 /dev/bus/usb/001/090

I hope it helps