diff --git a/manifest.json b/manifest.json index 6a19566..37bee26 100644 --- a/manifest.json +++ b/manifest.json @@ -54,5 +54,5 @@ } }, "short_name": "Network pres", - "version": "1.3.9" + "version": "1.3.10" } \ No newline at end of file diff --git a/pkg/presence_adapter.py b/pkg/presence_adapter.py index 6412d7b..82a4ea2 100644 --- a/pkg/presence_adapter.py +++ b/pkg/presence_adapter.py @@ -117,6 +117,7 @@ def __init__(self, verbose=False): if not self.DEBUG: time.sleep(5) # give it a few more seconds to make sure the network is up + self.selected_interface = "wlan0" self.select_interface() # checks if the preference is possible. if self.DEBUG: @@ -1273,15 +1274,19 @@ def arpa(self): def select_interface(self): - eth0_output = subprocess.check_output(['ifconfig', 'eth0']).decode('utf-8') - #print("eth0_output = " + str(eth0_output)) - wlan0_output = subprocess.check_output(['ifconfig', 'wlan0']).decode('utf-8') - #print("wlan0_output = " + str(wlan0_output)) - if "inet " in eth0_output and self.prefered_interface == "eth0": - self.selected_interface = "eth0" - if not "inet " in eth0_output and self.prefered_interface == "eth0": - self.selected_interface = "wlan0" - if "inet " in wlan0_output and self.prefered_interface == "wlan0": + try: + eth0_output = subprocess.check_output(['ifconfig', 'eth0']).decode('utf-8') + #print("eth0_output = " + str(eth0_output)) + wlan0_output = subprocess.check_output(['ifconfig', 'wlan0']).decode('utf-8') + #print("wlan0_output = " + str(wlan0_output)) + if "inet " in eth0_output and self.prefered_interface == "eth0": + self.selected_interface = "eth0" + if not "inet " in eth0_output and self.prefered_interface == "eth0": + self.selected_interface = "wlan0" + if "inet " in wlan0_output and self.prefered_interface == "wlan0": + self.selected_interface = "wlan0" + except Exception as ex: + print("Error in select_interface: " + str(ex)) self.selected_interface = "wlan0"