Last active
November 16, 2023 04:58
-
-
Save YogSottot/4fd4a795e21d959dbfd20fc896be8aac to your computer and use it in GitHub Desktop.
Waydroid in x11 with weston + gamepad + mantis gamepad pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# QtScrcpy need usb-debug for work | |
sudo waydroid shell settings put global adb_enabled 1 & | |
cd ~/Games/android/QtScrcpy | |
./QtScrcpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo 0 > /sys/bus/usb/devices/3-2/authorized | |
sleep 3 | |
echo 1 > /sys/bus/usb/devices/3-2/authorized | |
# find device | |
#for X in /sys/bus/usb/devices/*; do | |
# echo "$X" | |
# cat "$X/idVendor" 2>/dev/null | |
# cat "$X/idProduct" 2>/dev/null | |
# echo | |
#done | |
# Or in case its not a wired USB device, you can recreate /dev/input/eventX by triggering the uevent | |
# Finding out the correct /dev/input/eventX by | |
# cat /proc/bus/input/devices | |
# Assuming we got event4, | |
# sudo sh -c 'echo add > /sys/class/input/event4/uevent' | |
# This also requires the prop set beforehand, of course. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
props=( | |
"ro.product.brand=google" | |
"ro.product.manufacturer=Google" | |
"ro.system.build.product=redfin" | |
"ro.product.name=redfin" | |
"ro.product.device=redfin" | |
"ro.product.model=Pixel 5" | |
"ro.system.build.flavor=redfin-user" | |
"ro.build.fingerprint=google/redfin/redfin:11/RQ3A.211001.001/eng.electr.20230318.111310:user/release-keys" | |
"ro.system.build.description=redfin-user 11 RQ3A.211001.001 eng.electr.20230318.111310 release-keys" | |
"ro.bootimage.build.fingerprint=google/redfin/redfin:11/RQ3A.211001.001/eng.electr.20230318.111310:user/release-keys" | |
"ro.build.display.id=google/redfin/redfin:11/RQ3A.211001.001/eng.electr.20230318.111310:user/release-keys" | |
"ro.build.tags=release-keys" | |
"ro.build.description=redfin-user 11 RQ3A.211001.001 eng.electr.20230318.111310 release-keys" | |
"ro.vendor.build.fingerprint=google/redfin/redfin:11/RQ3A.211001.001/eng.electr.20230318.111310:user/release-keys" | |
"ro.vendor.build.id=RQ3A.211001.001" | |
"ro.vendor.build.tags=release-keys" | |
"ro.vendor.build.type=user" | |
"ro.odm.build.tags=release-keys" | |
) | |
for i in "${props[@]}"; | |
do sudo echo $i >> /var/lib/waydroid/waydroid.cfg | |
done | |
sudo waydroid upgrade --offline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/sudoers.d/waydroid | |
neko ALL=NOPASSWD: /bin/systemctl restart waydroid-container.service | |
neko ALL=NOPASSWD: /bin/systemctl start waydroid-container.service | |
neko ALL=NOPASSWD: /bin/systemctl stop waydroid-container.service | |
neko ALL=NOPASSWD: /bin/systemctl status waydroid-container.service | |
neko ALL=NOPASSWD: /usr/bin/waydroid container unfreeze | |
neko ALL=NOPASSWD: /usr/bin/waydroid container freeze | |
neko ALL=NOPASSWD: /usr/bin/waydroid logcat | |
neko ALL=NOPASSWD: /usr/bin/waydroid shell | |
neko ALL=NOPASSWD: /usr/bin/waydroid shell logcat | |
neko ALL=NOPASSWD: /usr/bin/waydroid shell sh /sdcard/Android/data/app.mantispro.gamepad/files/buddyNew.sh | |
neko ALL=NOPASSWD: /opt/reset_pad.sh | |
# switch arm | |
neko ALL=NOPASSWD: /usr/bin/python3 main.py install libhoudini | |
neko ALL=NOPASSWD: /usr/bin/python3 main.py install libndk | |
neko ALL=NOPASSWD: /usr/bin/python3 main.py remove libndk | |
neko ALL=NOPASSWD: /usr/bin/python3 main.py remove libhoudini | |
# disable usb-debug for some games | |
neko ALL=NOPASSWD: /usr/bin/waydroid shell settings put global adb_enabled 0 | |
neko ALL=NOPASSWD: /usr/bin/waydroid shell settings put global adb_enabled 1 | |
# disable mantis keyboard by default | |
neko ALL=NOPASSWD: /usr/bin/waydroid shell ime disable app.mantispro.gamepad/.services.MainService | |
neko ALL=NOPASSWD: /usr/bin/waydroid shell am force-stop app.mantispro.gamepad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eo pipefail | |
# The script automatically detects which translator is currently installed and changes it to the second one | |
# put in /etc/sudoers.d/waydroid | |
# username ALL=NOPASSWD: /usr/bin/python3 main.py install libhoudini | |
# username ALL=NOPASSWD: /usr/bin/python3 main.py install libndk | |
# username ALL=NOPASSWD: /usr/bin/python3 main.py remove libndk | |
# username ALL=NOPASSWD: /usr/bin/python3 main.py remove libhoudini | |
if [ -f /var/lib/waydroid/overlay/system/lib64/libndk_translation.so ]; then | |
echo Currently installed: libndk | |
current_arm="libndk" | |
new_arm="libhoudini" | |
fi | |
if [ -f /var/lib/waydroid/overlay/system/lib64/libhoudini.so ]; then | |
echo Currently installed: libhoudini | |
current_arm="libhoudini" | |
new_arm="libndk" | |
fi | |
if [ -z ${current_arm} ]; then | |
echo Arm-translator not installed. Use https://github.com/casualsnek/waydroid_script#install-libndk-arm-translation | |
exit | |
fi | |
cd /path/to/casualsnek/waydroid_script | |
echo Removing: ${current_arm} | |
sudo /usr/bin/python3 main.py remove ${current_arm} | |
echo Installing: ${new_arm} | |
sudo /usr/bin/python3 main.py install ${new_arm} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -xeuo pipefail | |
killall -9 weston || true; | |
sudo systemctl restart waydroid-container.service; | |
if ! pgrep weston; then | |
# weston --socket=/run/user/1000/waydroid.socket &> /dev/null & | |
# to copy-paste work | |
weston &> /dev/null & | |
PID1=$! | |
fi | |
sleep 2; | |
#export WAYLAND_DISPLAY=waydroid.socket | |
waydroid show-full-ui & | |
sleep 20 | |
## if use gamepad, then uncomment | |
# sudo ~/.local/bin/reset_pad.sh & | |
# sleep 1 | |
## if use mantis gamepad pro, then uncomment | |
# sudo waydroid shell sh /sdcard/Android/data/app.mantispro.gamepad/files/buddyNew.sh & | |
# sudo waydroid shell ime disable app.mantispro.gamepad/.services.MainService & | |
# sudo waydroid shell am force-stop app.mantispro.gamepad & | |
# disable usb-debug for some games | |
sudo waydroid shell settings put global adb_enabled 0 & | |
## if use QtScrcpy, then uncomment | |
# CUR_DIR=$(pwd) | |
# cd ~/path/to/QtScrcpy | |
#./QtScrcpy; | |
# cd $CUR_DIR; | |
wait $PID1 | |
waydroid session stop ; | |
sudo systemctl stop waydroid-container.service ; | |
killall -9 weston || true; | |
# if you don't like waydroid in menu | |
rm -f ~/.local/share/applications/waydroid.* | |
rm -f ~/.local/share/applications/Waydroid.desktop | |
#rm -rf /run/user/1000/waydroid.socket | |
rm -rf /run/user/1000/wayland-0* | |
# fix konsole input | |
stty sane |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment