From 71b5ea79be131224cb180c7ff697c7d326b83997 Mon Sep 17 00:00:00 2001 From: klemek Date: Fri, 2 Oct 2026 21:40:40 +0200 Subject: [PATCH] wip --- Makefile | 39 +++++++++++++++----------- append_to_file.sh | 14 ++++++++++ delay.sh | 26 ------------------ project/forge_project.cfg | 56 ++++++++++++++++++++++---------------- project/inc_sentences.glsl | 30 ++++++++------------ system/config.ini | 2 ++ system/weston.ini | 2 ++ 7 files changed, 85 insertions(+), 84 deletions(-) create mode 100755 append_to_file.sh delete mode 100755 delay.sh diff --git a/Makefile b/Makefile index a8daba8..1342262 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,8 @@ remove-passwd: .PHONY: apt-install apt-install: - sudo apt install -y weston seatd kitty libglfw3-dev libgl-dev libasound2-dev libv4l-dev + sudo apt update + sudo apt install -y weston seatd kitty git libglfw3-dev libgl-dev libasound2-dev libv4l-dev .PHONY: setup-weston setup-weston: @@ -47,9 +48,15 @@ setup-weston: .PHONY: setup-rasp-config setup-rasp-config: - sudo $(PROJECT_DIR)/line_in_file.sh "include forge-invar.txt" "/boot/firmware/config.txt" - sudo $(PROJECT_DIR)/line_in_file.sh "vc4.tv_norm=PAL" "/boot/firmware/cmdline.txt" "vc4.tv_norm" - sudo cp -f $(PROJECT_DIR)/system/config.ini /boot/firmware/forge-invar.txt + sudo $(PROJECT_DIR)/line_in_file.sh "include custom.txt" "/boot/firmware/config.txt" + sudo $(PROJECT_DIR)/append_to_file.sh " vc4.tv_norm=PAL" "/boot/firmware/cmdline.txt" "vc4.tv_norm=" + sudo $(PROJECT_DIR)/append_to_file.sh " video=Composite-1:720x576ie,tv_mode=PAL" "/boot/firmware/cmdline.txt" "video=" + sudo $(PROJECT_DIR)/append_to_file.sh " quiet loglevel=0 consoleblank=1" "/boot/firmware/cmdline.txt" "quiet" + sudo cp -f $(PROJECT_DIR)/system/config.ini /boot/firmware/custom.txt + +.PHONY: remove-motd +remove-motd: + sudo rm -rf /etc/motd .PHONY: setup-services setup-services: @@ -57,19 +64,12 @@ setup-services: sudo systemctl daemon-reload sudo systemctl enable getty@tty1.service seatd.service -.PHONY: setup-user-services -setup-user-services: - sudo ln -fs $(PROJECT_DIR)/system/weston.service /etc/systemd/user/weston.service - sudo ln -fs $(PROJECT_DIR)/system/weston.socket /etc/systemd/user/weston.socket - systemctl --user daemon-reload - systemctl --user enable weston - .PHONY: setup-bashrc setup-bashrc: - $(PROJECT_DIR)/line_in_file.sh "make -C $(PROJECT_DIR) start-weston" "$(HOME)/.bashrc" + $(PROJECT_DIR)/line_in_file.sh "make -C $(PROJECT_DIR) --no-print-directory start-weston" "$(HOME)/.bashrc" .PHONY: install -install: remove-passwd apt-install setup-weston setup-rasp-config setup-services setup-bashrc +install: remove-passwd apt-install setup-weston setup-rasp-config setup-services setup-bashrc remove-motd .PHONY: clean clean: @@ -80,8 +80,7 @@ build: $(BUILD_DIR)/$(TARGET) .PHONY: run run: $(BUILD_DIR)/$(TARGET) - # $(BUILD_DIR)/$(TARGET) $(RUN_ARGS) - $(PROJECT_DIR)/delay.sh + $(BUILD_DIR)/$(TARGET) $(RUN_ARGS) .PHONY: submodule-init submodule-init: @@ -89,4 +88,12 @@ submodule-init: .PHONY: start-weston start-weston: - /usr/bin/weston --shell=kiosk-shell.so --xwayland -- kitty --hold make -C $(PROJECT_DIR) run + @echo "on" | sudo tee /sys/class/drm/card1-Composite-1/status || true + @/usr/bin/weston --shell=kiosk-shell.so --xwayland --log=$(PROJECT_DIR)/weston.log -- kitty --hold make --no-print-directory -C $(PROJECT_DIR) run + +.PHONY: host-install +host-install: + sudo chmod a+rwx /run/media/$(shell whoami)/rootfs/opt/ + cp -r . /run/media/$(shell whoami)/rootfs/opt/ + sudo umount -R /run/media/$(shell whoami)/rootfs + sudo umount -R /run/media/$(shell whoami)/bootfs diff --git a/append_to_file.sh b/append_to_file.sh new file mode 100755 index 0000000..cd48097 --- /dev/null +++ b/append_to_file.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +LINE=$1 +FILE=$2 +DETECT=${3:-$LINE} + +if [[ -z $(grep "$DETECT" "$FILE") ]]; then + echo "Line not found in $FILE" + echo -n "$LINE" >> "$FILE" +else + echo "Fragment already exists in $FILE" +fi diff --git a/delay.sh b/delay.sh deleted file mode 100755 index ecbaf0c..0000000 --- a/delay.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -set -e - -DELAY=30 - -rm -rf /tmp/delay_stream* - -ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 \ - -vf scale=720:576 \ - -vcodec libx264 -preset ultrafast -tune zerolatency \ - -f hls -hls_time 1 -hls_list_size $((DELAY + 5)) -hls_flags delete_segments \ - /tmp/delay_stream.m3u8 & -FFMPEG_PID=$! - -start=`date +%s` - -until [ -f /tmp/delay_stream.m3u8 ]; do sleep 0.1; done - -end=`date +%s` - -sleep $((DELAY - end + start)) - -ffplay /tmp/delay_stream.m3u8 - -kill $FFMPEG_PID $HTTP_PID diff --git a/project/forge_project.cfg b/project/forge_project.cfg index a1d4922..5f9052f 100644 --- a/project/forge_project.cfg +++ b/project/forge_project.cfg @@ -258,7 +258,7 @@ SAVE_FILE_PREFIX=forge_default_save # R on (qwerty) -KEY_RANDOMIZE=1082 +KEY_RANDOMIZE=1335 # SHIFT+R (qwerty) KEY_RESET=11082 # D (qwerty) @@ -275,31 +275,41 @@ KEY_TEMPO_DOWN=1264 KEY_TEMPO_UP=1265 # Number of load states keys -KEY_LOAD_COUNT=10 +KEY_LOAD_COUNT=15 # 1 to 9 then 0 keys -KEY_LOAD_1=1049 -KEY_LOAD_2=1050 -KEY_LOAD_3=1051 -KEY_LOAD_4=1052 -KEY_LOAD_5=1053 -KEY_LOAD_6=1054 -KEY_LOAD_7=1055 -KEY_LOAD_8=1056 -KEY_LOAD_9=1057 -KEY_LOAD_10=1048 +KEY_LOAD_1=1320 +KEY_LOAD_2=1321 +KEY_LOAD_3=1322 +KEY_LOAD_4=1323 +KEY_LOAD_5=1324 +KEY_LOAD_6=1325 +KEY_LOAD_7=1326 +KEY_LOAD_8=1327 +KEY_LOAD_9=1328 +KEY_LOAD_10=1329 +KEY_LOAD_11=1331 +KEY_LOAD_12=1332 +KEY_LOAD_13=1333 +KEY_LOAD_14=1334 +KEY_LOAD_15=1259 # Number of save states keys -KEY_SAVE_COUNT=10 +KEY_SAVE_COUNT=15 # 1 to 9 then 0 keys with shift -KEY_SAVE_1=11049 -KEY_SAVE_2=11050 -KEY_SAVE_3=11051 -KEY_SAVE_4=11052 -KEY_SAVE_5=11053 -KEY_SAVE_6=11054 -KEY_SAVE_7=11055 -KEY_SAVE_8=11056 -KEY_SAVE_9=11057 -KEY_SAVE_10=11048 +KEY_SAVE_1=11320 +KEY_SAVE_2=11321 +KEY_SAVE_3=11322 +KEY_SAVE_4=11323 +KEY_SAVE_5=11324 +KEY_SAVE_6=11325 +KEY_SAVE_7=11326 +KEY_SAVE_8=11327 +KEY_SAVE_9=11328 +KEY_SAVE_10=11329 +KEY_SAVE_11=11331 +KEY_SAVE_12=11332 +KEY_SAVE_13=11333 +KEY_SAVE_14=11334 +KEY_SAVE_15=11259 diff --git a/project/inc_sentences.glsl b/project/inc_sentences.glsl index 5a04bc1..ddd0a19 100644 --- a/project/inc_sentences.glsl +++ b/project/inc_sentences.glsl @@ -1,30 +1,22 @@ #ifndef INC_SENTENCES #define INC_SENTENCES -#define SENTENCE_COUNT 17 +#define SENTENCE_COUNT 9 #define SENTENCE_MAX_LENGTH 20 const int sentences[] = int[SENTENCE_COUNT * SENTENCE_MAX_LENGTH]( - 0x66, 0x6F, 0x72, 0x67, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x46, 0x4F, 0x52, 0x47, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x46, 0x2E, 0x4F, 0x2E, 0x52, 0x2E, 0x47, 0x2E, 0x45, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x46, 0x75, 0x73, 0x69, 0x6F, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x4F, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x52, 0x65, 0x61, 0x6C, 0x2D, 0x74, 0x69, 0x6D, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x45, 0x76, 0x65, 0x72, 0x79, 0x74, 0x68, 0x69, 0x6E, 0x67, 0x20, 0x79, 0x6F, 0x75, 0x20, 0x73, 0x65, 0x65, 0x00, 0x00, - 0x50, 0x69, 0x78, 0x65, 0x6C, 0x20, 0x62, 0x79, 0x20, 0x70, 0x69, 0x78, 0x65, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x4C, 0x69, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x47, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x43, 0x6F, 0x6E, 0x74, 0x72, 0x6F, 0x6C, 0x6C, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xE3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x4B, 0x6C, 0x65, 0xE3, 0x65, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x43, 0x6F, 0x64, 0x65, 0x20, 0x61, 0x73, 0x20, 0x61, 0x72, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x41, 0x72, 0x74, 0x20, 0x61, 0x73, 0x20, 0x63, 0x6F, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + 0x4C, 0x45, 0x20, 0x46, 0x4F, 0x4C, 0x4C, 0x45, 0x20, 0x4E, 0x55, 0x49, 0x54, 0x20, 0x44, 0x55, 0x20, 0x34, 0x30, 0x00, + 0x46, 0x4F, 0x4C, 0x4C, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x4E, 0x55, 0x49, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x44, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x34, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x35, 0x33, 0xB0, 0x20, 0x4D, 0x49, 0x45, 0x54, 0x54, 0x45, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x6C, 0x61, 0x20, 0x66, 0x6F, 0x6C, 0x6C, 0x65, 0x20, 0x6E, 0x75, 0x69, 0x74, 0x20, 0x64, 0x75, 0x20, 0x34, 0x30, 0x00, + 0x46, 0x4F, 0x4C, 0x4C, 0x45, 0x20, 0x4E, 0x55, 0x49, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x44, 0x55, 0x20, 0x34, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ); const int lengths[] = int[SENTENCE_COUNT]( - 5, 5, 10, 6, 2, 9, 10, 7, 18, 14, 4, 9, 10, 1, 6, 11, 11 + 19, 5, 4, 2, 2, 11, 19, 10, 5 ); #endif diff --git a/system/config.ini b/system/config.ini index ed907e4..6e29671 100644 --- a/system/config.ini +++ b/system/config.ini @@ -17,3 +17,5 @@ gpu_mem=64 # --- composite --- enable_tvout=1 +sdtv_mode=2 +sdtv_aspect=1 diff --git a/system/weston.ini b/system/weston.ini index 35a425b..0eb9306 100644 --- a/system/weston.ini +++ b/system/weston.ini @@ -1,6 +1,8 @@ [core] idle-time=0 +require-input=false [output] name=Composite-1 mode=720x576i +force-on=true