Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script does not work really old fire tablets that lack NFC #11

Open
OCT0PUSCRIME opened this issue Mar 22, 2024 · 1 comment
Open

Script does not work really old fire tablets that lack NFC #11

OCT0PUSCRIME opened this issue Mar 22, 2024 · 1 comment

Comments

@OCT0PUSCRIME
Copy link

OCT0PUSCRIME commented Mar 22, 2024

I had to modify the script quite a bit to get this working on a Fire HD 3rd Gen KFSOWI (2013). Not sure how relevant this is, but putting this here in case anybody else has really old hardware they are trying to get some use out of.

The following commands in the script failed to execute:
adb shell dumpsys nfc
adb shell am start-activity x.org.server/.MainActivity

I was able to replicate the actions with alternate commands. My new script is as follows:

#!/bin/bash
# forward local display :100 to remote display :0
adb forward tcp:6100 tcp:6000

adb shell dumpsys input_method | grep 'mScreenOn=' | grep false > /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 window | grep 'mDreamingLockscreen=' | grep true> /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 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/[USERNAME]/.KlipperScreen-env/bin/python3 /home/[USERNAME]/KlipperScreen/screen.py
    exit 0
else
    exit 1
fi

I'll update if I change the script any further. I currently notice that it tries to start XSDL whether it's already running or not. I may try to query if it's running, then start it if it is not.

A couple other notes on this hardware:

This code doesn't work I think due to lack of WIFI debugging, but I didn't need it anyway. (Screen must be wired on this old hardware).

adb tcpip 5555
adb connect (IP ADDRESS)
adb shell

Also the current XSDL app for Fire Tablets in the readme has a couple issues. There is no option in mouse emulation for "No Emulation" but it worked when I selected "Large (Tablets)". Lastly, there is a bug in the XSDL app that makes the XSDL app restart +1 time each time the app is launched until a reboot. Example, if I've started XSDL twice since the last reboot, the app will restart 3 times before the screen is ready. Bug is already on github here and rectified in newer versions. I am going to see if I can get another version installed.

@naruhaxor
Copy link
Owner

Yeah, I've been in the process of trying to edit the script but life has been happening. The Wi-Fi debugging option is entirely optional, but I'll definitely dig through the script and see what you did. I do know I have it calling for the calling the server even if it is running to force it to bring it to front. So even if you have the app running, it might have a partial background process going by calling to it again. It brings all the processing to the front, but I haven't touched this in a while. So if you want to maintain it, you're more than welcome to clone it and maintain it. Once I can get me a new raspberry pi and a new 3D printer, I will re-go back through and update it myself, but I don't have either right now so I appreciate your insight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants