mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-09-28 20:29:12 +00:00
Merge 107cca3344
into 5a9536e7a0
This commit is contained in:
commit
c376ed90f7
1 changed files with 21 additions and 23 deletions
|
@ -1,41 +1,39 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
SNDCPY_PORT="28200"
|
||||||
echo Begin Runing...
|
SNDCPY_APK="sndcpy.apk"
|
||||||
SNDCPY_PORT=28200
|
ADB="./adb"
|
||||||
SNDCPY_APK=sndcpy.apk
|
|
||||||
ADB=./adb
|
|
||||||
|
|
||||||
serial=
|
serial=
|
||||||
if [[ $# -ge 2 ]]
|
if [[ $# -ge 2 ]]
|
||||||
then
|
then
|
||||||
serial="-s $1"
|
serial="-s $1"
|
||||||
SNDCPY_PORT=$2
|
SNDCPY_PORT="$2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Waiting for device $1..."
|
echo "Waiting for device '$1'..."
|
||||||
$ADB $serial wait-for-device
|
"$ADB" "$serial" wait-for-device
|
||||||
echo "Find device $1"
|
echo "Found device '$1'"
|
||||||
|
|
||||||
sndcpy_installed=$($ADB $serial shell pm path com.rom1v.sndcpy)
|
sndcpy_installed=$($ADB "$serial" shell pm path com.rom1v.sndcpy)
|
||||||
if [[ $sndcpy_installed == "" ]]; then
|
if [[ $sndcpy_installed == "" ]]; then
|
||||||
echo Install $SNDCPY_APK...
|
echo "Installing '$SNDCPY_APK'..."
|
||||||
$ADB $serial uninstall com.rom1v.sndcpy || echo uninstall failed
|
"$ADB" "$serial" uninstall com.rom1v.sndcpy || echo "Uninstall failed!"
|
||||||
$ADB $serial install -t -r -g $SNDCPY_APK
|
"$ADB" "$serial" install -t -r -g "$SNDCPY_APK"
|
||||||
echo Install $SNDCPY_APK success
|
echo "Successfully installed '$SNDCPY_APK'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo Request PROJECT_MEDIA permission...
|
echo "Requesting PROJECT_MEDIA permission..."
|
||||||
$ADB $serial shell appops set com.rom1v.sndcpy PROJECT_MEDIA allow
|
"$ADB" "$serial" shell appops set com.rom1v.sndcpy PROJECT_MEDIA allow
|
||||||
|
|
||||||
echo Forward port $SNDCPY_PORT...
|
echo "Forwarding port $SNDCPY_PORT..."
|
||||||
$ADB $serial forward tcp:$SNDCPY_PORT localabstract:sndcpy
|
"$ADB" "$serial" forward "tcp:$SNDCPY_PORT" localabstract:sndcpy
|
||||||
|
|
||||||
echo Start $SNDCPY_APK...
|
echo "Starting '$SNDCPY_APK'..."
|
||||||
$ADB $serial shell am start com.rom1v.sndcpy/.MainActivity
|
"$ADB" "$serial" shell am start com.rom1v.sndcpy/.MainActivity
|
||||||
|
|
||||||
while ((1))
|
while ((1))
|
||||||
do
|
do
|
||||||
echo Waiting $SNDCPY_APK start...
|
echo "Waiting for '$SNDCPY_APK' to start..."
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
sndcpy_started=$($ADB shell 'ps | grep com.rom1v.sndcpy')
|
sndcpy_started=$($ADB shell 'ps | grep com.rom1v.sndcpy')
|
||||||
if [[ $sndcpy_started != "" ]]; then
|
if [[ $sndcpy_started != "" ]]; then
|
||||||
|
@ -43,4 +41,4 @@ do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo Ready playing...
|
echo "Ready playing..."
|
Loading…
Add table
Add a link
Reference in a new issue