summaryrefslogtreecommitdiffstats
path: root/src/target/trx_toolkit/clck_gen.py
AgeCommit message (Collapse)AuthorFilesLines
2020-07-16trx_toolkit/clck_gen.py: remove unused import of 'time' moduleVadim Yanitskiy1-1/+0
Change-Id: I40628d32409543c9f4b40b7268a4538b4671102d
2020-07-16trx_toolkit: use python3 in shebang of executable scriptsVadim Yanitskiy1-1/+1
TRX Toolkit is still backwards compatible with Python2, but Python3 does much better in terms of performance. Also, on Debian Stretch that is used as a base for our Docker images, Python 2.7 is still the default. Let's require Python3 in shebang. Change-Id: I8a1d7c59d3b5d49ec2ed94a7c77905e02134f216
2020-07-14trx_toolkit/clck_gen.py: support optional clock handlerVadim Yanitskiy1-0/+6
Change-Id: I85b2182d9835ed035cf370e45ea039ac6a7e8405
2020-07-14trx_toolkit/clck_gen.py: fix TDMA clock counter wrappingVadim Yanitskiy1-6/+2
Change-Id: I157447c7610402f6d62d2b74c9f04fcaa0bc1724
2020-07-14trx_toolkit/clck_gen.py: call send_clck_ind() on every TDMA frameVadim Yanitskiy1-2/+1
Change-Id: I6d53e5266fa3b1f2eb55822d1c14975789b202ed
2019-11-24trx_toolkit/clck_gen.py: drop unneeded debug print()Vadim Yanitskiy1-1/+0
Change-Id: I372af77d5b0b24fa38e304b782ca5b3d0888211b
2019-11-24trx_toolkit/clck_gen.py: turn CLCKGen's thread into a daemonVadim Yanitskiy1-0/+4
If the main thread crashes, the CLCKGen's thread would never stop. It would also happen if the main thread terminates without calling CLCKGen.stop(). Let's prevent this by creating a daemon thread. Change-Id: I9d41c5baa25fa0a263758414a164c1bded25e04e
2019-11-24trx_toolkit/clck_gen.py: refactor CLCKGen to use a single threadVadim Yanitskiy1-20/+39
The previous approach was based on threading.Timer, so on each clock iteration one thread spawned another new thread. So far it worked well, but such frequent spawning involves an additional overhead. After this change, CLCKGen.start() allocates and starts a new thread, that periodically sends clock indications and sleep()s during the indication intervals. The CLCKGen.stop() in its turn terminates that thread and frees the memory. Change-Id: Ibe477eb0a1ee2193c1ff16452a407be7e858b2ef
2019-07-24trx_toolkit: fix compatibility with Python 3: 'is' vs '=='Vadim Yanitskiy1-1/+2
Change-Id: I8ba05c04f206578cf61df58573c24cba1d6fba52
2019-07-16target/*.py: shebang: use /usr/bin/env pythonAlexander Couzens1-1/+1
Use the system default python instead of a hardcoded python2 Allow to use python2 and python3. Change-Id: Iab185759b574eff1ca1b189dcbb4e1a3eec52132
2019-05-17trx_toolkit/clck_gen.py: avoid logging \0-terminatorVadim Yanitskiy1-1/+1
Change-Id: I93da2e8ba9d3fda944b8171bc42e49063c925f9c
2018-12-16trx_toolkit: fix missing / useless importsVadim Yanitskiy1-2/+0
Found using Flake8: - data_if.py:57:4: F405 'log' may be undefined, or defined from star imports: data_msg - clck_gen.py:29:1: F401 'time' imported but unused - clck_gen.py:30:1: F401 'sys' imported but unused - trx_sniff.py:28:1: F401 'signal' imported but unused Change-Id: Id0c42319b445db218b77fd5e99a9a0a89724281d
2018-12-08trx_toolkit: merge copyright.py into app_common.pyVadim Yanitskiy1-4/+4
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-07trx_toolkit: use generic logging module instead of print()Vadim Yanitskiy1-2/+7
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-04-04trx_toolkit: Add cmdline arg to set bind addrPau Espin Pedrol1-1/+1
Previous hardcoded default of 0.0.0.0 was inappropiate in some scenarios, as it sets the SRC addr of the packets sent through the socket based on the routing. For instance, if iface IF1 has assigned two IP addresses A and B, A being the first addr of the interface, and osmo-bts-trx is configured with "osmotrx ip local A" and "osmotrx ip remote B", the following happens: CMD POWER OFF src=A:5801 dst=B:5701 RSP POWER OFF src=A:5701 dst=A:5701 <-- A is assigned as src addr. But osmo-bts-trx is waiting for packets from B:5701, and the packet is dropped with ICMP Unreachable. If addr binding is forced in fake_trx to B, then everthing's fine. Let's extend the UDPLink in order to allow manual, but optional setting of bind address, and add a corresponding cmdline argument to all executables. Change-Id: I7be18fef40967fb7551f4115f22cbbd9cdb0840d
2018-03-13Rename 'fake_trx' to 'trx_toolkit'Vadim Yanitskiy1-0/+116
This toolkit has branched out into several different tools for TRX interface hacking, and creating a virtual Um-interface (FakeTRX) is only one of its potential applications. Change-Id: I56bcbc76b9c273d6b469a2bb68ddc46f3980e835