Hello, I started to write down a new howto but it is not finished yet. I recommend to test your setup as follows.
- ssh into your pi with putty or linux command line ssh
- plug your android phone with usb debugging enabled into your raspberry
- if you have not yet installed it install adb using
pi@prusabear:~ $ sudo apt-get install adb
Reading package lists... Done
Building dependency tree
Reading state information... Done
adb is already the newest version (1:8.1.0+r23-5).
- use command
pi@prusabear:~ $ adb devices
List of devices attached
0b4dca7f device
to see if your phone is recognized by adb
- install x11-apps
pi@prusabear:~ $ sudo apt-get install x11-apps
Reading package lists... Done
Building dependency tree
Reading state information... Done
x11-apps is already the newest version (7.7+7).
- enable port forwarding
pi@prusabear:~ $ adb forward tcp:6100 tcp:6000
* daemon not running; starting now at tcp:5037
* daemon started successfully
- start x111 program xeyes
Turn off wifi on your phone. Start xsdl on your phone. If you see a mouse cursor disable in xsdl config:
Device Configuration ā In Mouse emulation ā Mouse Emulation Mode ā āDesktop no emulationā
pi@prusabear:~ $ DISPLAY=:100 xeyes
Warning: locale not supported by C library, locale unchanged
Your telephone should look like this:
Mind the xeyes in the upper left corner.
If this does not work try if you have to confirm usb debugging on your phone.
You can use ctrl-c to stop xeyes.
If thiis runs you can copy following to
- define service
/etc/systemd/system/KlipperScreen.service
[Unit]
Description=KlipperScreen
After=moonraker.service
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=pi
WorkingDirectory=/home/pi/KlipperScreen
ExecStart=/home/pi/KlipperScreen/lauch_klipperscreen.sh
[Install]
WantedBy=multi-user.target
- define start script
copy the folowing to
/home/pi/KlipperScreen/lauch_klipperscreen.sh
#!/bin/bash
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
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/python screen.py
exit 0
else
exit 1
fi
make the script executable
pi@prusabear:~ $ chmod a+x /home/pi/KlipperScreen/lauch_klipperscreen.sh
- enable service with
pi@prusabear:~ $ systemctl enable KlipperScreen.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-unit-files ===
Authentication is required to manage system service or unit files.
Authenticating as: ,,, (pi)
Password:
==== AUTHENTICATION COMPLETE ===
==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ===
Authentication is required to reload the systemd state.
Authenticating as: ,,, (pi)
Password:
==== AUTHENTICATION COMPLETE ===
and start systemd service
pi@prusabear:~ $ systemctl start KlipperScreen.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'KlipperScreen.service'.
Authenticating as: ,,, (pi)
Password:
==== AUTHENTICATION COMPLETE ===