mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
Fix EGSM900 downlink frequency: 935 MHz not 925 MHz
The EGSM900 band table had start=925e6 but ARFCNs 0-124 use downlink frequencies starting at 935 MHz (DL = 935 + 0.2*ARFCN). The 925 MHz value is the E-GSM extension band (ARFCNs 975-1023). This caused grgsm_livemon to tune 10 MHz too low — ARFCN 22 tuned to 929.4 MHz instead of 939.4 MHz, receiving no GSM frames and producing zero GSMTAP packets for tshark to capture. Also adds EGSM900_EXT band (ARFCNs 975-1023, DL 925.2-934.8 MHz) and diagnostic logging in the monitor thread to track raw tshark line counts vs parsed packets. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,11 +40,13 @@ REGIONAL_BANDS = {
|
||||
'Europe': {
|
||||
'GSM800': {'start': 832e6, 'end': 862e6, 'arfcn_start': 438, 'arfcn_end': 511}, # E-GSM800 downlink
|
||||
'GSM850': {'start': 869e6, 'end': 894e6, 'arfcn_start': 128, 'arfcn_end': 251}, # Also used in some EU countries
|
||||
'EGSM900': {'start': 925e6, 'end': 960e6, 'arfcn_start': 0, 'arfcn_end': 124},
|
||||
'EGSM900': {'start': 935e6, 'end': 960e6, 'arfcn_start': 0, 'arfcn_end': 124}, # DL = 935 + 0.2*ARFCN
|
||||
'EGSM900_EXT': {'start': 925.2e6, 'end': 935e6, 'arfcn_start': 975, 'arfcn_end': 1023}, # E-GSM extension
|
||||
'DCS1800': {'start': 1805e6, 'end': 1880e6, 'arfcn_start': 512, 'arfcn_end': 885}
|
||||
},
|
||||
'Asia': {
|
||||
'EGSM900': {'start': 925e6, 'end': 960e6, 'arfcn_start': 0, 'arfcn_end': 124},
|
||||
'EGSM900': {'start': 935e6, 'end': 960e6, 'arfcn_start': 0, 'arfcn_end': 124}, # DL = 935 + 0.2*ARFCN
|
||||
'EGSM900_EXT': {'start': 925.2e6, 'end': 935e6, 'arfcn_start': 975, 'arfcn_end': 1023}, # E-GSM extension
|
||||
'DCS1800': {'start': 1805e6, 'end': 1880e6, 'arfcn_start': 512, 'arfcn_end': 885}
|
||||
}
|
||||
}
|
||||
@@ -1795,6 +1797,7 @@ def monitor_thread(process, field_order=None):
|
||||
|
||||
monitor_start_time = time.time()
|
||||
packets_captured = 0
|
||||
lines_received = 0
|
||||
last_heartbeat = time.time()
|
||||
|
||||
try:
|
||||
@@ -1818,6 +1821,12 @@ def monitor_thread(process, field_order=None):
|
||||
})
|
||||
except queue.Full:
|
||||
pass
|
||||
# Periodic diagnostic: how many raw lines vs parsed
|
||||
if lines_received > 0 or elapsed % 30 == 0:
|
||||
logger.info(
|
||||
f"Monitor stats: {lines_received} tshark lines received, "
|
||||
f"{packets_captured} parsed, fields={field_order}"
|
||||
)
|
||||
|
||||
# Get output from queue with timeout
|
||||
try:
|
||||
@@ -1828,6 +1837,11 @@ def monitor_thread(process, field_order=None):
|
||||
if msg_type == 'eof':
|
||||
break # EOF
|
||||
|
||||
lines_received += 1
|
||||
# Log first 5 raw lines and then every 100th for diagnostics
|
||||
if lines_received <= 5 or lines_received % 100 == 0:
|
||||
logger.debug(f"tshark raw line #{lines_received}: {line.rstrip()!r}")
|
||||
|
||||
parsed = parse_tshark_output(line, field_order)
|
||||
if parsed:
|
||||
packets_captured += 1
|
||||
|
||||
@@ -187,14 +187,29 @@ class TestArfcnToFrequency:
|
||||
|
||||
def test_egsm900_arfcn(self):
|
||||
"""Test ARFCN in EGSM900 band."""
|
||||
# EGSM900: ARFCN 0-124, 925-960 MHz
|
||||
# EGSM900: ARFCN 0-124, DL = 935 + 0.2*ARFCN MHz
|
||||
arfcn = 0
|
||||
freq = arfcn_to_frequency(arfcn)
|
||||
assert freq == 925000000 # 925 MHz
|
||||
assert freq == 935000000 # 935.0 MHz
|
||||
|
||||
arfcn = 22
|
||||
freq = arfcn_to_frequency(arfcn)
|
||||
assert freq == 939400000 # 939.4 MHz
|
||||
|
||||
arfcn = 124
|
||||
freq = arfcn_to_frequency(arfcn)
|
||||
assert freq == 949800000 # 949.8 MHz
|
||||
assert freq == 959800000 # 959.8 MHz
|
||||
|
||||
def test_egsm900_ext_arfcn(self):
|
||||
"""Test ARFCN in EGSM900 extension band."""
|
||||
# EGSM900_EXT: ARFCN 975-1023, DL = 925.2 + 0.2*(ARFCN-975) MHz
|
||||
arfcn = 975
|
||||
freq = arfcn_to_frequency(arfcn)
|
||||
assert freq == 925200000 # 925.2 MHz
|
||||
|
||||
arfcn = 1023
|
||||
freq = arfcn_to_frequency(arfcn)
|
||||
assert freq == 934800000 # 934.8 MHz
|
||||
|
||||
def test_dcs1800_arfcn(self):
|
||||
"""Test ARFCN in DCS1800 band."""
|
||||
|
||||
Reference in New Issue
Block a user