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

UI breaks in WebView v58 (old) #40

Open
tobiasBora opened this issue Aug 20, 2019 · 6 comments
Open

UI breaks in WebView v58 (old) #40

tobiasBora opened this issue Aug 20, 2019 · 6 comments

Comments

@tobiasBora
Copy link

Hello,

First, thanks a lot for this very promising app. The instructions using the old branch and the F-Droid app worked greatly, but unfortunately I wasn't able to use any button, making the app not usable. I think to understand that in latest versions, it is now possible to use buttons... But unfortunately I can't find how to use the latest version. Here is what I do for now:

  • I download latest version with a clone of the master branch, and I run pip3 install ..
  • I install the apk in devel/app-debug.apk
  • I install the udev rule with the script in bin/yoke-enable-uinput
  • I run yoke
  • From the android app, I connect to my computer

Then, I see several layouts (that's a great idea so far), and on the console I get:

$ yoke
Starting service... Press Ctrl+C to exit.
starting webserver on  49439 /home/leo/.local/lib/python3.7/site-packages/yoke/assets/joypad
To connect select "leodeb-Yoke-1" on your device,
or connect manually to "192.168.1.21:49439"
192.168.1.14 - - [20/Aug/2019 12:10:31] "GET /main.html HTTP/1.1" 200 -
192.168.1.14 - - [20/Aug/2019 12:10:32] "GET /base.css HTTP/1.1" 200 -
192.168.1.14 - - [20/Aug/2019 12:10:32] "GET /base.js HTTP/1.1" 200 -
192.168.1.14 - - [20/Aug/2019 12:10:32] code 404, message File not found
192.168.1.14 - - [20/Aug/2019 12:10:32] "GET /favicon.ico HTTP/1.1" 404 

and when I click on a layout (say Racing), I get a strange display, without any touchpad anymore (looks a bit strange), like that:
Screenshot_20190820-121140

And when I randomly press some buttons, yoke crash on the computer with an error:

192.168.1.14 - - [20/Aug/2019 12:11:15] "GET /racing.css HTTP/1.1" 200 -
192.168.1.14 - - [20/Aug/2019 12:11:15] "GET /img/motiontrinket.svg HTTP/1.1" 200 -
192.168.1.14 - - [20/Aug/2019 12:11:15] "GET /img/b1.svg HTTP/1.1" 200 -
Connected to  ('192.168.1.14', 42000)
Shutting down...
Traceback (most recent call last):
  File "/home/leo/.local/bin/yoke", line 17, in <module>
    service.run()
  File "/home/leo/.local/lib/python3.7/site-packages/yoke/service.py", line 313, in run
    v = self.preprocess(m, len(self.dev.events))
  File "/home/leo/.local/lib/python3.7/site-packages/yoke/service.py", line 246, in preprocess
    v = tuple([int(m) for m in v])
  File "/home/leo/.local/lib/python3.7/site-packages/yoke/service.py", line 246, in <listcomp>
    v = tuple([int(m) for m in v])
ValueError: invalid literal for int() with base 10: b'NaN'

(On the android, I can also see some numbers with one of the numbers being 'NaN', so I guess the error comes from that).

Moreover, before the crash, jstest-gtk does not detect any joystick.

Did I make a mistake? If yes, how could I get a full working yoke, with touchpads and buttons?

Thanks a lot!

@pzmarzly
Copy link
Collaborator

wow, that's weird. What version of Android are you using?

If you have adb configured, you could try opening html file in mobile Chrome (e.g. http://192.168.1.14:42000/main.html). If it fails there too, connect phone to PC, then in PC Chrome open DevTools->More->Remote devices->select your phone->Inspect, then copy JS errors that appear there.

@tobiasBora
Copy link
Author

tobiasBora commented Aug 20, 2019

Thanks for your answer. So, here is my first report, I think I understand a bit better what's the issue.

But I also have some questions/things I don't understand.

So first, for what I tried:

  • on another mobile phone, android 7.0 with google apps installed, everything rocks (except that I don't have vibrations)
  • on my main phone (lineage OS 14.1, android 7.1.2, no google apps), if I go on the main.html page with firefox, the layout is much better (and it can vibrate, even if it does not detect strenght). I don't have any strange Nan value on the bottom line when I try to click somewhere. However, the informations are not sent back to my computer (which does not even create the joystick device). Any idea why it does not work with firefox? Is it linked with adb and the fact that I'm using firefox and not chrome? I'm curious, how is implemented the event link between the phone and the python code?

Now, you asked me to use chrome... But it appears that on my phone I don't have any GAPPS (google applications) installed, and for tons of reasons (privacy, efficiency...), I don't want to install them. Does yoke require GAPPS in order to work?

Thanks!

-- EDIT --
The Webview in the app seems to launch "Browser" (default browser), which, when loaded manually has exactly the same bugs as the app. So I guess replacing Browser with Firefox could work if it's possible? Now, I still don't understand why Firefox alone does not send anything to the python code.

@pzmarzly
Copy link
Collaborator

Browsers don't send any events to Yoke because events are sent over UDP (JS code running in WebView can call native Java code, which sends UDP packet).

I'm on Lineage 14.1-20190303-jfltexx without GAPPS (but with microG, though I think I tried it without microG some time ago and it worked too). Yoke works in Browser and in Yoke app.

Browser: org.lineageos.jelly version 7.1.2
Android System WebView: com.android.webview version 71.0.3578.99

If you are running the same, or newer, version of LOS as I do, check your Developer options:

Screenshot_20190820-155515

In WebView implementation I can select "AOSP WebView" or "Chrome Stable" (I have Chrome installed, it doesn't require gapps or microg), Yoke works with both.

@tobiasBora
Copy link
Author

tobiasBora commented Aug 20, 2019

Thanks a lot for your answer, that's very interesting! So I have a much older Lineage: 14.1-20170525-UNOFFICIAL-a3ltex (my phone is not officially supported, and I don't have time to upgrade right now). I guess it's a bug on Browser?

So I tried to install Chrome (without GAPPS installed), and instead yoke works greatly now! Thanks a lot! But if possible I'd like to avoid to rely on Chrome, do you know if it's possible to get Firefox's geckos engine, or eventually upgrade Android System Webview (I would like a FOSS version)?

Thanks again!

EDIT: Here are my versions:
Browser: org.lineageos.jelly version 7.1.2
Android System Webview: com.android.webview version 58.0.3029.83

@pzmarzly
Copy link
Collaborator

What do you mean by "Yoke works in Browser". You mean only the UI, without the link to the computer? (deleted)

Yes, I meant the UI.

I guess it's a bug on Browser?

Hopefully it's bug in ASW. Otherwise, it would turn out that Yoke needs newer ASW than we have expected it does.

do you know if it's possible to get Firefox's geckos engine

Gecko engine is not exposed, so no. There is ongoing progress on GeckoView, but its API probably won't be WebView-compatible - details.

WebView selection seems to be limited, anyway, by this commit, the only problem is that I can't find it in LOS repos (but I think it's there, after all, it works).

I guess you could, in theory, build ASW yourself, though I think you would also need to re-sign all system packages so that signatures would match. Seems like a lot of work. To my knowledge, Google ASW is unmodified, just signed&redistributed in the Play Store, so I suggest you just grab Google ASW 75 (the latest, 76, broke motion controls) from apkmirror.

@medape
Copy link
Contributor

medape commented Aug 21, 2019

Wow, that's a weird bug.

I didn't write the code for the app, but it has very simple code and it doesn't depend on GAPPS. I'm using a rooted system with GAPPS removed and it works fine for me. (Wiko's Android Marshmallow + TWRP + Magisk + AFWall+ + microG's location provider, and this app doesn't use location in any way).

Just to avoid further bugs in the future...

(On the android, I can also see some numbers with one of the numbers being 'NaN', so I guess the error comes from that).

Could you tell which numbers? Is it the first and the second from the left? (We're having a bad experience with motion controls and I'm suspecting them.) Does this bug happen with other layouts?

@pzmarzly pzmarzly changed the title How to use latest yoke? UI breaks in WebView v58 (old) Oct 19, 2020
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

3 participants