From cfca6cda51c72140a6bf72a57517969a8a8d85f4 Mon Sep 17 00:00:00 2001 From: Daniel Callander Date: Sat, 25 Mar 2023 17:38:02 +0000 Subject: [PATCH] fix boot on v1 --- ipk/control/control | 4 ++-- ipk/control/postinst | 7 ++++--- ipk/data/opt/bin/dji-moonlight-shim | 10 ++++------ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ipk/control/control b/ipk/control/control index 542d11a..ad4a413 100644 --- a/ipk/control/control +++ b/ipk/control/control @@ -1,7 +1,7 @@ Package: dji-moonlight-shim -Version: 1.0.1 +Version: 1.0.2 Maintainer: Knifa -Description: Accepts H.264 frames over network/USB from Moonlight. +Description: Stream games to your goggles via Moonlight! Architecture: pigeon-glasses Depends: fan-control wtfos-modloader Homepage: https://github.com/Knifa/dji-moonlight-shim diff --git a/ipk/control/postinst b/ipk/control/postinst index 35e45d3..e192fea 100755 --- a/ipk/control/postinst +++ b/ipk/control/postinst @@ -2,15 +2,16 @@ # Reboot glasses service to pick up menu entry. -IS_V2=$(getprop ro.product.device | grep -c "wm170_gls") -if [ $IS_V2 -eq 1 ]; then +DEVICE=$(getprop ro.product.device) + +if [[ $DEVICE == *"wm170_gls"* ]]; then GLASSES_SERIVCE="dji.glasses_wm150_service" else GLASSES_SERIVCE="dji.glasses_service" fi IS_GLASSES_RUNNING=$(getprop $GLASSES_SERIVCE) -if [ $IS_GLASSES_RUNNING -eq 1 ]; then +if [[ $IS_GLASSES_RUNNING -eq 1 ]]; then setprop $GLASSES_SERIVCE 0 sleep 3 setprop $GLASSES_SERIVCE 1 diff --git a/ipk/data/opt/bin/dji-moonlight-shim b/ipk/data/opt/bin/dji-moonlight-shim index ec2c892..f69b2be 100755 --- a/ipk/data/opt/bin/dji-moonlight-shim +++ b/ipk/data/opt/bin/dji-moonlight-shim @@ -5,9 +5,8 @@ set -euo pipefail # Figure out which glasses service we have to toggle. DEVICE=$(getprop ro.product.device) -IS_V2=$(echo $DEVICE | grep -c "wm170_gls") -if [ $IS_V2 -eq 1 ]; then +if [[ $DEVICE == *"wm170_gls"* ]]; then GLASSES_SERIVCE="dji.glasses_wm150_service" else GLASSES_SERIVCE="dji.glasses_service" @@ -18,7 +17,7 @@ fi set +e # don't choke if something goes wrong with package-config USE_USB_MODE=$(package-config getsaved dji-moonlight-shim use_usb_mode) -if [ $USE_USB_MODE = "true" ]; then +if [[ $USE_USB_MODE == "true" ]]; then echo "USB mode has been enabled via package-config." USE_USB_MODE=1 else @@ -30,8 +29,8 @@ set -e # Construct the shim arguments. If this script is called with arguments, pass # them, otherwise pass --net or --usb depending on the package config. -if [ $# -eq 0 ]; then - if [ $USE_USB_MODE -eq 1 ]; then +if [[ $# -eq 0 ]]; then + if [[ $USE_USB_MODE -eq 1 ]]; then SHIM_ARGS="--usb" else SHIM_ARGS="--net" @@ -42,7 +41,6 @@ fi # Start the shim. - function cleanup { sleep 3 setprop $GLASSES_SERIVCE 1