[PATCH] osmocom-bb[master]: fake_trx: handle SETSLOT command from BB

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 15:32:59 UTC 2018


Review at  https://gerrit.osmocom.org/6725

fake_trx: handle SETSLOT command from BB

Change-Id: I152486377ecd6777dbae7024e5d12cfdbcb17628
---
M src/target/fake_trx/burst_fwd.py
M src/target/fake_trx/ctrl_if_bb.py
M src/target/fake_trx/fake_trx.py
3 files changed, 28 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/25/6725/1

diff --git a/src/target/fake_trx/burst_fwd.py b/src/target/fake_trx/burst_fwd.py
index 161710c..1ac74c0 100644
--- a/src/target/fake_trx/burst_fwd.py
+++ b/src/target/fake_trx/burst_fwd.py
@@ -23,8 +23,8 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 class BurstForwarder:
-	# Timeslot filter
-	ts_pass = 0
+	# Timeslot filter (drop everything by default)
+	ts_pass = None
 
 	def __init__(self, bts_link, bb_link):
 		self.bts_link = bts_link
diff --git a/src/target/fake_trx/ctrl_if_bb.py b/src/target/fake_trx/ctrl_if_bb.py
index f840c09..3882b6a 100644
--- a/src/target/fake_trx/ctrl_if_bb.py
+++ b/src/target/fake_trx/ctrl_if_bb.py
@@ -27,6 +27,7 @@
 class CTRLInterfaceBB(CTRLInterface):
 	# Internal state variables
 	trx_started = False
+	burst_fwd = None
 	rx_freq = None
 	tx_freq = None
 	pm = None
@@ -93,6 +94,30 @@
 
 			return (0, [meas_dbm])
 
+		elif self.verify_cmd(request, "SETSLOT", 2):
+			print("[i] Recv SETSLOT cmd")
+
+			if self.burst_fwd is None:
+				return -1
+
+			# Obtain TS index
+			ts = int(request[1])
+			if ts not in range(0, 8):
+				print("[!] TS index should be in range: 0..7")
+				return -1
+
+			# Parse TS type
+			ts_type = int(request[2])
+
+			# TS activation / deactivation
+			# We don't care about ts_type
+			if ts_type == 0:
+				self.burst_fwd.ts_pass = None
+			else:
+				self.burst_fwd.ts_pass = ts
+
+			return 0
+
 		# Wrong / unknown command
 		else:
 			# We don't care about other commands,
diff --git a/src/target/fake_trx/fake_trx.py b/src/target/fake_trx/fake_trx.py
index 724a520..533b264 100755
--- a/src/target/fake_trx/fake_trx.py
+++ b/src/target/fake_trx/fake_trx.py
@@ -80,6 +80,7 @@
 		self.bb_data = UDPLink(self.bb_addr,
 			self.bb_base_port + 102, self.bb_base_port + 2)
 		self.burst_fwd = BurstForwarder(self.bts_data, self.bb_data)
+		self.bb_ctrl.burst_fwd = self.burst_fwd
 
 		# Share clock between BTS and BB
 		self.bts_clck = UDPLink(self.bts_addr,

-- 
To view, visit https://gerrit.osmocom.org/6725
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I152486377ecd6777dbae7024e5d12cfdbcb17628
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list