So far the option only parsed the hexstring into the atr buffer, but
failed to update the length (from the default value of 2). Also set
atr.len so sending custom ATRs works.
Change-Id: I5deb0a432c05ab0bab5081a2812f6718d4a2ac33
When the stderr of these services is sent to syslog, for example by
using systemd's StandardError=syslog, syslog's escaping of ANSI color
ESC sequences in log messages really clutter the log files. This
option allows log coloring to be disabled on the command line.
Change-Id: I6955b0af1ceb11a4029383e32bb298ee8da7503f
Let's avoid a segfault and rather print a proper error message in case
we cannot find all the required USB endpoints when opening the
user-specified interface/config/device.
This can happen if the device is currently in DFU mode, or a completely
wrong device/interface was specified.
Before this patch:
Assert failed rc == 0 user_simtrace2.c:305
After this patch:
DMAIN ERROR user_simtrace2.c:448 specified USB dev/config/interface doesn't have at least one IN, OUT and IRQ_IN endpoint
Closes: OS#5416
Change-Id: Icfcc482fff106a232c5125ed8ab463ecc13824ae
This introduces an --atr-ignore-rspro command line argument, which
will make the remsim-client ignore any RSPRO setAtrReq it receives
from the remote bankd.
The purpose of this is to modify the capabilities advertised by the card
towards the UE (modem/phone). For example, by modifying the ATR
one can disable/constrain the UE from using higher bit rate support, or
disable the use of logical channels.
Change-Id: I930293f7b637dba60d9dd6d2254f4524f831b491
The argument existed (as a long option), and was documented in the
user manual - but it wasn't printed in the help message, nor was it
present in the getopt_long() string.
Let's fix that.
Change-Id: Icfb74597dd813cee8b48b8dcf520fdd1c954338a
The RSPRO ComponentIdentity includes a 'name' for each remsim component.
So far we always used "fixme-name" instead of something meaningful.
Let's use the hostname of the system instead.
Change-Id: I14925f16ae242dae89fa853a2fe31c5c1b32981d
If one component connects to another component, verify that the
remote component type (bank/server/client) matches our expectation.
This is important in order to detect a misconfiguration of port numbers,
for example.
Closes: OS#5548
Change-Id: I89a4fc4331e8a0622f8f146c7fc235d34d990497
The RSPRO.asn protocol defines the ranges 0..1023 for slot, bank
and client IDs. Don't make misleading claims in manual and/or
help messages.
Change-Id: Id383b2bea4c014e7b61ae02e7062ba4db5c2dc20
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.
Change-Id: I2e98f89f6738d03c45a2106820af0912692093f3
When the client leaves the OPERATIONAL state, do the inverse of what
happens when entering that state:
* request "card insert" no longer to be generated towards modem
* request switch back to local SIM
* reset the modem to notice the change
This way entering remote-sim operation due to adding a slotmap
and leaving remote-sim due to removing the slotmap should be
symmetrical.
Change-Id: Ifaa4b60474bf8585bfbe0288062f581821bd3faa
Closes: OS#5216
this typo was breaking operating with simtrace2 for all responses
that contained more than just a status word.
Change-Id: Id8195d6650c3306e1a39f59d78d1348671ad062d
libosmo-simtrace2 traditionally had only supported blocking, synchronous
I/O, while remsim-client used asynchronous USB I/O. Using async USB I/O
for IRQ + IN transfers while using blocking I/O for OUT transfers
doesn't seem to work reliably, so we have to switch OUT also to async.
Depends: simtrace2.git Ib8939bdb7f533cd20a34a30a97f12b782b9816c2
Change-Id: I18bf166a95bd4318d700b3e93401b2db5188acfc
The '-d' option is pretty much tradition in most osmocom programs,
particularly for those without a VTY / config file it is the only
option to configure per-subsystem logging verbosity.
Change-Id: I0abecc26a5d8b6a5607e1eb8982af4c05909afed
This way we have consistent logging from all parts of the code via
the common libosmocore logging infrastructure.
Change-Id: I9ace31d781dd3e50f9a5d9239bafa87a01abb0d6
Change-Id: Ic863dc2f7fe7b435c9ea19c9cb97b691411dc0f5
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/osmo-remsim-client-st2/usr/bin/osmo-remsim-client-st2 was not linked against libosmosim.so.0 (it uses none of the library's symbols)
The remsim_client code already used FSMs for the connections
to both remsim-server and remsim-bankd. However the 'main' part of the
program was not yet implemented as a FSM, making it somewhat difficult
to perform the right actions in every possible situation.
This commit re-structures the code around a central main_fsm, which
gets notified from the per-connection FSMs and which handles the common
processing. It also handles the execution of external script commands,
and hence further unifies the code base between the different backends
(simtrace2, ifd_handler, shell)
Closes: #4414
Change-Id: I44a430bc5674dea00ed72a0b28729ac8bcb4e022
This adds a "libifd_remsim_client.so" PC/SC driver that can be
used to make normal PC/SC client programs (like pySim, sysmo-usim-tool,
osmo-sim-test, osmo-usim-auth, ...) talk to a remote SIM bank.
Change-Id: Ib8707c6e0e46407ab39a693adfec2fa71892f6ee
I can occasionally see osmo-remsim-client-st2 get stuck when the Modem
(in this case a Quectel EC20) is performing PTS with the card.
In the log of osmo-remsim-client-st2 I can see:
SIMtrace => PTS req: ff 10 94 7b 00 00
SIMtrace -> 01 07 00 00 00 00 15 00 04 ff 10 94 7b 00 00 ff 10 94 7b
SIMtrace => PTS req: ff 10 94 7b 00 00
SIMtrace IRQ 01 04 00 00 00 00 15 00 13 00 00 00 00 00 09 04 0a 80 25 00 00
after which the communication doesn't proceed. After a long time, the
modem seems to retry without PTS and then proceeds with normal SIM card
communication.
Interestingly, both the firmware and a usbmon trace agree that the first
APDU header after the PTS is actually sent in an USB IN transfer:
-I- 0: computed Fi(1) Di(1) ratio: 372
-I- 0: computed Fi(9) Di(4) ratio: 64
-I- 0: send_tpdu_header: 00 a4 00 04 02
-I- 0: flush_rx_buffer (5)
usbmon shows 010600000000130001000000050000a4000402
It's unclear why the host program doesn't get the data from the IN
transfer. However, if multiple asynchronous IN EP URB are submited,
the problem can be reproducibly avoided. Let's do that.
Change-Id: I2fa5f71869b124b73e0c312befce1ca268e9a9a2
Closes: OS#4409
This is useful if we have external programs interfacing with
stdin/stdout of osmo-remsim-client-shell. We don't want that output
to hang in some buffer indefinitely, but rather have the lines flushed
immediately.
Change-Id: I6879f9f186ce87e0644b3d7868fc5ea031b82c62
If the server sends us ConfigClientBankReq with bankd_port == 0, then
this means that we shall disconnect from the bankd. Translate this to
the SRVC_E_DISCONNECT event towards the RSPRO connection FSM.
Change-Id: Idbfbfa0e84fa14dcb913b4dcbd943bc80ec175ac
Related: OS#4399
We may want to use the entire client code independent of the current
'main' portion, so let's introduce separation via API.
Change-Id: I6456317c3968551cd69ba379c746e4dd9690d02d
We may want to develop programs that include multiple instances of
a remsim_client. Let's remove the global variable 'g_client' and
instead de-reference the bankd_client using container_of() macros
Change-Id: I456fb633561b88912be2f78c3e0264794d921255
This is a remsim-client with an interactive 'shell', where the user
can type in C-APDUs in hex formats, which will be sent to the bankd /
SIM-card. Responses received from SIM Card via bankd will be printed
in return.
Change-Id: I636505fd9741833ccf5cbd1bcac30f7b9aa94425
There were quite a bit of API changes that hadn't yet been applied
to remsim_client.c (which was disabled and hence not compiled for
quite some time).
Change-Id: I0b3733f6851a951ee24ae87aa5db0ee8daa7a841
There are some situations where remsim-client would want to make its
surrounding system aware of, e.g. to take specific action.
This is particularly important on platforms where the simtrace2 firmware
doesn't have direct control over modem reset/poweron or the like.
Change-Id: I61cf4d93c669db137de801f8b147dcffaa6f3abd
Depends: libosmocore.git Ib24ac8a083db32e55402ce496a5eabd8749cc888
Closes: OS#4332
While the user may have specified a USB path at the command line
(or not), let's make sure we obtain the actual path after opening
the respective USB device.
Change-Id: I7e707c74647f4c5db06d495d369b2e69e2fc7c97
Rather, pass it around between functions and attach it to other state.
Also, make it a talloc contxt so other objects can be allocated off it.
Change-Id: I25f592581382238d5640c1f6326dec745f8d1d40
When introducing asynchronous USB support in Change-Id
Ic18690b3c2cbc5e99de0665c0b68b7555433b3cd, we accidentially
broke the --keep-running behavior, where even a disappearing USB
device will not terminate the remsim-client process.
Change-Id: I19cca9f7953d61058a36856b2fc4c97a3b93e15d