From 89aed2b1df9cd13476d90bbb2dadcca765ff55f9 Mon Sep 17 00:00:00 2001 From: GeekyDeaks Date: Sat, 1 Jul 2023 10:22:56 +0100 Subject: [PATCH] use broadcast for gt7 default IP --- gt7.py | 2 +- stm/gt7/sampler.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gt7.py b/gt7.py index 77807f2..68e3ff0 100644 --- a/gt7.py +++ b/gt7.py @@ -11,7 +11,7 @@ STATE_FILE = "gt7.cfg" state = { - "IP": "192.168.1.100", + "IP": "255.255.255.255", "PORT": 33740, "REPLAY": False, "DRIVER": "", diff --git a/stm/gt7/sampler.py b/stm/gt7/sampler.py index 60b23c0..bda0de6 100644 --- a/stm/gt7/sampler.py +++ b/stm/gt7/sampler.py @@ -23,6 +23,9 @@ def __init__(self, addr=None, port=DEFAULT_PORT, hb_port=DEFAULT_HEARTBEAT_PORT, # Create a UDP socket for the inbound packets self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + if self.hb_addr and addr == "255.255.255.255": + self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) + # Bind to any address self.socket.bind( ('0.0.0.0', port) ) self.socket.settimeout(1)