Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Debug Bridge Toggle #34092

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class FileLock {

std::unordered_map<std::string, uint32_t> keys = {
{"AccessToken", CLEAR_ON_MANAGER_START | DONT_LOG},
{"Adb", PERSISTENT},
{"AlwaysOnDM", PERSISTENT},
{"ApiCache_Device", PERSISTENT},
{"AssistNowToken", PERSISTENT},
Expand Down
21 changes: 15 additions & 6 deletions selfdrive/ui/qt/offroad/developer_panel.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <QDebug>

#include <QProcess>
#include <cstdlib>
#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());

Expand All @@ -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);
}

Expand All @@ -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;
Expand All @@ -48,9 +55,11 @@ void DeveloperPanel::updateToggles(bool _offroad) {
longManeuverToggle->setEnabled(false);
}

adbToggle->setEnabled(_offroad);

offroad = _offroad;
}

void DeveloperPanel::showEvent(QShowEvent *event) {
updateToggles(offroad);
}
}
3 changes: 2 additions & 1 deletion selfdrive/ui/qt/offroad/developer_panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
};
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation>وضع المناورة الطولية</translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation>Modo de maniobra longitudinal</translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation>롱컨 기동 모드</translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation>Modo Longitudinal Maneuver</translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_th.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_zh-CHS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
8 changes: 8 additions & 0 deletions selfdrive/ui/translations/main_zh-CHT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@
<source>Longitudinal Maneuver Mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>ADB over TCP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable ADB over TCP on port 5555</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DevicePanel</name>
Expand Down
Loading