From 2d41f1fc6f308e6783bdd970db87745511c5862d Mon Sep 17 00:00:00 2001 From: Rolando Islas Date: Thu, 18 May 2017 10:55:26 -0700 Subject: [PATCH] Fix auth details not being saved Add a video stream option to server.conf #28 --- src/server/data/config_server.py | 2 ++ src/server/net/wii/audio.py | 2 ++ src/server/net/wii/video.py | 2 ++ src/server/util/wpa_supplicant.py | 3 +++ 4 files changed, 9 insertions(+) diff --git a/src/server/data/config_server.py b/src/server/data/config_server.py index 83d7da2..208eeb7 100644 --- a/src/server/data/config_server.py +++ b/src/server/data/config_server.py @@ -8,6 +8,7 @@ class ConfigServer: input_delay = None quality = None fps = None + stream_video = None def __init__(self): pass @@ -25,6 +26,7 @@ def load(cls): "5/10/15 low - 75 lan - 100 loopback") cls.fps = cls.config.get_int("VIDEO", "fps", 1, 60, 30, "FPS of video stream. No limit if set to 60\n" "10 low - 30 lan - 60 loopback") + cls.stream_video = cls.config.get_boolean("VIDEO", "stream", True, "Stream video to clients") # General cls.scan_timeout = cls.config.get_int("GENERAL", "scan_timeout", 0, 60 * 5, 60 * 2, "Sets the time they server " "is allowed to scan for the" diff --git a/src/server/net/wii/audio.py b/src/server/net/wii/audio.py index eab1e69..044dc74 100644 --- a/src/server/net/wii/audio.py +++ b/src/server/net/wii/audio.py @@ -28,6 +28,8 @@ def close(self): pass def update(self, packet): + if not ConfigServer.stream_audio: + return LoggerBackend.verbose("Received audio packet") h = audio.header.parse(packet) diff --git a/src/server/net/wii/video.py b/src/server/net/wii/video.py index 5316d2a..bd4b02d 100644 --- a/src/server/net/wii/video.py +++ b/src/server/net/wii/video.py @@ -81,6 +81,8 @@ def h264_nal_encapsulate(self, is_idr, vstrm): return nals def update(self, packet, test=False): + if not ConfigServer.stream_video: + return LoggerBackend.verbose("Received video packet") h = video.header.parse(packet) is_idr = self.packet_is_idr(packet) diff --git a/src/server/util/wpa_supplicant.py b/src/server/util/wpa_supplicant.py index 902b256..372d8c1 100644 --- a/src/server/util/wpa_supplicant.py +++ b/src/server/util/wpa_supplicant.py @@ -256,6 +256,9 @@ def get_psk_thread(self, code): self.psk_thread_cli.expect("<3>WPS-CRED-RECEIVED", timeout=60) # save conf LoggerWpa.debug("PSK obtained") + # Save to temp config before reading from it + self.psk_thread_cli.sendline("save_config") + self.psk_thread_cli.expect("OK", timeout=5) self.save_connect_conf(bssid) self.set_status(self.DISCONNECTED) return