Commit Graph

195 Commits

Author SHA1 Message Date
Vasil Velichkov f51a624ec0 Filter out SoapyAudio devices
When gr-osmosdr is compiled with SoapySDR support and SoapyAudio is
installed the audio device is picked as a first choice when detecting
devices but grgsm tools are not able to work with audio devices. So in
such cases the user has to always specify the correct SDR device in the
args parameter which is a bit inconvenient.

When args is not specified call osmosdr.device_find to get all devices
and filter out unspported ones like SoapyAudio devices. When args is
specifed just try to create osmosdr.source with whatever value has been
specified.

Add -l and --list-devices command line option that prints information
about all detected devices.

Example commands:
  grgsm_capture --list-devices
  grgsm_capture --list-devices --args=nofake
  grgsm_capture --args=uhd,type=b210 -a 111 capture.cfile
  grgsm_livemon --args=rtl
  grgsm_livemon --args=uhd,type=b210

Change-Id: Ib84081041ca6c2bc18b9da0c32bac9d3ecef65ca
2019-07-18 10:31:27 +02:00
Vasil Velichkov b615cefdee grgsm_capture: Fix device arguments
We need a space between numchan=1 and the rest of the device arguments
otherwise when --args is specified it fails with RuntimeError: bad lexical cast

$ grgsm_capture --args=soapy

Traceback (most recent call last):
  File "/usr/local/bin/grgsm_capture", line 179, in <module>
    device_args=options.device_args)
  File "/usr/local/bin/grgsm_capture", line 57, in __init__
    osmosdr.source(args="numchan=1" + device_args )
  File "/usr/local/lib64/python2.7/site-packages/osmosdr/osmosdr_swig.py", line 1170, in make
    return _osmosdr_swig.source_make(*args, **kwargs)
RuntimeError: bad lexical cast: source type value could not be interpreted as target

Change-Id: I2d1bcee835b695c91a5c44ec78a40b2d969f611c
2019-07-18 10:31:27 +02:00
Vasil Velichkov 807e06139b Fix the TCH/H decoder and demapper XML definitions
- The second argument of tch_h_decoder constructor is a string that
  accepts the value of MultiRate configuration element and not an enum
  like the tch_f_decoder decoder.
- Make the demapper's burst sink required.
- Make all parameters visible.
- Rename the TCH/H Channel parameter to Sub-channel number.
- Add the qa_tch_h_decoder test in the CMakeLists.txt
- Fix several typos

Change-Id: I92d4f49955c634df7d76f17cfb58d7106846c1bd
2019-07-18 10:31:27 +02:00
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
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 6ee957f904 python/trx: fork RadioInterfaceUHD from RadioInterface
Change-Id: I1644a3f6b8da0d5f2a1a133058269e5383948fda
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 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
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
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 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
Piotr Krysik 262bda10e6 apps/grgsm_trx: migrate from getopt to argparse
Change-Id: I24a17b4cd44db0ce95a19d7470f4f09f3c85a26d
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 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
Vadim Yanitskiy 216558454d apps/grgsm_trx: introduce bind address option
The new option (-b --bind-addr) allows one to specify the bind
address for both DATA and CTRL interfaces. By default, '0.0.0.0'
is used, so there are no restrictions for the L1 source address.

Change-Id: I3339f686b53db07cfd1bff9a516f4bdc28058cd9
2018-09-13 15:35:44 +02:00
Vadim Yanitskiy ed9d7282d4 trx/udp_link.py: close socket in destructor
Previously it was required to call the UDPLink.shutdown() method
manually in order to close a socket. Let's do it automatically
using the destructor of UDPLink.

Cherry-picked from: I59c3dc61ec58cd9effeb789947d28fd602ca91f4
Change-Id: Ief7aa21d1e50682a90616833b679741957193aae
2018-09-13 15:35:44 +02:00
Vadim Yanitskiy 4cedbb530e apps/grgsm_trx: use format string for help message
Instead of using the hard-coded default values in help message,
it makes sense to use a format string, and pass the actual
values when printing help.

Change-Id: Ib1bf0ef3ded86aa92faeb9b63eb286283f5c8c3d
2018-09-13 15:35:44 +02:00
Vadim Yanitskiy 07a2abb635 grgsm_trx: change default TRX port number to 6700
In order to avoid clashes with OsmoTRX, which may be also
running on the same host, let's use a different port range
starting from 6700 by default.

This idea was introduced as a result of OS#2984.

Change-Id: Iaf0c78733bfefcb0b0938abf6d316e27d03ecab4
2018-09-13 15:35:44 +02:00
Vadim Yanitskiy a609d2f9c9 apps/grgsm_trx: also print Piotr as a copyright holder
Despite the most part of Python code was written by Vadim, it's
heavily based on huge and impressive work done by Piotr. Let's
also print his credentials in the license header.

Change-Id: Icca7c679d84f99440ff502219f624e0f73112744
2018-09-13 15:35:44 +02:00
Piotr Krysik bbc8af53e8 Placing grcc compilation utils in separate files
Avoiding increasing required cmake version with use of wrapper shell script.
2018-09-13 15:35:44 +02:00
Vasil Velichkov f608e7c766 Add cmake options that enable/disable grcc compilation
To disable compilation of both grgsm_livemon and grgsm_livemon_headless
execute

  cmake -DENABLE_GRCC=OFF ..

To disable only one execute

  cmake -DENABLE_GRGSM_LIVEMON=OFF ..
  cmake -DENABLE_GRGSM_LIVEMON_HEADLESS=OFF ..
2018-09-13 15:35:44 +02:00
Piotr Krysik 3fbc96c5ea Changing tabs to spaces 2018-09-13 15:35:44 +02:00
Piotr Krysik 02454b32b9 Disabling installation of desktop files
Installation of dekstop files is causing problems with packaging - github issue #335.
Disabling it then.
2018-09-13 15:35:44 +02:00
Piotr Krysik 4a3a52c897 Commenting out a line causeing crash on HackRF 2018-09-13 15:35:44 +02:00
Piotr Krysik 0aa24edf21 Added short description of grgsm_trx 2018-05-05 13:06:22 +02:00
Piotr Krysik 2471052cfe Merge branch 'fixeria/trx' of https://github.com/axilirator/gr-gsm into fixeria_trx
# Resolved conflicts:
#	apps/grgsm_trx
#	python/trx/radio_if.py
#	swig/grgsm_swig.i
2018-04-17 09:10:33 +02:00
Piotr Krysik d77414b827 GRCC: Adding new directories to python path to make grc files compile after merger 2018-04-17 08:22:11 +02:00
Piotr Krysik 8a8d41a583 Merge branch 'ptrkrysik/trx' into development 2018-04-16 22:21:29 +02:00
Vasil Velichkov 0feb4ab51f Fix the parallel build.
- Override the GR_UNIQUE_TARGET function to not append a hash to the
  target name.
- Add explicit dependency between pygen_apps and _grgsm_swig
  The _grgs_swig needs to be built first because grcc evaluates and
  verify all imports
- Test the parallel build in the docker containers as well
2018-03-22 06:07:24 +01:00
Vasil Velichkov b479fb4457 Compile the .grc files with cmake and grcc
And remove the pre-built scripts from the repository

Fixes #13
2018-03-22 06:07:24 +01:00
Piotr Krysik f0c83d84e0 Fixing missing callback to set_fc in clock_offset_control block 2018-01-23 15:07:08 +01:00
Vadim Yanitskiy 14b8e854c2 apps/grgsm_trx: use 4 * GSM_SYM_RATE as default sample rate
With this sample rate it's easier to synchronize
training sequence with the signal.
2017-12-04 00:22:39 +07:00
Piotr Krysik 66c56e7803 trx: Changed default gain to 40 2017-12-01 11:58:53 +01:00
Piotr Krysik be1da4a233 trc: Changed sample rate to 4 times GSM symbol rate 2017-11-30 13:44:54 +01:00
Vadim Yanitskiy 0e7c9a80ad apps/grgsm_trx: fix antenna selection options
Both '--rx-antenna' and '--tx-antenna' require an argument.
2017-11-29 23:11:14 +01:00
Piotr Krysik ab8cde9b7a Making headless livemon executable 2017-11-05 17:44:26 +01:00
Vadim Yanitskiy 790b6f0cc1 apps/grgsm_trx: add cmd line arguments for TX chain 2017-11-05 17:33:26 +01:00
Vadim Yanitskiy 5d68aa5620 apps/grgsm_trx: get rid of unused subdev_spec
This could be specified via the device_args,
for example: "subdev=B:0".
2017-11-05 17:33:26 +01:00
Vadim Yanitskiy ba7ad29638 apps/grgsm_trx: import helper classes from grgsm.trx 2017-11-05 17:33:26 +01:00
Petter Reinholdtsen 615fc86d53 Making arfcn<->freq conversions more robust for grgsm_livemon too (closes issue #337). 2017-09-25 23:41:52 +02:00