diff --git a/docs/Android.md b/docs/Android.md new file mode 100644 index 00000000..7ee961c1 --- /dev/null +++ b/docs/Android.md @@ -0,0 +1,122 @@ +# Android + +This article describes how to use KlipperScreen from an android device + +!!! important + The experience may not be equal to run KlipperScreen natively, + depending on the device there maybe performance degradation or other issues + +1. [First installl KlipperScreen on the Pi](Installation.md) +2. Install [XServer-XSDL](https://play.google.com/store/apps/details?id=x.org.server) on the android device +3. Choose [USB(ADB)](#adb) or [WIFI](#wifi) + +### ADB + +!!! warning + Leaving the phone always connected it's not recommended, remove the battery to avoid issues. + +* Install ADB on the Pi +```bash +sudo apt-get install android-tools-adb +``` +* Put your Android phone/tablet in Debug mode. + +Usually it involves enabling developer mode and "USB debugging" but this varies on different vendors and versions of the device +search "how to enable android debugging on device-model-and-brand" + +* Create a launcher script + +```bash +cd ~/KlipperScreen +touch launch_klipperscreen.sh +chmod +x launch_klipperscreen.sh +nano launch_klipperscreen.sh +``` + +* Paste this into the script +```bash +#!/bin/bash +# forward local display :100 to remote display :0 +adb forward tcp:6100 tcp:6000 + +adb shell dumpsys nfc | grep 'mScreenState=' | grep OFF_LOCKED > /dev/null 2>&1 +if [ $? -lt 1 ] +then + echo "Screen is OFF and Locked. Turning screen on..." + adb shell input keyevent 26 +fi + +adb shell dumpsys nfc | grep 'mScreenState=' | grep ON_LOCKED> /dev/null 2>&1 +if [ $? -lt 1 ] +then + echo "Screen is Locked. Unlocking..." + adb shell input keyevent 82 +fi + +# start xsdl +adb shell am start-activity x.org.server/.MainActivity + +ret=1 +timeout=0 +echo -n "Waiting for x-server to be ready " +while [ $ret -gt 0 ] && [ $timeout -lt 60 ] +do + xset -display :100 -q > /dev/null 2>&1 + ret=$? + timeout=$( expr $timeout + 1 ) + echo -n "." + sleep 1 +done +echo "" +if [ $timeout -lt 60 ] +then + DISPLAY=:100 /home/pi/.KlipperScreen-env/bin/python3 /home/pi/KlipperScreen/screen.py + exit 0 +else + exit 1 +fi +``` +* Go to [Startup](#startup) + +### WIFI + +* Create a launcher script + +```bash +cd ~/KlipperScreen +touch launch_klipperscreen.sh +chmod +x launch_klipperscreen.sh +nano launch_klipperscreen.sh +``` + +* Paste this into the script (edit the IP for example: 192.168.1.2:0) +```bash +DISPLAY=(ip address from blue screen):0 /home/pi/.KlipperScreen-env/bin/python3 /home/pi/KlipperScreen/screen.py +``` + +!!! important + It's recommended to use a static address, because if the address changes your connection will stop working. + +* Go to [Startup](#startup) + +## Startup + +Start Xserver-XSDL On the android device + +On the splash-screen of the app go to: +``` +“CHANGE DEVICE CONFIGURATION” +└──Mouse Emulation Modde + └──Desktop, No Emulation +``` +if you missed it, restart the app. + +on the Pi +```bash +sudo service KlipperScreen stop +sudo service KlipperScreen start +``` + +## Discourse + +[it has old instructions but you may get some help if needed](https://klipper.discourse.group/t/how-to-klipperscreen-on-android-smart-phones/1196) diff --git a/docs/Hardware.md b/docs/Hardware.md index 9e67d0e7..54b869be 100644 --- a/docs/Hardware.md +++ b/docs/Hardware.md @@ -11,9 +11,10 @@ There are no recommended screens, but the minimum supported resolution is 480x32 * [3.5" RPi Display](http://www.lcdwiki.com/3.5inch_RPi_Display) * [5" HDMI Display-B](http://lcdwiki.com/5inch_HDMI_Display-B) * [VoCore](https://klipper.discourse.group/t/hardware-known-to-work-with-klipperscreen/35/7) -* [Android Phone](https://klipper.discourse.group/t/how-to-klipperscreen-on-android-smart-phones/1196) * [WAVESHARE 4.3 inch DSI LCD](https://www.waveshare.com/4.3inch-dsi-lcd.htm) * [DFrobot DFR0550](https://wiki.dfrobot.com/5%27%27TFT-Display_with_Touchscreen_V1.0_SKU_DFR0550) +* ![Android phone](Android.md) + * [More known hardware in the klipper discourse](https://klipper.discourse.group/t/hardware-known-to-work-with-klipperscreen/35) diff --git a/mkdocs.yml b/mkdocs.yml index dadf513a..4702e82b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -13,6 +13,7 @@ nav: - Configuration.md - Quicktips.md - Macros: macros.md + - Android.md - Troubleshooting.md - Theming.md - Translations.md