Commit Graph

735 Commits

Author SHA1 Message Date
Vadim Yanitskiy 5d634b6118 gsmmap: move this utility to 'layer23/src/misc/'
What I find weird is that the gsmmap is using files from layer23,
and vice-versa cell_log from layer23 is using files from this
utility.  And somehow they are separate sub-projects.

I see no reason why gsmmap must be in its own sub-project.

Change-Id: I2bc9c8897f3c7ccf207be0146f7b55fc733a6abb
2023-01-03 02:43:57 +07:00
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 3432c6cfe0 layer23/sysinfo: update coding style, make pointers const
Change-Id: Ia518251eae1b45ad573d076d97cba83ed25ea9ea
Depends: libosmocore.git Ide9110b984d3302aec6b439c563eb10e2dcdec9e
2023-01-02 20:24:50 +07:00
Vadim Yanitskiy e25fb14f6d layer23/sysinfo: use OSMO_MIN from libosmocore
Change-Id: Ic01cadda13a7d7a3d34ddb94bd3964044f38959c
2022-12-31 02:36:03 +07:00
Vadim Yanitskiy ed29bd3e41 modem: Makefile.am: remove unneeded CFLAGS and LIBS
Change-Id: I2bb04f526c4e3019c548786f2cdfb96b018826ec
2022-12-30 20:27:43 +07:00
Vadim Yanitskiy 9b1df1231f layer23: configure pretty logging for misc apps
Change-Id: I827055bcf04f8003fcb90e6c8c90813ecda2efed
2022-12-30 20:27:43 +07:00
Vadim Yanitskiy 00a67a0e9d layer23: use osmo_stderr_target in misc apps
Change-Id: I56770f04fa3c440e6ccabe6f6fccfe171d41d751
2022-12-30 20:27:43 +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 7c2a471103 layer23: fix rx_l1_sim_conf(): msg->l2h is NULL, use msg->l1h
The mobile app crashes when using a Calypso phone and specifically
when using its built-in SIM reader.  The problem is that msg->l2h
is NULL in rx_l1_sim_conf(), so msg->l1h must be used instead.

  Assert failed msgb->l2h /usr/local/include/osmocom/core/msgb.h:162

Change-Id: I7c68a3ad393be5fd0413e00e119a06db59672357
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 16ad87bf52 mobile: make LUA support configurable via --with-lua53
Change-Id: If440cee52410421034823a3749709e28c4136b95
2022-11-29 06:05:55 +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 a3b86ad4dd mobile: voice.h: add missing forward declarations
Change-Id: I854abdcde5bc324f6d0cf309792b36fc64601070
Related: OS#5599
2022-11-29 02:21:57 +07:00
Vadim Yanitskiy 7900ba1a13 mobile: voice.h: use '#pragma once' include guard
Change-Id: I024e13c0f66ae1e42b0c8e2ff77874fcb883e85a
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
Vadim Yanitskiy bdc5acdb13 layer23: l1ctl_tx_traffic_req(): cosmetic: drop dead code
Change-Id: I941899ab27282a495f965ae9a0f41076dceef953
Related: OS#5599
2022-11-27 06:12:38 +07:00
Vadim Yanitskiy 887b141699 layer23: add 'src/modem/modem' to .gitignore
Change-Id: I37e536493ddfd3bff1674d5bc85f40a0bbd0f317
2022-11-25 22:26:20 +07:00
Pau Espin e9f24d734a host/layer23: Add modem app
This app will allow setting up a tun device to transmit/receive data
as a GPRS MS against a GSM network.

This is just the initial skeleton so that people can work on it further
in follow-up commits.

Related: OS#5503
Change-Id: I8a1121b3287da7d7330c30e3118affa8fd1da61b
2022-11-21 19:56:54 +01: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
Vadim Yanitskiy 6ba147556b layer23: add -Werror={implicit-int,int-conversion,old-style-definition}
Change-Id: Ia6e0c717c782ea000f1d40ad11af2ee725f9c309
2022-11-05 19:10:55 +07:00
Vadim Yanitskiy 671ac36b11 layer23: configure.ac: print CFLAGS/CPPFLAGS using AC_MSG_RESULT()
Change-Id: Ib8d7138f7d5504176156ea5349336f5994c8fa80
2022-11-05 19:10:02 +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
Pau Espin a53e93fe9c trxcon: Initial support for forwarding AMR
This allows TTCN3 L1CTL module (used in BTS_Tests) to transmit and
receive AMR payloads towards osmo-bts-trx.

Related: SYS#5987
Change-Id: Ia20bc96e39726a919a556c83c8be48cb31af7331
2022-09-07 00:01:53 +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