Commit Graph

370 Commits

Author SHA1 Message Date
Vadim Yanitskiy 621214c802 layer23: make all apps depend on libosmo-gprs-rlcmac
This will be needed for the modem application, and is also used
in a follow-up commit adding support for parsing SI13 Rest Octets.

Change-Id: I8e0f826c9b2a886f94624176e34e7d197e93d25f
Related: OS#5500
2023-01-03 00:18:34 +07:00
Vadim Yanitskiy cad5af50cc mobile: gapk_io_init_ms(): fix 'phy_fmt' may be used uninitialized
Change-Id: I193de6e0e831aa4201f5edec80e40abc43f4a861
2023-01-02 20:41:41 +07:00
Vadim Yanitskiy 6391546181 mobile: rework writing BA to file, move to a function
Sometimes I am seeing error messages like this:

  DCS ERROR Failed to write BA list

The problem is that there can be several BA entries which need to
be written, and for each of them we're calling fwrite() twice.
This function returns number of items written, so the final sum
of returned values would be: len(BA list) * 2.  Thus expecting
it to be 2 regardless of len(BA list) is wrong.

Fix this by checking the sum in each iteration, not at the end.
Take a chance to refactor the code and move to a function.

Change-Id: Id8bc216c146127d9c9995379c9e56450d328f46d
2022-12-21 15:07:21 +00:00
Vadim Yanitskiy 5e331c196a mobile: gsm48_rr_rx_acch(): clarify logging messages
Change-Id: Ibc2d54c2879fa28225d46222239829f699277f6c
2022-12-10 19:11:20 +07:00
Vadim Yanitskiy 67d45c054a mobile: do not enforce RTP format for Uplink TCH frames
This is a partial revert of 8f04fa9758.

The GAPK based audio I/O implementation of the mobile app is now capable
of handling TI's specific TCH frame format, which can be configured via
the VTY interface ('io-tch-format ti').  TCH frames in this format are
different from the ones in RTP format and may have different length and
different bit ordering.  Remove voice_frame_verify().

Change-Id: I6113ba443e65ddaae091b643af54c873b7da4de8
Related: OS#3400
2022-12-06 06:28:56 +07:00
Vadim Yanitskiy 12dd3af2a0 mobile: support RTP and TI specific TCH frame I/O formats
Change-Id: Ib41f8c39c82c243b62a76433f59a2b98e175f894
Related: OS#3400
2022-12-06 06:28:56 +07:00
Vadim Yanitskiy 97deddcd45 mobile: clean up GAPK I/O state on channel release
Do not assert() in gsm_recv_voice(), because channel release does
not happen immediately and the PHY may be still sending TCH frames.

Change-Id: I8943ee9bd46afc96e6d7cfd52c95c34fd311ce11
Related: OS#3400
2022-12-06 06:28:56 +07:00
Vadim Yanitskiy df7fa3e296 mobile: integrate GAPK based audio (voice) I/O support
This change introduces a new feature to the mobile application -
audio I/O support, which allows the user to speak right from the
host side running mobile through its ordinary mic and speakers.

The audio I/O is based on libosmogapk [1][2], which in its turn
uses the ALSA sound system for the playback and capture.  This
is a new optional dependency of mobile, which is automatically
picked up if available during the build configuration.  Whether
to depend on it or not can be controlled using '--with-gapk-io'.

The API offered by libosmogapk implies to use the processing chains,
which generally consist of a source block, several processing blocks,
and a sink block.  The mobile app implements the following chains:

  - 'pq_audio_source' (voice capture -> frame encoding),
  - 'pq_audio_sink' (frame decoding -> voice playback).

both taking/storing TCH frames from/to the following two buffers:

  - 'tch_fb_ul' - a buffer for to be played DL TCH frames,
  - 'tch_fb_dl' - a buffer for encoded UL TCH frames.

The buffers are served by a new function gapk_io_dequeue().

[1] https://gitea.osmocom.org/osmocom/gapk/
[1] https://osmocom.org/projects/gapk

Change-Id: Ib86b0746606c191573cc773f01172afbb52f33a9
Related: OS#5599
2022-12-01 01:05:38 +07:00
Vadim Yanitskiy b1cfa18d77 mobile: gsm_forward_mncc(): properly mark TCH/H frames
Change-Id: Id3f459bc767ebf31469287fa672893239c5977d9
Related: OS#5599
2022-12-01 01:05:38 +07:00
Vadim Yanitskiy e69d3f4ba1 mobile: gsm_forward_mncc(): call mncc_sock_from_cc() directly
This way we can avoid allocating another msgb and enqueue the given
msgb directly to the write queue of the MNCC socket.

Change-Id: I29305866e61a0bc3bd082108af6a9ba8ff86bcf2
Related: OS#5599
2022-12-01 01:05:38 +07:00
Vadim Yanitskiy 100ec4ca6f mobile: rework gsm_recv_voice(), add AUDIO_IOH_MNCC_SOCK
Do not send voice frames to the external MNCC unconditionally.
Add a new I/O handler type for the external MNCC application.

Change-Id: I406b169963e6654110329d741728fa12c8c8eeec
Related: OS#5599
2022-12-01 01:05:38 +07:00
Vadim Yanitskiy 37a6a2c5c4 mobile: improve function comments in voice.c
Change-Id: I0285a07841bdc2568374f9e9cd0214eef1415186
Related: OS#5599
2022-12-01 01:05:38 +07:00
Vadim Yanitskiy 290ea6b7fa mobile: add missing TCH MNCC messages and handle them
Change-Id: I28a1ae1ed504748c33c64c86ca7d57a94c7c7c6d
Related: OS#5599
2022-12-01 01:05:38 +07:00
Vadim Yanitskiy 7304b1720d mobile: timeout_rr_meas(): use osmo_strbuf API
Change-Id: I0c505b753bcfb06d9f2f085d56d7d56fb1c44d50
2022-11-30 18:35:14 +07:00
Vadim Yanitskiy ff44b9c3ed mobile: timeout_rr_meas(): fix sprintf() formatting
Change-Id: Ia8a101005d027fb5d0ddc2566f92ab2060f21c36
2022-11-30 18:27:58 +07:00
Vadim Yanitskiy e4541c35db mobile: timeout_rr_meas(): fix uninitialized variable
Change-Id: I956a1cafe9fed1a881574f59d0532e5cf931a1f7
Fixes: c9e579cea137fd147173434b7fa128d37685011
Fixes: CID#300084
2022-11-30 17:22:48 +07:00
Vadim Yanitskiy 993d2ab501 mobile: split gsm_send_voice() -> gsm_send_voice_{msg,frame}()
This is needed to avoid sending voice frames to the L1PHY without
having to use MNCC specific struct gsm_data_frame.

Change-Id: I37241555cd648a8e2b57fa072c708f93cd1ba5a9
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy 7fed41388c mobile: gsm48_rr_tx_voice(): also permit TCH/H frames
The idea behind checking the ch_type in gsm48_rr_tx_voice() was likely
to prevent sending of the (LCR originated) Uplink TCH frames before
the actual traffic channel is established/modified.

The problem is that this check allows TCH/F frames, but not TCH/H.
Most likely, TCH/H was forgotten or never tested.  Fix this.

Change-Id: I06e84ad47bafd4676af0e136b825e77471587b23
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy fd0baabed3 mobile: properly handle RR CHANNEL MODE MODIFY message
According to 3GPP TS 04.08, section 3.4.6.1.3 "Abnormal cases"
of "channel mode modify procedure", if the MS doesn't support
the indicated channel mode, it shall retain the old mode and
return the associated channel mode information in the
ACKNOWLEDGE message.

Previously, if an indicated mode is not supported, we used to
indicate the 'CHAN_MODE_UNACCT' RR case without sending the
ACKNOWLEDGE message. Also, the result of gsm48_rr_set_mode()
was ignored. Let's fix this!

Change-Id: I952436ec796273e56341f9d3492b4a3b3a5dc410
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy d2d5fabee5 mobile: gsm48_rr_set_mode(): fix copy-paste in comment
Change-Id: I45212cd02ac50d0d363918709720e997500e45a9
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy 73da4bac97 mobile: gsm48_rr_set_mode(): print name of channel mode
Change-Id: I615e89bdd7e1cc01b3258fefa26f7ab5705ae8cc
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy c1d3c01768 mobile: allow enabling/disabling handling of voice in the L1PHY
Some L1PHY targets (e.g. Calypso based Mot C1xx phones) have built in
microphone and speaker.  Some targets do not have them.  Currently we
unconditionally instruct the L1PHY to handle TCH frames internally.
Make this behavior configurable via the VTY interface.

Change-Id: I131f213ef7c2736f7310f0183b83f3bc3064cd98
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy 8d875f3c3d mobile: add MNCC handler selection to settings
Since the mobile application is potentially able to maintain
multiple MS instances, it's better to have a possibility to
choose an MNCC (Call Control) handler per each MS separately.

This change removes the command-line option '-m', which was used
for enabling the external MNCC.  Now it's possible configure the
MNCC handler for each MS via the VTY interface and settings.

The following MNCC-handlers are available:

  - internal - built-in MNCC-handler (default);
  - external - external MNCC-handler via UNIX-socket (e.g. LCR);
  - dummy - dummy handler without CC support.

Change-Id: I2df91c7a79ba5c39bc6ceae900ef649129dd0346
Related: OS#3400
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy c46d0699cd mobile: timeout_rr_meas(): also print sub-slot for TCH/H
Change-Id: I208c159ba610450e1850e601daa2712eef8c23e1
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy fe6345e1c4 layer23: always check return value of rsl_tlv_parse()
Similar to rsl_dec_chan_nr(), this function may also fail, leaving
the given struct tlv_parsed uninitialized.

Change-Id: I13f2a97eeff78ca8ed7d0a2844e4fca430ec7768
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy c9e579cea1 layer23: always check return value of rsl_dec_chan_nr()
The rsl_dec_chan_nr() may fail to decode RSL channel number, so
variables ch_type/chan_ss/chan_ts would remain uninitialized.

Change-Id: I9ab18bdaf41a29fcd32a7060668ef9db07b8cf7e
Related: OS#5599
2022-11-29 02:15:39 +07:00
Vadim Yanitskiy b76743df71 mobile: add MNCC socket path to settings
Previously the MNCC socket path was generated automatically,
using concatenation of the '/tmp/ms_mncc_' prefix and MS name.
Let's allow the user to specify this manually, keeping the same
naming generation method for default value.

Change-Id: I643356ac579bc5e765f668265ec803b22a73739c
Related: OS#3400
2022-11-27 06:12:38 +07:00
Pau Espin dd03ea6a82 layer23/mobile: Add missing dependency cflags
The *_LIBS vars were already added, but the *_CFLAGS were missing.

Change-Id: If904589b33357395e10f078857979aaecf5dbf68
2022-11-21 18:16:09 +00:00
Vadim Yanitskiy 136cf481c7 layer23: fix -Werror=old-style-definition problems
Change-Id: I0187acb02de6fd22ccc86c112640caa8aa3fa2bc
2022-11-05 19:18:42 +07:00
Eric Wild 0f64b7c124 Revert "mobile/gsm48_rr.c: fix ACCH System Information parsing"
This reverts commit 1a8a80aeae.

We currently get ALL SI messages wrong - the protocol disseminator is
accidentally being used as SI msg type, and
6=radio resources management - but 6 is also type=si5ter.. so all SI we
receive end up being parsed as SI5, what a coincidence!

Change-Id: I3822f74295920680a935f3031c642ba00162d09d
2022-10-26 15:52:58 +00:00
Vadim Yanitskiy 1b0ff8ea6f mobile: check return value of gsm_arfcn2band_rc()
Change-Id: Ia5bc9f8bf4aa3ea7374c67e329db22612bb350ca
Fixes: CID#282374, CID#282375, CID#282376
2022-10-07 14:56:21 +07:00
Vadim Yanitskiy c2d022d348 mobile: lapdm_channel_init() is deprecated, use lapdm_channel_init3()
Change-Id: I320381488046f9b1780a53b8d5d27e470da727c4
2022-08-30 12:00:04 +00:00
Vadim Yanitskiy c67a9a6a01 mobile: mobile_start(): fix grammar in logging messages
Change-Id: Ibe8afb6a79613096c4ace86cc44867d0e9f8de76
2022-08-23 20:32:56 +00:00
Vadim Yanitskiy 8f6338c4f5 mobile: fix description of 'test re-selection' command
Change-Id: I254effd067b64ae0bfe1afe646701c0c6ea942ea
2022-08-23 09:05:04 +00:00
Vadim Yanitskiy dd4d0d0354 layer23: use $(top_builddir) instead of relative paths
Change-Id: Ib2c9264b2a3cdef9b9852bdead94bae03185fec8
2022-08-21 20:45:05 +07:00
Vadim Yanitskiy 26edb66906 layer23: cosmetic: make Makefile.am files git-friendly
Change-Id: I26d7ff4ae278b5b465863252fe12ac1b46780dc7
2022-08-21 20:45:05 +07:00
Oliver Smith e634dec487 mobile/subscriber.c: fix auth resp with test sim
Do not send a dummy authentication response with the test sim.

Fixes: 39dc9c46 ("mobile/subscriber.c: consider GSM_SIM_TYPE_SAP too")
Change-Id: I0ee910c171d383fb2cdcaf5eb54eafe18da3430b
2022-02-23 17:59:32 +01:00
Oliver Smith 1741372556 treewide: remove FSF address
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: I73be012c01c0108fb6951dbff91d50eb19b40c51
2021-12-14 12:52:04 +00:00
Pau Espin e5a9077dbd mobile: generate coredump and exit upon SIGABRT received
Previous code relied on abort() switching sigaction to SIG_FDL +
retriggering SIGABRT in case the signal handler returns, which would
then generate the coredump + terminate the process.
However, if a SIGABRT is received from somewhere else (kill -SIGABRT),
then the process would print the talloc report and continue running,
which is not desired.

Change-Id: Ied0f47378a5d348b857424adb5c874c1c093b485
Fixes: OS#4865
2020-11-25 18:45:26 +01:00
Harald Welte c6fb802252 Use osmo_fd_*_{disable,enable}
Change-Id: If4c7f946852d153bd472e5c704f8d517d26ca22e
Depends: libosmocore.git Idb89ba7bc7c129a6304a76900d17f47daf54d17d
2020-11-11 20:14:58 +00:00
Harald Welte 46cf9b1043 gsm48_rr: Don't swap ber with snr in "MON:" log line
I was quite confused why I constantly see a bit error rate reported
by gsm48_rr, while at the same time the actual L1CTL_DATA_IND did
all state num_biterr == 0.

So the log statement was broken ...

Change-Id: I09bb6c606a8437b213bb444949c78a7c8a10542c
2020-10-23 23:32:10 +02:00
Harald Welte d90ae30caa mobile: Use osmo_fd_setup() in script_lua.c
Change-Id: Ib6f97b9b8f3af63b81b92071b7fdb1fd55da89a5
2020-10-21 11:56:43 +00:00
Harald Welte de31aa3af7 Use osmo_fd_setup() whenever applicable.
Change-Id: If9b636c295fc6b5349a54c70662f09efa616ee63
2020-10-18 23:34:46 +02:00
Harald Welte 508d8523c0 Use OSMO_FD_* instead of deprecated BSC_FD_*
Change-Id: Ibf64b18288b9109927035f650d6ef7ad9f15d688
2020-10-18 22:43:05 +02:00
Vadim Yanitskiy 8194febb09 layer23/mobile: implement handling of TCH test loop commands
For more information, see 3GPP TS 44.014, sections:

  - 5.1 "Single-slot TCH loops", and
  - 8 "Message definitions and contents".

This feature has nothing to do with the Mobility Management, so
let's handle GSM48_PDISC_TEST messages in the Radio Resources
layer implementation (gsm48_mm.c -> gsm48_rr.c).

Change-Id: If8efc57c7017aa8ea47b37c472d1bbb1914389ca
2020-07-31 00:48:06 +07:00
Vadim Yanitskiy 8208a336ab layer23/mobile: fix a memory leak (msgb) in gsm48_rr_data_ind()
Change-Id: I55dcccf5b7d27d012908759954182eaec434d26b
2020-07-30 16:46:50 +07:00
Vadim Yanitskiy df2b46471d layer23/mobile: fix wrong message type in gsm48_rr_tx_rr_status()
Change-Id: I57c6a4e1e725da52c50e2a28e56627a3f3827c62
2020-07-30 16:07:27 +07:00
Vadim Yanitskiy e7e4d86f0e layer23/mobile: cosmetic: use GSM48_PDISC_TEST from gsm_04_08.h
Change-Id: Ie1f14b37f6138f5a019a25bdbc8a3531418df6c2
2020-07-29 03:58:23 +07:00
Oliver Smith 901ac89735 mobile: loopback: support EFR
Related: SYS#4924
Change-Id: I73d1f88b0865ad97b85418ff76739febf2e128a7
2020-05-05 12:22:32 +02:00
Oliver Smith 8f04fa9758 mobile: traffic req check: support EFR
L1CTL handling code should not be involved in such high level checks, so
while at it, move the check into a separate function in gsm48_rr.c and
add a length check. gsm48_rr_tx_voice() is the only caller of
l1ctl_tx_traffic_req().

Related: SYS#4924
Change-Id: Iba84f5d60ff5b1a2db8fb6af5131e185965df7c9
2020-05-05 12:22:26 +02:00