mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-17 21:22:10 +00:00
ci: all hw configuration in one place
This commit is contained in:
parent
4adbb4e8e1
commit
ceccf1951a
@ -1,4 +1,4 @@
|
||||
import configparser
|
||||
import os
|
||||
import sys
|
||||
|
||||
from device.t1 import TrezorOne
|
||||
@ -6,14 +6,12 @@ from device.tt import TrezorT
|
||||
|
||||
|
||||
def main(model: str, file: str = None):
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open("hardware.cfg"))
|
||||
t1 = TrezorOne(
|
||||
config["t1"]["uhub_location"],
|
||||
config["t1"]["arduino_serial"],
|
||||
config["t1"]["port"],
|
||||
os.environ["T1_UHUB_LOCATION"],
|
||||
os.environ["T1_ARDUINO_SERIAL"],
|
||||
os.environ["T1_UHUB_PORT"],
|
||||
)
|
||||
tt = TrezorT(config["tt"]["uhub_location"], config["tt"]["port"])
|
||||
tt = TrezorT(os.environ["TT_UHUB_LOCATION"], os.environ["TT_UHUB_PORT"])
|
||||
|
||||
if model == "t1":
|
||||
tt.power_off()
|
||||
|
@ -1,13 +1,16 @@
|
||||
[t1]
|
||||
# location of the uhub, can be found out by running `uhubctl`
|
||||
uhub_location = 3-1.4
|
||||
T1_UHUB_LOCATION="1-1.2"
|
||||
# to which port of the uhub the device is connected
|
||||
port = 3
|
||||
# arduino that pushes T1 buttons
|
||||
arduino_serial = /dev/ttyACM0
|
||||
T1_UHUB_PORT="2"
|
||||
|
||||
# camera device
|
||||
T1_CAMERA="/dev/video2"
|
||||
|
||||
# arduino that pushes T1 buttons
|
||||
T1_ARDUINO_SERIAL="/dev/serial/by-id/usb-Arduino__www.arduino.cc__0043_8573332373935181A0C0-if00"
|
||||
|
||||
[tt]
|
||||
# location of the uhub, can be found out by running `uhubctl`
|
||||
uhub_location = 3-3
|
||||
TT_UHUB_LOCATION="1-1.2"
|
||||
# to which port of the uhub the device is connected
|
||||
port = 1
|
||||
TT_UHUB_PORT="3"
|
||||
|
||||
|
@ -1,20 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
if [ $# -ne 2 ]
|
||||
if [ $# -ne 3 ]
|
||||
then
|
||||
echo "Usage: $0 commit_id [start|stop]"
|
||||
echo "Usage: $0 video_dev commit_id [start|stop]"
|
||||
fi
|
||||
|
||||
OUTPUTFILE=video_$1_$(date +%s).mp4
|
||||
INPUTDEVICE=/dev/video0
|
||||
INPUTDEVICE=$1
|
||||
COMMIT=$2
|
||||
ACTION=$3
|
||||
OUTPUTFILE=video_${COMMIT}_$(date +%s).mp4
|
||||
|
||||
if [ "$2" == "start" ]; then
|
||||
if [ "$ACTION" == "start" ]; then
|
||||
echo "[software/video] Starting record to $OUTPUTFILE"
|
||||
ffmpeg -loglevel warning -f oss -f video4linux2 -i $INPUTDEVICE \
|
||||
-flush_packets 1 \
|
||||
-vf "drawtext=font=Dejavu Sans: \
|
||||
text='$1 | %{localtime} | %{pts}': x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1: fontsize=15" $OUTPUTFILE &
|
||||
text='$COMMIT | %{localtime} | %{pts}': x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1: fontsize=15" $OUTPUTFILE &
|
||||
export VPID=$!
|
||||
elif [ "$2" == "stop" ]; then
|
||||
elif [ "$ACTION" == "stop" ]; then
|
||||
echo "[software/video] Stopping the recording of $OUTPUTFILE"
|
||||
pkill ffmpeg
|
||||
sync
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function finish {
|
||||
./record_video.sh ${CI_COMMIT_SHORT_SHA} stop
|
||||
./record_video.sh ${T1_CAMERA} ${CI_COMMIT_SHORT_SHA} stop
|
||||
ls -l *.mp4
|
||||
}
|
||||
trap finish EXIT
|
||||
@ -9,8 +9,12 @@ trap finish EXIT
|
||||
set -e # exit on nonzero exitcode
|
||||
set -x # trace commands
|
||||
|
||||
# export variables defined in the file
|
||||
set -a
|
||||
source hardware.cfg
|
||||
set +a
|
||||
|
||||
./record_video.sh ${CI_COMMIT_SHORT_SHA} start
|
||||
./record_video.sh ${T1_CAMERA} ${CI_COMMIT_SHORT_SHA} start
|
||||
(cd ../.. && poetry install)
|
||||
poetry run python bootstrap.py t1
|
||||
poetry run python bootstrap.py t1 ../../trezor-*.bin
|
||||
|
@ -324,6 +324,9 @@ hardware core btconly device test:
|
||||
PYTEST_TIMEOUT: "1200"
|
||||
script:
|
||||
- cd ci/hardware_tests
|
||||
- set -a
|
||||
- source hardware.cfg
|
||||
- set +a
|
||||
- nix-shell --run "cd ../.. && poetry install"
|
||||
- nix-shell --run "poetry run python bootstrap.py tt ../../trezor-*.bin"
|
||||
- nix-shell --run "poetry run pytest ../../tests/device_tests -m 'not sd_card' -k 'not 15_of_15 and not test_multisig_mismatch_inputs'"
|
||||
|
Loading…
Reference in New Issue
Block a user