Commit Graph

1120 Commits

Author SHA1 Message Date
Piotr Krysik e11b1d3710 Major simplification and some argument changes in grgsm_capture
grmgs_capture tried to do too many things for a simple recorder.
It was simplified by removing the receiver and ability to
save data to bursts files.

All other stuff that is not necessary for recording signal to disk was
also removed:
-setters/getters,
-storing of parameters that never will be changed.

The 'fc' parameter name was changed to 'freq' to follow GNU Radio
guidelines.

The 'shiftoff' parameter was removed.

'bb_gain' and 'if_gain' parameters were added.

Variables specific to some of SDR's like:
-gains at different stages,
-bandwidth (not all devices can set it),
-antennas (some devices have just one, some not),
were moved to separate options group.

What is left to be exposed is:
-dc_offset_mode,
-iq_balance_mode,
-gain_mode.

Change-Id: I092a43eaddb09a99c6cc05fde13f0ae94d9e0251
2019-07-18 10:31:27 +02:00
Vasil Velichkov 8c30ba6687 grgsm_livemon: Use the osr variable in all blocks
In the GSM input adaptor and GSM Receiver blocks the osr was hardcoded
to 4 and cannot be changed using the command line parameter.

Change-Id: I4e85b898f05db636f18fdea6e5fee4fed6e0382a
2019-07-18 10:31:27 +02:00
Vasil Velichkov 4b034e7141 MacOS fixes
- Include grgsm/endian.h in tch_h_decoder_impl.cc
- Revert 0ed39fbf93 as linking with
  boost_thread is needed

Fixes GH-444

Change-Id: I00884962295082cff3eb64fa21e9f73437be0001
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy 6feac435ed apps/grgsm_trx: introduce initial LMS driver support
Change-Id: Ie983b10d1814906b6e659213f865e58d0f5c08e4
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy ad0c62a41c apps/grgsm_trx: add RadioInterface driver selection argument
Change-Id: Ic11f878c176bad16b057f25725ab0cfecc01782f
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy 25203809c1 trx/radio_if.py: print type of RadioInterface
Change-Id: I6c1ba8546caec122cd1ea0ed87656f691abec068
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy 6ee957f904 python/trx: fork RadioInterfaceUHD from RadioInterface
Change-Id: I1644a3f6b8da0d5f2a1a133058269e5383948fda
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy 8072d3acd8 trx/ctrl_if.py: use relative import for UDPLink
Change-Id: If4b00f6332461d3c37cde5a1f724906ca3d3a30f
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy 0b70fcc19b trx/radio_if.py: update clock_offset_control in set_rx_freq()
Change-Id: I065bf664f775099c90c123c9ff75f262a73bf1be
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy 5819e31450 trx/radio_if.py: do not print anything if freq. shift is 0
Change-Id: I100ce2ab8effc00e164e13253894445bdc816f06
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy 2cbc3b5d97 python/trx: introduce and use Transceiver class
Change-Id: I6dc88edbb69a68746cc8e01206dc86f7ea2fa80f
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy 04863d978f trx/ctrl_if_bb.py: reset transceiver on POWEROFF
Change-Id: I1e7f74c56388a431794a0b32b8a9537c360f5d33
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy 6e7f2ce50c trx/radio_if.py: introduce a new @property 'ready'
Change-Id: I513da0f45c6a608d15fbd0e8eafe14d6af8833d7
2019-07-18 10:31:27 +02:00
Vadim Yanitskiy 7d8a1caa0f trx/radio_if.py: do not init both rx_freq and tx_freq
Change-Id: I9f251958ec90141d144fdb027aff20182131a1d1
2019-07-18 10:31:26 +02:00
Vadim Yanitskiy d54e8fb500 python/trx: get rid of FakePM class
Change-Id: Ie96eb9735ecaa3329135c7be976ffd277a2f64f4
2019-07-18 10:31:26 +02:00
Vadim Yanitskiy 3e6bfe799e apps/grgsm_trx: move init code from run() to __init__()
Change-Id: I1bcc9c8a2d37d156bbec93be3838200f6c4a80c2
2019-07-18 10:31:26 +02:00
Vadim Yanitskiy 44d8c1e16b python/trx: use CamelCase naming for basic classes
Change-Id: Ica9c56d01191dda38e63b51caba2ec8c63b671c9
2019-07-18 10:31:26 +02:00
Vadim Yanitskiy 0d0508aa86 trx/radio_if.py: use existing 'dict_toggle_sign' block
Change-Id: Ifa616644a858f493b9f8706663f9e7fed717f3d0
2019-07-18 10:31:26 +02:00
Vadim Yanitskiy ac3fe63bad python/trx: rename 'change_sign_of_dict_elements' to 'dict_toggle_sign'
The old name was quite long, resulting into cumbersome imports:

  from change_sign_of_dict_elements import change_sign_of_dict_elements

let's use a shorter variant:

  from dict_toggle_sign import dict_toggle_sign

Change-Id: Ie75e1d6e5e74c7c1cf34154633c1472e4b85dbb6
2019-07-18 10:31:26 +02:00
Vadim Yanitskiy 31c543f008 python/trx/__init__.py: cosmetic: add missing new line
Change-Id: I379b321866bd892a52b0c272ed50c670da380a17
2019-07-18 10:31:26 +02:00
Vasil Velichkov 4d300e9c61 Improve voice boundary detection
Decode Alerting and Progress messages and if the in-band information
flag is set start decoding the voice
2019-07-18 10:31:26 +02:00
Vasil Velichkov 2479152d5c Add TCH/H decoder tests 2019-07-18 10:31:26 +02:00
Vasil Velichkov 5968552b47 Add TCH/H decoder block with AMR multirate support
Add new TCHH channel mode
Add two new optional arguments

    -m CHAN_MODE, --mode=CHAN_MODE
                        Channel mode. Valid options are 'BCCH' (Non-combined
                        C0), 'BCCH_SDCCH4'(Combined C0), 'SDCCH8' (Stand-alone
                        control channel) 'TCHF' (Traffic Channel, Full rate),
                        'TCHH' (Traffic Channel, Half rate)

    --sub-channel=TCH_H_CHANNEL
                        TCH/H sub-channel. [default=0]
    --multi-rate=MULTI_RATE
                        The MultiRrate configuration element from the
                        Assigment Command message. Example: 28111a40. See 3GPP
                        TS 44.018 - 10.5.2.21aa MultiRate configuration

Example:
    grgsm_decode -m TCHH --sub-channel 0 --multi-rate 2811 -o voice.amr ...
2019-07-18 10:31:26 +02:00
Vasil Velichkov 9d3606b17e Add tests for the TCH/F and TCH/H Demappers 2019-07-18 10:31:26 +02:00
Vasil Velichkov 63e568dc3d Move HR demapping into a separate block 2019-07-18 10:31:26 +02:00
Andrew Artyushok 3e2f883ba0 Add HR demapping 2019-07-18 10:31:26 +02:00
Piotr Krysik 7fb1738cd8 transmitter/txtime_setter: fix error print syntax error 2019-07-18 10:31:26 +02:00
David Holm 9aadf3db64 lib/trx, lib/transmitter: Include grgsm/endian.h
MacOS X does not have endian.h and the build will fail unless
grgsm/endian.h is used.
2019-07-18 10:31:26 +02:00
Vadim Yanitskiy fad602b2b0 trx/txtime_setter: print error if reference fn is missing
Change-Id: I2a6e3f41b6fe79b92d85ff98bc2cd9afd9bdc568
2019-07-18 10:31:26 +02:00
Vadim Yanitskiy 06f76fb3a6 trx/txtime_setter: reduce code nesting in process_txtime_of_burst()
Change-Id: I5c334e16d6b28a5e32cd62a177ad56bfc8e748ee
2019-07-18 10:31:26 +02:00
Vadim Yanitskiy ef93382ed1 apps/grgsm_trx: (re)structurize help message
Change-Id: I612d8ae7d3ff99fee809e10d95919989bfbe0f59
2019-07-18 10:31:26 +02:00
Piotr Krysik db65883a68 apps/grgsm_trx: remove redundant unit from freq_offset variable name
Frequency is always in Hz so there is no need to add that
information in the variable name.

Change-Id: I509771c3fe072069a680f66b0763ae6825f6d529
2019-07-18 10:31:26 +02:00
Vasil Velichkov ad01342ec7 Add .gitreview similar to the other osmocom's projects
A gitreview file is required to use git review.
More information about git review
https://docs.openstack.org/infra/git-review/
https://www.mediawiki.org/wiki/Gerrit/git-review

Change-Id: Ie07446ba1a13e53c87bcc9b23e3b775803d158f4
2019-07-18 10:31:25 +02:00
Piotr Krysik 554aa905e4 receiver/time_sample_ref: improve accuracy of offset<->time conversions
Change-Id: Ie6e7ea4337c9e23a8e4445136a3adffc96b19942
2018-11-02 11:52:43 +01:00
Piotr Krysik 89dc99016e misc_utils/resampler: Add offsets of tags at the input
This change is done to make keeping track of sample counter
at the input of the resampler easier from blocks connected
to its output. Each tag leaving the resampler has accompanying
"original_offset" tag with its offset before sample rate change.

Change-Id: Iea8ca4a092029f774406dced8a97a17810f21f62
2018-11-02 11:50:14 +01:00
Piotr Krysik acd7d71db4 misc_utils/resampler: Cosmetic changes
Change variables names to more readable.
Remove old comment.

Change-Id: Ibe22677cfc4b3e1a9fb900e5055cdce0a7656a92
2018-11-02 11:31:32 +01:00
Piotr Krysik 6a0fb1a415 misc_utils/resampler: Fix repetition of tags at the output
When tag appears at the last sample of the ouput buffer
it will be added again in the next run of the work function.

Here this issue was solved by changing the codition so the
tag appearing at the end of the output buffer is not added.

Change-Id: Ia4f0923e2071184879a023d0fe01026d8e9ccbda
2018-11-02 11:26:13 +01:00
Vasil Velichkov 00a9c400a8 grgsm_channelize: Add ichar data type
This is the output format of rtl_sdr and hackrf_transfer and this would
allow direct channelization without an additional post processing.

Change-Id: Ia489eca9ec7defc3a83946c42f1ae3f136efe4e8
2018-09-13 15:35:44 +02:00
Piotr Krysik d6e8bb744e apps/grgsm_trx: remove unnecessary checks of freq_offset
Checking if freq_offset is None doesn't make sense currently
as it's always set to a float value by argparse (to 0 by default).

Change-Id: Ie8bae1ccde60d07fc25e0b874afa5aaaac04d8a7
2018-09-13 15:35:44 +02:00
Piotr Krysik 11583adb9d trx/radio_if: add freq_offset parameter to constructor
Change-Id: Ie1db02b719a0fec478b8a8b8a95643fb10fdfce5
2018-09-13 15:35:44 +02:00
Vasil Velichkov 492f48c7d3 burst_file_source: Fix reading longer bursts
- Read bursts with pmt::deserialize directly from the std::filebuf
- Remove the unused unserialized variable
- Add tests

Since df978693 when the rx_time tags are present in the incomming stream
the gsm receiver adds fm_time to the burst's PMT and the bursts that
burst file sink writes becomes longer because of the additional field.

The burst file source block was expecting all burst to be 147 bytes long
and reading files with longer bursts was failing with an unhandled exception.

terminate called after throwing an instance of 'pmt::exception'
thread[thread-per-block[5]: <block dummy_burst_filter (2)>]: pmt_cdr: wrong_type : #f
  what():  pmt::deserialize: malformed input stream, tag value = : 115

Change-Id: I989b0d6a6b214088b7880e5cbf7bb6725492dbfc
2018-09-13 15:35:44 +02:00
Piotr Krysik 262bda10e6 apps/grgsm_trx: migrate from getopt to argparse
Change-Id: I24a17b4cd44db0ce95a19d7470f4f09f3c85a26d
2018-09-13 15:35:44 +02:00
Piotr Krysik 58659a4dee trx/radio_if.py: clarify magic numbers in sample rate calculation
Change-Id: I55f283113d0324a0236b7bbf13bce5718003b857
2018-09-13 15:35:44 +02:00
Vadim Yanitskiy 562125270b apps/grgsm_trx: fix inaccurate sample rate calculation
Change-Id: I0c309588fa0f7822abfb3919327639735db07679
2018-09-13 15:35:44 +02:00
Vasil Velichkov 9e46c4807d Format the output into ostringstream and then write it at once.
This fixes the garbled output when multiple printers are used in a
flowgraph.

closes #255
closes #420

Change-Id: I1012ed26371b4c67163545652f0a1ce0f576af9e
2018-09-13 15:35:44 +02:00
Vasil Velichkov 1e04c1fd9c grgsm_scanner: Add --debug option
When set the stdout and stderr won't be redirected to /dev/null which
will facilitate resolving issues

Change-Id: I11e99facb5a1ab9c9bfee3c314a91a74f98a2523
2018-09-13 15:35:44 +02:00
Piotr Krysik ba6fd0e776 Revert "grgsm_trx: Migrated argument parsing to argparse" that shouldn't be pushed
This reverts commit c62a3d9f55.
2018-09-13 15:35:44 +02:00
Piotr Krysik fcb64a8adf grgsm_trx: Migrated argument parsing to argparse
Argparse makes adding new parameters easier and
adds consistent way of handling default values of
parameters and printing of their help info.

Change-Id: Idf99fd7a581464aa2f77fe01e721dbd162686811
2018-09-13 15:35:44 +02:00
Vadim Yanitskiy 3f9abbdf92 apps/grgsm_trx: add baseband frequency shift feature
An ability to shift the baseband frequency would allow one to
run both base stations and (OsmocomBB-based) mobile stations on
any frequency (e.g. in 2.4 GHz WiFi band)!

This is achieved by adding a given frequency offset to the
result of "ARFCN -> RX/TX frequency" calculation.

Usage example:

  grgsm_trx --freq-offset -500M

Both RX (Downlink) and TX (Uplink) frequencies will be shifted
by 500 MHz back, e.g. tuning request to ARFCN 105 would result
in tuning the radio to 456.0 MHz (instead of 956.0 MHz).

Related: OS#3520 (https://osmocom.org/versions/136)
Change-Id: I42e397e47402a87f4141ef31b25eff4c8c1267e2
2018-09-13 15:35:44 +02:00
Piotr Krysik 22cd7c973f Changed submodule URLs to point to osmocom servers 2018-09-13 15:35:44 +02:00