summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2018-12-11trx_toolkit/ctrl_if.py: read data from socket in handle_rx()Vadim Yanitskiy2-5/+7
It makes much more sense to read data from socket in handle_rx(), instead of expecting a buffer with received data from caller. Change-Id: I83479c60c54e36a2a7582714a6043090585957ae
2018-12-11trx_toolkit/ctrl_if_*.py: transparently pass UDPLink argumentsVadim Yanitskiy2-4/+4
There is no need to (re)define the arguments of UDPLink's constructor. Let's use non-keyworded variable length argument list (*args). Change-Id: Ia312a5e15ce88d5f7e8d76c4ea8c93c59d91be5a
2018-12-10trx_toolkit/ctrl_if_bb.py: fix SETTA command handlingVadim Yanitskiy1-1/+1
Since I8fd2a2ab7784b38bde5ebcfd0359b7e2cb53f5a7, SETTA command handling was broken, because the range limitation was removed together with argument parsing. Let's fix this. Change-Id: If582af3849359866de129504cc5b2dc6d64edbd5
2018-12-08trx_toolkit: merge copyright.py into app_common.pyVadim Yanitskiy8-32/+25
Since we have introduced ApplicationBase class, that are used by all existing applications, let's merge the copyright printing helper into it. Change-Id: I8b70ec2dd08cb2ffed733d2c4e1215b094f8d3d5
2018-12-08trx_toolkit: introduce logging configuration argumentsVadim Yanitskiy6-15/+97
Before this change, it was impossible to configure logging parameters from command line, such as log level and format. This change introduces the following optional arguments: --log-level - logging level for stderr (by default, DEBUG); --log-format - logging message format for stderr; --log-file-name - enable logging to a given file; --log-file-level - logging level for file (by default, DEBUG); --log-file-format - logging message format for file; which are defined in a new class called ApplicationBase, so all existing applications should inherit them now. Change-Id: Ic3b0440cd73946ad444bd7e48feb7a92d45f6488
2018-12-07trx_toolkit/fake_trx.py: migrate from getopt to argparseVadim Yanitskiy1-90/+44
Change-Id: I0218a328671c591b20b0666dc7c39ba865892acc
2018-12-07trx_toolkit/trx_sniff.py: migrate from getopt to argparseVadim Yanitskiy1-121/+65
Change-Id: Id1dacaa32134bfa68344e6c48310390cdd85cdc9
2018-12-07trx_toolkit/ctrl_cmd.py: migrate from getopt to argparseVadim Yanitskiy1-59/+27
Change-Id: Ib9bf5ed7384c4f34478975cefe03880eb2fc8069
2018-12-07trx_toolkit/burst_send.py: migrate from getopt to argparseVadim Yanitskiy1-131/+63
Change-Id: I1be66aa022a79aa1683f0e6cfebaed568b1736b1
2018-12-07trx_toolkit/burst_gen.py: migrate from getopt to argparseVadim Yanitskiy1-145/+88
Change-Id: I7eb3f2e2713f1f97293bd47a2eae3b140f63fb59
2018-12-07trx_toolkit/burst_gen.py: fix short version of --burst-typeVadim Yanitskiy1-3/+3
Both '--bind-addr' and '--burst-type' had the same short '-b'. Let's use the upper case version for '--burst-type'. Change-Id: Ib8a46e25cbc6266c3e147582f9e8045362270151
2018-12-07trx_toolkit: use generic logging module instead of print()Vadim Yanitskiy12-95/+145
There are multiple advantages of using Python's logging module: - advanced message formatting (file name, line number, etc.), - multiple logging targets (e.g. stderr, file, socket), - logging levels (e.g. DEBUG, INFO, ERROR), - the pythonic way ;) so, let's replace multiple print() calls by logging calls, add use the following logging message format by default: [%(levelname)s] %(filename)s:%(lineno)d %(message)s Examples: [INFO] ctrl_if_bts.py:57 Starting transceiver... [DEBUG] clck_gen.py:87 IND CLOCK 26826 [DEBUG] ctrl_if_bts.py:71 Recv POWEROFF cmd [INFO] ctrl_if_bts.py:73 Stopping transceiver... [INFO] fake_trx.py:127 Shutting down... Please note that there is no way to filter messages by logging level yet. This is to be introduced soon, together with argparse. Change-Id: I7fcafabafe8323b58990997a47afdd48b6d1f357
2018-12-07trx_toolkit/fake_trx.py: drop randomization related cmd optionsVadim Yanitskiy2-42/+6
The randomization of both UL/DL RSSI and ToA values is optional, and can be configured from the control interface (see both FAKE_RSSI and FAKE_TOA commands). The command line options for enabling / disabling the randomization were redundant, so let's get rid of them and check if the corresponding treshold value is set. Change-Id: I6adc13b8989ade2fab895673525c0ca17bf9b3f2
2018-12-07trx_toolkit/burst_fwd.py: also pass-filter UL bursts by time-slotVadim Yanitskiy1-0/+5
For some reason, the time-slot pass-filtering was only done for DL bursts, but not for UL bursts. BurstForwarder shall not pass UL bursts for unconfigured time-slots too. Let's also print a warning if an UL burst is sent on a not configured time-slot, i.e. before sending SETSLOT command. Change-Id: Idb7f5b212e5814aeff8ca8bc875ad066674267cd
2018-12-07trx_toolkit/burst_fwd.py: properly pass-filter multiple time-slotsVadim Yanitskiy2-8/+19
Previously it was only possible to configure a single time-slot that would be pass-filtered by a BurstForwarder instance. In some applications it would be useful to configure multiple time-slots, so let's refactor the time-slot pass-filtering algorithm. Change-Id: Ie1490adaf7a7c62c966aeb60c1898eaf3b5a1e84
2018-12-06trx_toolkit/burst_fwd.py: document and refactor BurstForwarderVadim Yanitskiy1-48/+126
Instead of having all configuration variables of BurstForwarder initialized in the class heading, let's introduce two functions for initialization (resetting to defaults) of both UL/DL params. This would allow to reset a BurstForwarder instance from the control interface in follow-up patches. Let's also introduce some basic documentation for the class fields, which were defined in the heading previously. Change-Id: I6b1bf41cf22f01a7e7ecc91c625fb0d2bf4bfeac
2018-11-29trxcon/l1ctl.c: handle hopping channels from L1CTL_DM_EST_REQVadim Yanitskiy1-21/+62
Change-Id: I8617b5808748bc4df3d7cc9862ed8cf12613f270
2018-11-29trxcon/trx_if.c: add SETFH CTRL command supportVadim Yanitskiy2-0/+46
The idea of SETFH command is to instruct transceiver to enable frequency hopping mode using the following parameters: CMD SETFH <HSN> <MAIO> <CH1> <CH2> [... <CHN>] Note: since the length of a CTRL command is limited to 128 symbols (BTW: why?), the amount of channels is also limited. Change-Id: Id3d44e6a2796f1ce8523a49dedd5d484052a5c7f
2018-11-22trxcon/l1ctl.c: fix deprecated gsm_band_name() usageVadim Yanitskiy1-3/+13
Change-Id: I99bb935b7cd529c885bf10dc209b6016df8095d8
2018-11-21mobile: use VTY bind addr from config, deprecate cmd line optionsVadim Yanitskiy3-20/+19
This change revives the main idea of: Change-Id: I32517567847fd5c54b1742f18bf409ff81e316fa to stop ignoring the VTY bind address from the config file. Furthermore, it deprecates (and disables) both 'u' and 'v' command line options, because they are redundant. Change-Id: I99e0ec1717edd29b3be231be86616cc7effe5d95
2018-11-21mobile: abort in case of argv handling errorsVadim Yanitskiy1-3/+10
The process should be aborted if a non-existing command line option or an incorrect parameter value is passed. Change-Id: Ib656ad12f12429ed15dc2a1554901ffa51148ff6
2018-11-21mobile/app_mobile.c: use LOGP() instead of printf()/fprintf()Vadim Yanitskiy1-9/+8
Change-Id: I6af76afbaa34dde5ddfc31a65700030862442dba
2018-11-21mobile/app_mobile.c: drop redundant printf() callVadim Yanitskiy1-1/+0
The VTY requisites are always being printed by libosmovty, there is no need to duplicate this information. Change-Id: I688f66175ea67d4c6a46819bee7d300ad9ce7cc7
2018-11-21Revert "mobile: fix vty bind ip override"Vadim Yanitskiy1-4/+3
This reverts commit c8de8cb1e126a18c0269571fba38310589dd9273 (Change-Id I32517567847fd5c54b1742f18bf409ff81e316fa by Max), because several problems were introduced, in particular: a) Help message of mobile application is broken: "The VTY IP to telnet to. (default (null))", "The VTY port number to telnet to. (default 127.0.0.1)". b) Default VTY bind addres != parsed from the config file. c) The (vty_ip == NULL) is resolved only when an external MNCC handler is used, otherwise NULL is passed to l23_app_init(). Change-Id: Ic63a4eb828ff32d3744886b4f5f6f5019c798620
2018-11-19mobile: fix vty bind ip overrideMax1-3/+4
Previously the vty bind config parameter was always ignored. Fix this by using proper default value from the config unless it's explicitly set via command-line parameter. Change-Id: I32517567847fd5c54b1742f18bf409ff81e316fa
2018-11-19Fix build with latest libosmocoreMax1-10/+0
Remove locally defined function which conflicts with the one in libosmocore. Change-Id: I1be1d39f7c93c959ca33f6296ecda71996865cca
2018-11-19l1l2 interface: use LOGP for socket errorsMax2-2/+4
Log via LOGP() like the rest of the file instead of fprintf() for consistency. While at it, also print error cause. Change-Id: Id205bcd9bdb7c3e4b96493d50be8381a6fa80ac6
2018-11-19osmocon: log error cause for socket openingMax1-1/+2
Change-Id: I2f871cb16e5e1033e42863a9e12459057004782c
2018-11-19mobile: log socket path on errorMax1-1/+1
Change-Id: I18eb46743e4c0e4e8f8032883f39fec355f03c78
2018-11-16mobile: use proper type for boolean flagsMax2-11/+11
This makes reading code easier and simplifies further modifications. Change-Id: I7eff2a61495ff167dc19fc9a41882a7a11fbf32d
2018-11-16mobile: add header for MS' MNCC functionsMax4-10/+12
This simplifies adding new functions and re-using them from other parts of the code. Change-Id: Ibad400a99afe052f011f54fc706836b6bf89f4b9
2018-11-08layer23: Avoid mempcy with NULL srcPau Espin Pedrol1-1/+2
Fixes following ASan warning: git/osmocom-bb/src/host/layer23/src/misc/../common/main.c:146:2: runtime error: null pointer passed as argument 2, which is declared to never be null The warning however is harmless since in that case, app_len = 0 and thus size to copy is 0. Change-Id: I009a5b53f1e5be72ce347d64d3a7cb1d95d37ea3
2018-11-05layer23: Fix build against gpsd >= 3.18Pau Espin Pedrol1-2/+13
Change-Id: I0e97d3e8c3688064c959ea60ecef50cfbbc1bcd6
2018-11-05cosmetic: fix trailing whitespacePau Espin Pedrol1-4/+3
Change-Id: I5c1a6d98079ad846d114584a17ba9d80d95e0595
2018-11-05l1ctl_proto.h: use flexible array member for traffic messagesVadim Yanitskiy3-16/+31
Unlike the DATA messages, traffic frames may have different length. Instead of having fixed payload (i.e. TCH frame) length, let's introduce a flexible array member. This would allow one to calculate the frame length using the MSGB API. Change-Id: I119fa36c84e95c3003d57c19e25f8146ed45c3c6
2018-10-27layer23/l1ctl.c: fix: use host byte order for TDMA fnVadim Yanitskiy1-1/+1
Change-Id: Iad00eebf03b38b9c4fc2d7ed66697d23a953d8b2
2018-10-27layer23/common: move SIM APDU caching from l1ctl.cVadim Yanitskiy3-16/+29
L1CTL implementation (i.e. l1ctl.c) is not a good place for the SIM specific stuff. Let's move it to the proper place (i.e. sim.c). As a bonus, this change fixes a possible problem of loosing the cached APDUs if two or more L2&3 applications are using a single LAPDm connection. The APDU buffer is dedicated per MS now. Change-Id: I564c610e45aa3b630ca5d1ec6bc1cace0dc9c566
2018-10-26trxcon: make TRX bind address configurableVadim Yanitskiy1-6/+17
Previously the wildcard address (i.e. '0.0.0.0') was hard-coded as the bind address of TRX interface. Let's make it configurable by introducing a command line option. Note that the '--trx-ip' option was deprecated by '--trx-remote', because it isn't clean whether it is remore or local address. It still can be used, but was removed from help message. Change-Id: Ic2f43632cc57bb6f722eba05219e438f97fecb95
2018-10-26Report socket path on errorsMax3-3/+3
Change-Id: Ib63e1205d7b845c8779eb511635f26bae3a18085
2018-10-23fake_trx: introduce CTRL commands for RSSI simulationPau Espin Pedrol2-0/+42
Since FakeTRX is a proxy, it basically emulates transceiver for both osmo-bts-trx and trxcon, hence there are two separate and independent control interfaces (usually, ports 6701 and 5701). All simulation commands (see 'FAKE_*') are usually implemented on both interfaces separately: - ctrl_if_bb.py - simulation commands affecting Uplink, - ctrl_if_bts.py - simulation commands affecting Downlink. This change introduces the 'FAKE_RSSI' command for both CTRL interfaces in two variations: - absolute: CMD FAKE_RSSI <BASE> <THRESH> - relative: CMD FAKE_RSSI <+-BASE_DELTA> where 'THRESH' affects optional value randomization. Change-Id: Ic01c31fb0304345dd7337c3ee1c7ee3c2d3e8460
2018-10-22firmware: set corret shebang in solve_envs.py python2 scriptPau Espin Pedrol1-1/+1
Change-Id: I64582568f7390b7f4e3253508209a59eb78ee4dd
2018-10-20trxcon/scheduler: add PDTCH channel supportVadim Yanitskiy4-4/+214
Change-Id: I1176576f54c1d68e79cc6ac37d61a9033f7018dd
2018-10-03layer23/l1ctl.c: clean up & fix message length checkingVadim Yanitskiy1-21/+44
Almost all handlers for received L1CTL messages are also affected by the bug fixed in I7fe2e00bb45ba07c9bb7438445eededfa09c96f3. In short, they do verify the length of 'msg->l2h' or 'msg->l3h', but not the 'msg->l1h'. Let's fix this, and also add missing checks. Change-Id: I866bb5d97a1cc1b6cb887877bb444b9e3dca977a
2018-10-03layer23/l1ctl.c: avoid confusion between L1CTL / L1 headersVadim Yanitskiy1-7/+7
As we assign the payload following L1CTL header to 'msg->l1h', it makes sense to avoid possible naming confusion. Change-Id: I5d21ca8664b3445f472d3ffde90d0e11805dcb16
2018-10-03layer23/l1ctl.c: fix: verify msg length using l1h, not l2hVadim Yanitskiy1-3/+4
The actual L1CTL header is pointed by 'msg->l1h', not 'l2h'! Since msg->l2h is NULL (because nobody set it), the result of msgb_l2len() would always be bigger than size of L1CTL header, as it is calculated in the following way: return msgb->tail - (uint8_t *)msgb_l2(msgb); So, in case if 'msg->l2h' is NULL, it turns into: return msgb->tail - 0; Change-Id: I7fe2e00bb45ba07c9bb7438445eededfa09c96f3
2018-10-03layer23/l1ctl.c: fix: verify msg length against l1ctl_hdrVadim Yanitskiy1-2/+1
In l1ctl_recv() we actually expect to 'see' the L1CTL header instead of the DL info header. Let's fix this. Change-Id: Ic7d017bef04f3c186565d5dade36959df1019bd8
2018-10-03layer23/l1ctl.c: keep L1 header, drop L1CTL headerVadim Yanitskiy1-16/+5
There is no need to keep the L1CTL header in messages being sent towards the upper layers, but the L1 info header can be used by L2&3 to obtain some information, e.g. TDMA frame number. Change-Id: Id64249f1b7a1c2be578263ba62aa195c452ab7e8
2018-10-03trxcon/scheduler: add dedicated CBCH mode supportVadim Yanitskiy1-0/+4
This change extends sched_trx_chan_nr2pchan_config() with Osmocom specific cbits related to CBCH, so now one can to decode CBCH channels in dedicated mode (see L1CTL_DM_EST_REQ). Change-Id: I9347c45638223cac34f4b48eb736e51a5055a36f
2018-10-03l1ctl_proto.h: extend ccch_mode enum with CBCHVadim Yanitskiy3-1/+10
According to GSM TS 05.02, there are two ways to enable CBCH: a) replace sub-slot number 2 of CCCH+SDCCH/4 (comb. V), b) replace sub-slot number 2 of SDCCH/8 (comb. VII). Unlike SDCCH/8 (case b), CCCH+SDCCH/4 can be allocated on TS0 only, and shall not use frequency hopping. This means that implementing CBCH support on SDCCH/8 would require much more efforts than on combined CCCH+SDCCH/4, as in last case CBCH messages can be received without the need to switch from idle to dedicated mode. This change introduces a new ccch_mode item, which should be used by the higher layers to indicate presence of CBCH channel on C0/TS0, so the PHY would enable decoding of CBCH messages on CCCH+SDCCH/4 (case a) in idle mode. Regarding to CBCH on SDCCH/8 (case b), it makes sense to extend the 'l1ctl_dm_est_req', so it would be handled in dedicated mode on request from the higher layers. Change-Id: Ia94ebf22a2ec439dfe1f31d703b832ae57b48ef2
2018-10-03trxcon/scheduler: add CCCH/SDCCH mframe layouts with CBCHHarald Welte3-0/+238
According to GSM TS 05.02, section 3.3.5, Cell Broadcast Channel (CBCH) is a downlink only channel, which is used to carry the short message service cell broadcast (SMSCB). CBCH is optional, and uses the same physical channel as SDCCH. More precisely, CBCH replaces sub-slot number 2 of SDCCH channels when enabled. This change introduces the CBCH enabled multi-frame layouts, and two separate logical channel types: - GSM_PCHAN_CCCH_SDCCH4_CBCH (lchan TRXC_SDCCH4_CBCH), - GSM_PCHAN_SDCCH8_SACCH8C_CBCH (lchan TRXC_SDCCH8_CBCH). Both logical channels are separately identified using the following Osmocom specific cbits: - TRXC_SDCCH4_CBCH - 0x18 (0b11000), - TRXC_SDCCH8_CBCH - 0x19 (0b11001). The reason of this separation is that we somehow need to distinguish between CBCH on C0/TS0, and CBCH on CX/TS0. Unlike TRXC_SDCCH8_CBCH, TRXC_SDCCH4_CBCH is enabled automatically (TRX_CH_FLAG_AUTO), so CBCH messages can be decoded on C0 while being in idle mode. Change-Id: Iad9905fc3a8a012ff1ada26ff95af384816f9873