Release 260308

This commit is contained in:
Comma Device
2026-03-08 23:26:57 +08:00
commit 5c73e264e9
2665 changed files with 717560 additions and 0 deletions

0
scripts/__init__.py Normal file
View File

11
scripts/apply-pr.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "usage: $0 <pull-request-number>"
exit 1
fi
BASE="https://github.com/commaai/openpilot/pull/"
PR_NUM="$(echo $1 | grep -o -E '[0-9]+')"
curl -L $BASE/$PR_NUM.patch | git apply

3
scripts/cell.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/bash
nmcli connection modify --temporary lte ipv4.route-metric 1 ipv6.route-metric 1
nmcli con up lte

54
scripts/code_stats.py Executable file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env python3
import os
import ast
import stat
import subprocess
fouts = {x.decode('utf-8') for x in subprocess.check_output(['git', 'ls-files']).strip().split()}
pyf = []
for d in ["cereal", "common", "scripts", "selfdrive", "tools"]:
for root, _, files in os.walk(d):
for f in files:
if f.endswith(".py"):
pyf.append(os.path.join(root, f))
imps = set()
class Analyzer(ast.NodeVisitor):
def visit_Import(self, node):
for alias in node.names:
imps.add(alias.name)
self.generic_visit(node)
def visit_ImportFrom(self, node):
imps.add(node.module)
self.generic_visit(node)
tlns = 0
carlns = 0
scriptlns = 0
testlns = 0
for f in sorted(pyf):
if f not in fouts:
continue
xbit = bool(os.stat(f)[stat.ST_MODE] & stat.S_IXUSR)
src = open(f).read()
lns = len(src.split("\n"))
tree = ast.parse(src)
Analyzer().visit(tree)
print("%5d %s %s" % (lns, f, xbit))
if 'test' in f:
testlns += lns
elif f.startswith(('tools/', 'scripts/', 'selfdrive/debug')):
scriptlns += lns
elif f.startswith('selfdrive/car'):
carlns += lns
else:
tlns += lns
print("%d lines of openpilot python" % tlns)
print("%d lines of car ports" % carlns)
print("%d lines of tools/scripts/debug" % scriptlns)
print("%d lines of tests" % testlns)
#print(sorted(list(imps)))

11
scripts/count_cars.py Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env python3
from collections import Counter
from pprint import pprint
from openpilot.selfdrive.car.docs import get_all_car_info
if __name__ == "__main__":
cars = get_all_car_info()
make_count = Counter(l.make for l in cars)
print("\n", "*" * 20, len(cars), "total", "*" * 20, "\n")
pprint(make_count)

5
scripts/disable-powersave.py Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env python3
from openpilot.system.hardware import HARDWARE
if __name__ == "__main__":
HARDWARE.set_power_save(False)

7
scripts/launch_corolla.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
export FINGERPRINT="TOYOTA COROLLA TSS2 2019"
export SKIP_FW_QUERY="1"
$DIR/../launch_openpilot.sh

12
scripts/oneplus_update_neos.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/bash
if [ -z "$BASEDIR" ]; then
BASEDIR="/data/openpilot"
fi
source "$BASEDIR/launch_env.sh"
echo "Installing NEOS update"
NEOS_PY="$BASEDIR/system/hardware/eon/neos.py"
MANIFEST="$BASEDIR/system/hardware/eon/oneplus.json"
$NEOS_PY --swap-if-ready $MANIFEST
$BASEDIR/system/hardware/eon/updater $NEOS_PY $MANIFEST

14
scripts/pyqt_demo.py Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env python3
from PyQt5.QtWidgets import QApplication, QLabel # pylint: disable=no-name-in-module, import-error
from openpilot.selfdrive.ui.qt.python_helpers import set_main_window
if __name__ == "__main__":
app = QApplication([])
label = QLabel('Hello World!')
# Set full screen and rotate
set_main_window(label)
app.exec_()

7
scripts/stop_updater.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env sh
# Stop updater
pkill -2 -f selfdrive.updated
# Remove pending update
rm -f /data/safe_staging/finalized/.overlay_consistent

4
scripts/update_now.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
# Send SIGHUP to updater
pkill -1 -f selfdrive.updated

33
scripts/waste.py Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python3
import os
import time
import numpy as np
from multiprocessing import Process
from setproctitle import setproctitle
def waste(core):
os.sched_setaffinity(0, [core,])
m1 = np.zeros((200, 200)) + 0.8
m2 = np.zeros((200, 200)) + 1.2
i = 1
st = time.monotonic()
j = 0
while 1:
if (i % 100) == 0:
setproctitle("%3d: %8d" % (core, i))
lt = time.monotonic()
print("%3d: %8d %f %.2f" % (core, i, lt-st, j))
st = lt
i += 1
j = np.sum(np.matmul(m1, m2))
def main(gctx=None):
print("1-2 seconds is baseline")
for i in range(os.cpu_count()):
p = Process(target=waste, args=(i,))
p.start()
if __name__ == "__main__":
main()