Files
agnos-builder/tools/edl
T
2026-03-04 12:49:54 -08:00

57 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
ROOT=$DIR/../
# just a nice wrapper around the edl python tool
EDL_PATH=$DIR/edl_repo
VERSION="8573eba1b576305fec3a068393283143ffc34342"
if [ ! -d "$EDL_PATH" ]; then
rm -rf $EDL_PATH
git clone https://github.com/bkerler/edl $EDL_PATH
fi
pushd $EDL_PATH > /dev/null
NEED_INSTALL=0
if [ ! -d venv ]; then
python3 -m venv venv
NEED_INSTALL=1
fi
source venv/bin/activate
if [ "$(< .git/HEAD)" != "$VERSION" ]; then
echo "updating edl..."
git fetch origin $VERSION
git checkout $VERSION
git submodule update --depth=1 --init --recursive
NEED_INSTALL=1
fi
if [ "$NEED_INSTALL" -eq 1 ]; then
pip3 install -r requirements.txt
fi
# patch in comma four USB id (https://github.com/commaai/agnos-builder/issues/533)
if ! grep -q '0x3801' $EDL_PATH/edlclient/Config/usb_ids.py; then
sed -i '/\[0x05c6, 0x9008, -1\]/a\ [0x3801, 0x9008, -1], # comma four' $EDL_PATH/edlclient/Config/usb_ids.py
fi
popd > /dev/null
$EDL_PATH/edl "$@"
################################################################################
# On M-series macs, if you get "No backend available"
# where python is installed with pyenv and libusb with brew
# try this:
#
# brew install libusb
# sudo mkdir -p /usr/local/lib
# sudo ln -s /opt/homebrew/lib/libusb-1.0.0.dylib /usr/local/lib/libusb.dylib
#
################################################################################