Merge pull request #496 from dadav/fix/bt-tet-defaults
Fix bt-tether config
This commit is contained in:
commit
ace61836e5
@ -73,6 +73,7 @@ main:
|
|||||||
enabled: false # if you want to use this, set ui.display.video.address to 0.0.0.0
|
enabled: false # if you want to use this, set ui.display.video.address to 0.0.0.0
|
||||||
devices:
|
devices:
|
||||||
android-phone:
|
android-phone:
|
||||||
|
enabled: false
|
||||||
search_order: 1 # search for this first
|
search_order: 1 # search for this first
|
||||||
mac: ~ # mac of your bluetooth device
|
mac: ~ # mac of your bluetooth device
|
||||||
ip: '192.168.44.44' # ip from which your pwnagotchi should be reachable
|
ip: '192.168.44.44' # ip from which your pwnagotchi should be reachable
|
||||||
@ -83,9 +84,10 @@ main:
|
|||||||
share_internet: false
|
share_internet: false
|
||||||
priority: 1 # low routing priority; ios (prio: 999) would win here
|
priority: 1 # low routing priority; ios (prio: 999) would win here
|
||||||
ios-phone:
|
ios-phone:
|
||||||
|
enabled: false
|
||||||
search_order: 2 # search for this second
|
search_order: 2 # search for this second
|
||||||
mac: ~ # mac of your bluetooth device
|
mac: ~ # mac of your bluetooth device
|
||||||
ip: '172.20.10.2' # ip from which your pwnagotchi should be reachable
|
ip: '172.20.10.6' # ip from which your pwnagotchi should be reachable
|
||||||
netmask: 24
|
netmask: 24
|
||||||
interval: 5 # check every 5 minutes for device
|
interval: 5 # check every 5 minutes for device
|
||||||
scantime: 20
|
scantime: 20
|
||||||
|
@ -426,29 +426,30 @@ class BTTether(plugins.Plugin):
|
|||||||
self.devices = dict()
|
self.devices = dict()
|
||||||
|
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
|
# new config
|
||||||
if 'devices' in self.options:
|
if 'devices' in self.options:
|
||||||
for device, options in self.options['devices'].items():
|
for device, options in self.options['devices'].items():
|
||||||
for device_opt in ['priority', 'scantime', 'search_order', 'max_tries', 'share_internet', 'mac', 'ip', 'netmask', 'interval']:
|
for device_opt in ['enabled', 'priority', 'scantime', 'search_order', 'max_tries', 'share_internet', 'mac', 'ip', 'netmask', 'interval']:
|
||||||
if device_opt not in options or (device_opt in options and options[device_opt] is None):
|
if device_opt not in options or (device_opt in options and options[device_opt] is None):
|
||||||
logging.error("BT-TET: Pleace specify the %s for device %s.", device_opt, device)
|
logging.error("BT-TET: Pleace specify the %s for device %s.", device_opt, device)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.devices[device] = Device(name=device, **options)
|
if options['enabled']:
|
||||||
elif 'mac' in self.options:
|
self.devices[device] = Device(name=device, **options)
|
||||||
# legacy
|
|
||||||
|
# legacy
|
||||||
|
if 'mac' in self.options:
|
||||||
for opt in ['share_internet', 'mac', 'ip', 'netmask', 'interval']:
|
for opt in ['share_internet', 'mac', 'ip', 'netmask', 'interval']:
|
||||||
if opt not in self.options or (opt in self.options and self.options[opt] is None):
|
if opt not in self.options or (opt in self.options and self.options[opt] is None):
|
||||||
logging.error("BT-TET: Please specify the %s in your config.yml.", opt)
|
logging.error("BT-TET: Please specify the %s in your config.yml.", opt)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.devices['default'] = Device(name='default', **self.options)
|
self.devices['legacy'] = Device(name='legacy', **self.options)
|
||||||
else:
|
|
||||||
logging.error("BT-TET: No configuration found")
|
|
||||||
return
|
|
||||||
|
|
||||||
if not self.devices:
|
if not self.devices:
|
||||||
logging.error("BT-TET: No valid devices found")
|
logging.error("BT-TET: No valid devices found")
|
||||||
return
|
return
|
||||||
|
|
||||||
# ensure bluetooth is running
|
# ensure bluetooth is running
|
||||||
bt_unit = SystemdUnitWrapper('bluetooth.service')
|
bt_unit = SystemdUnitWrapper('bluetooth.service')
|
||||||
if not bt_unit.is_active():
|
if not bt_unit.is_active():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user