diff --git a/ipk/control/conffiles b/ipk/control/conffiles new file mode 100644 index 0000000..89b6b43 --- /dev/null +++ b/ipk/control/conffiles @@ -0,0 +1 @@ +/opt/etc/package-config/dji-moonlight-shim/config.json diff --git a/ipk/control/postinst b/ipk/control/postinst new file mode 100755 index 0000000..35e45d3 --- /dev/null +++ b/ipk/control/postinst @@ -0,0 +1,18 @@ +#!/system/bin/sh + +# Reboot glasses service to pick up menu entry. + +IS_V2=$(getprop ro.product.device | grep -c "wm170_gls") +if [ $IS_V2 -eq 1 ]; 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 + setprop $GLASSES_SERIVCE 0 + sleep 3 + setprop $GLASSES_SERIVCE 1 + sleep 3 +fi diff --git a/ipk/control/preinst b/ipk/control/preinst new file mode 100755 index 0000000..69ec686 --- /dev/null +++ b/ipk/control/preinst @@ -0,0 +1,2 @@ +#!/system/bin/sh +/opt/sbin/dinitctl -u stop dji-moonlight-shim || true diff --git a/ipk/control/prerm b/ipk/control/prerm new file mode 100755 index 0000000..69ec686 --- /dev/null +++ b/ipk/control/prerm @@ -0,0 +1,2 @@ +#!/system/bin/sh +/opt/sbin/dinitctl -u stop dji-moonlight-shim || true diff --git a/ipk/data/opt/bin/dji-moonlight-shim b/ipk/data/opt/bin/dji-moonlight-shim index 3543d5d..ec2c892 100755 --- a/ipk/data/opt/bin/dji-moonlight-shim +++ b/ipk/data/opt/bin/dji-moonlight-shim @@ -42,12 +42,17 @@ fi # Start the shim. -trap "setprop $GLASSES_SERIVCE 1" EXIT + +function cleanup { + sleep 3 + setprop $GLASSES_SERIVCE 1 + exit 0 +} + +trap cleanup EXIT INT TERM setprop $GLASSES_SERIVCE 0 sleep 3 cd /opt/moonlight ./dji-moonlight-shim $SHIM_ARGS - -setprop $GLASSES_SERIVCE 1 diff --git a/ipk/data/opt/etc/dinit.d/moonlight-shim b/ipk/data/opt/etc/dinit.d/dji-moonlight-shim similarity index 100% rename from ipk/data/opt/etc/dinit.d/moonlight-shim rename to ipk/data/opt/etc/dinit.d/dji-moonlight-shim diff --git a/ipk/data/opt/etc/package-config/dji-moonlight-shim/config.json b/ipk/data/opt/etc/package-config/dji-moonlight-shim/config.json index b95f185..7effa4d 100644 --- a/ipk/data/opt/etc/package-config/dji-moonlight-shim/config.json +++ b/ipk/data/opt/etc/package-config/dji-moonlight-shim/config.json @@ -1,3 +1,3 @@ { - "use_usb_mode": "false" + "use_usb_mode": false } diff --git a/ipk/data/opt/share/applications/moonlight-shim-active.png b/ipk/data/opt/share/applications/dji-moonlight-shim-active.png similarity index 100% rename from ipk/data/opt/share/applications/moonlight-shim-active.png rename to ipk/data/opt/share/applications/dji-moonlight-shim-active.png diff --git a/ipk/data/opt/share/applications/dji-moonlight-shim.desktop b/ipk/data/opt/share/applications/dji-moonlight-shim.desktop new file mode 100644 index 0000000..3e1a5ec --- /dev/null +++ b/ipk/data/opt/share/applications/dji-moonlight-shim.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Exec=/opt/sbin/dinitctl start dji-moonlight-shim +Name=Moonlight +Icon=/opt/share/applications/dji-moonlight-shim.png +Icon_Active=/opt/share/applications/dji-moonlight-shim-active.png diff --git a/ipk/data/opt/share/applications/moonlight-shim.png b/ipk/data/opt/share/applications/dji-moonlight-shim.png similarity index 100% rename from ipk/data/opt/share/applications/moonlight-shim.png rename to ipk/data/opt/share/applications/dji-moonlight-shim.png diff --git a/ipk/data/opt/share/applications/moonlight-shim.desktop b/ipk/data/opt/share/applications/moonlight-shim.desktop deleted file mode 100644 index 509dcda..0000000 --- a/ipk/data/opt/share/applications/moonlight-shim.desktop +++ /dev/null @@ -1,5 +0,0 @@ -[Desktop Entry] -Exec=/opt/sbin/dinitctl start moonlight-shim -Name=Moonlight -Icon=/opt/share/applications/moonlight-shim.png -Icon_Active=/opt/share/applications/moonlight-shim-active.png