Skip to content

Commit

Permalink
fix boot on v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Knifa committed Mar 25, 2023
1 parent 77a778b commit cfca6cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ipk/control/control
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions ipk/control/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions ipk/data/opt/bin/dji-moonlight-shim
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -42,7 +41,6 @@ fi

# Start the shim.


function cleanup {
sleep 3
setprop $GLASSES_SERIVCE 1
Expand Down

0 comments on commit cfca6cd

Please sign in to comment.