feat(dbus): Add support for configuring the external antenna
Introduce the `configure_external_antenna` function to manage external antenna settings, including enable, disable, and status checks. Update the feature configuration in `interface_config` to include this functionality. This enhances WiFi-related configuration options.
This commit is contained in:
@@ -9,6 +9,7 @@ from .revpi_config import (
|
|||||||
ConfigActions,
|
ConfigActions,
|
||||||
configure_avahi_daemon,
|
configure_avahi_daemon,
|
||||||
configure_dphys_swapfile,
|
configure_dphys_swapfile,
|
||||||
|
configure_external_antenna,
|
||||||
configure_gui,
|
configure_gui,
|
||||||
simple_systemd,
|
simple_systemd,
|
||||||
)
|
)
|
||||||
@@ -92,5 +93,5 @@ AVAILABLE_FEATURES = {
|
|||||||
"bluetooth": False,
|
"bluetooth": False,
|
||||||
"ieee80211": False,
|
"ieee80211": False,
|
||||||
"avahi": FeatureFunction(configure_avahi_daemon, []),
|
"avahi": FeatureFunction(configure_avahi_daemon, []),
|
||||||
"external-antenna": False,
|
"external-antenna": FeatureFunction(configure_external_antenna, []),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,6 +213,31 @@ def configure_dphys_swapfile(action: ConfigActions):
|
|||||||
return return_value
|
return return_value
|
||||||
|
|
||||||
|
|
||||||
|
def configure_external_antenna(action: ConfigActions):
|
||||||
|
revpi = RevPiConfig()
|
||||||
|
if action is ConfigActions.AVAILABLE:
|
||||||
|
return revpi.with_wifi
|
||||||
|
|
||||||
|
config_txt = ConfigTxt()
|
||||||
|
|
||||||
|
if action is ConfigActions.ENABLE and revpi.with_wifi:
|
||||||
|
config_txt.clear_dtparams(["ant1", "ant2"])
|
||||||
|
config_txt.add_name_value("dtparam", "ant2")
|
||||||
|
config_txt.save_config()
|
||||||
|
|
||||||
|
elif action is ConfigActions.DISABLE and revpi.with_wifi:
|
||||||
|
config_txt.clear_dtparams(["ant1", "ant2"])
|
||||||
|
config_txt.save_config()
|
||||||
|
|
||||||
|
elif action is ConfigActions.STATUS:
|
||||||
|
return revpi.with_wifi and "ant2" in config_txt.get_values("dtparam")
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise ValueError(f"action {action} not supported")
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def configure_gui(action: ConfigActions):
|
def configure_gui(action: ConfigActions):
|
||||||
gui_available = access("/usr/bin/startx", X_OK)
|
gui_available = access("/usr/bin/startx", X_OK)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user