Skip to content

Commit f627a34

Browse files
authored
Retain hotspot/tethering state across reboots (commaai#89)
* Retain tethering state across reboots * store state * Update CHANGELOGS.md * Add toggle to "SP - General" * Network icon
1 parent c4fc609 commit f627a34

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

CHANGELOGS.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ sunnypilot - 0.9.2.x (2023-02-22)
22
========================
33
* Dashcam Viewer (native & screen recordings) via Browser support thanks to actuallylemoncurd, AlexandreSato, ntegan1, and royjr!
44
* Honda Clarity 2018-22 support thanks to mcallbosco, vanillagorillaa and wirelessnet2!
5+
* Retain hotspot/tethering state across reboots thanks to rogerioaguas!
56

67
sunnypilot - Version Latest (2023-02-22)
78
========================

selfdrive/manager/manager.py

+3
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ def manager_init() -> None:
167167
if os.path.isfile(f'{CRASHES_DIR}/error.txt'):
168168
os.remove(f'{CRASHES_DIR}/error.txt')
169169

170+
if params.get_bool("HotspotOnBoot"):
171+
os.system('nmcli con up Hotspot')
172+
170173

171174
def manager_prepare() -> None:
172175
for p in managed_processes.values():

selfdrive/ui/qt/offroad/networking.cc

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ void AdvancedNetworking::refresh() {
204204
}
205205

206206
void AdvancedNetworking::toggleTethering(bool enabled) {
207+
params.putBool("HotspotOnBoot", enabled);
207208
wifi->setTetheringEnabled(enabled);
208209
tetheringToggle->setEnabled(false);
209210
}

selfdrive/ui/qt/offroad/sunnypilot_settings.cc

+9
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ SPGeneralPanel::SPGeneralPanel(QWidget *parent) : QWidget(parent) {
5252
"../assets/offroad/icon_road.png"
5353
));
5454

55+
// General: Retain hotspot/tethering state
56+
main_layout->addWidget(horizontal_line());
57+
main_layout->addWidget(new ParamControl(
58+
"HotspotOnBoot",
59+
tr("Retain hotspot/tethering state"),
60+
tr("Enabling this toggle will retain the hotspot/tethering toggle state across reboots."),
61+
"../assets/offroad/icon_network.png"
62+
));
63+
5564
// General: Max Time Offroad (Shutdown timer)
5665
main_layout->addWidget(horizontal_line());
5766
main_layout->addWidget(new MaxTimeOffroad());

0 commit comments

Comments
 (0)