diff --git a/common/params.cc b/common/params.cc index 9e62ed582caba7..98388362f8c23d 100644 --- a/common/params.cc +++ b/common/params.cc @@ -89,6 +89,7 @@ class FileLock { std::unordered_map keys = { {"AccessToken", CLEAR_ON_MANAGER_START | DONT_LOG}, + {"Adb", PERSISTENT}, {"AlwaysOnDM", PERSISTENT}, {"ApiCache_Device", PERSISTENT}, {"AssistNowToken", PERSISTENT}, diff --git a/selfdrive/ui/qt/offroad/developer_panel.cc b/selfdrive/ui/qt/offroad/developer_panel.cc index 5e127eb21f5b5b..ee17c8bd74c87e 100644 --- a/selfdrive/ui/qt/offroad/developer_panel.cc +++ b/selfdrive/ui/qt/offroad/developer_panel.cc @@ -1,12 +1,12 @@ #include - +#include +#include #include "selfdrive/ui/qt/offroad/developer_panel.h" #include "selfdrive/ui/qt/widgets/ssh_keys.h" #include "selfdrive/ui/qt/widgets/controls.h" #include "common/util.h" DeveloperPanel::DeveloperPanel(SettingsWindow *parent) : ListWidget(parent) { - // SSH keys addItem(new SshToggle()); addItem(new SshControl()); @@ -24,10 +24,18 @@ DeveloperPanel::DeveloperPanel(SettingsWindow *parent) : ListWidget(parent) { }); addItem(longManeuverToggle); - // Joystick and longitudinal maneuvers should be hidden on release branches + adbToggle = new ParamControl("Adb", tr("Android Debug Bridge"), tr("Enable ADB"), ""); + QObject::connect(adbToggle, &ParamControl::toggleFlipped, [=](bool state) { + if (state) { + QProcess::startDetached("sh", {"-c", "setprop service.adb.tcp.port 5555 && sudo systemctl start adbd"}); + } else { + QProcess::startDetached("sh", {"-c", "sudo systemctl stop adbd"}); + } + }); + addItem(adbToggle); + is_release = params.getBool("IsReleaseBranch"); - // Toggles should be not available to change in onroad state QObject::connect(uiState(), &UIState::offroadTransition, this, &DeveloperPanel::updateToggles); } @@ -37,7 +45,6 @@ void DeveloperPanel::updateToggles(bool _offroad) { btn->setEnabled(_offroad); } - // longManeuverToggle should not be toggleable if the car don't have longitudinal control auto cp_bytes = params.get("CarParamsPersistent"); if (!cp_bytes.empty()) { AlignedBuffer aligned_buf; @@ -48,9 +55,11 @@ void DeveloperPanel::updateToggles(bool _offroad) { longManeuverToggle->setEnabled(false); } + adbToggle->setEnabled(_offroad); + offroad = _offroad; } void DeveloperPanel::showEvent(QShowEvent *event) { updateToggles(offroad); -} +} \ No newline at end of file diff --git a/selfdrive/ui/qt/offroad/developer_panel.h b/selfdrive/ui/qt/offroad/developer_panel.h index fe38612e573bb8..9edec871a15634 100644 --- a/selfdrive/ui/qt/offroad/developer_panel.h +++ b/selfdrive/ui/qt/offroad/developer_panel.h @@ -12,9 +12,10 @@ class DeveloperPanel : public ListWidget { Params params; ParamControl* joystickToggle; ParamControl* longManeuverToggle; + ParamControl* adbToggle; bool is_release; bool offroad; private slots: void updateToggles(bool _offroad); -}; +}; \ No newline at end of file diff --git a/selfdrive/ui/translations/main_ar.ts b/selfdrive/ui/translations/main_ar.ts index 2315268a72c8c2..031d8667f8fffb 100644 --- a/selfdrive/ui/translations/main_ar.ts +++ b/selfdrive/ui/translations/main_ar.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode وضع المناورة الطولية + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel diff --git a/selfdrive/ui/translations/main_de.ts b/selfdrive/ui/translations/main_de.ts index 2abed6e3055deb..1e0f191d3f52a5 100644 --- a/selfdrive/ui/translations/main_de.ts +++ b/selfdrive/ui/translations/main_de.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel diff --git a/selfdrive/ui/translations/main_es.ts b/selfdrive/ui/translations/main_es.ts index 38ba964f111f4d..309fa847787da8 100644 --- a/selfdrive/ui/translations/main_es.ts +++ b/selfdrive/ui/translations/main_es.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode Modo de maniobra longitudinal + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel diff --git a/selfdrive/ui/translations/main_fr.ts b/selfdrive/ui/translations/main_fr.ts index f4251bc41d3e79..64e10b0a538791 100644 --- a/selfdrive/ui/translations/main_fr.ts +++ b/selfdrive/ui/translations/main_fr.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts index bc83d3f9ae5b72..d32dac4b615ab4 100644 --- a/selfdrive/ui/translations/main_ja.ts +++ b/selfdrive/ui/translations/main_ja.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 1d2a753e1f4b03..40e89e502840b7 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode 롱컨 기동 모드 + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts index a89c85510e7fe2..3e3ef0ee65b59b 100644 --- a/selfdrive/ui/translations/main_pt-BR.ts +++ b/selfdrive/ui/translations/main_pt-BR.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode Modo Longitudinal Maneuver + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel diff --git a/selfdrive/ui/translations/main_th.ts b/selfdrive/ui/translations/main_th.ts index c2b2771830eabf..713e6041f5faaf 100644 --- a/selfdrive/ui/translations/main_th.ts +++ b/selfdrive/ui/translations/main_th.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel diff --git a/selfdrive/ui/translations/main_tr.ts b/selfdrive/ui/translations/main_tr.ts index 9a53449276fcd8..561863b29eaaff 100644 --- a/selfdrive/ui/translations/main_tr.ts +++ b/selfdrive/ui/translations/main_tr.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index f061322c45f6fa..25fb3d8a425eaf 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index 04e76a8d957272..83e2734793bb22 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -123,6 +123,14 @@ Longitudinal Maneuver Mode + + ADB over TCP + + + + Enable ADB over TCP on port 5555 + + DevicePanel