hanskokx / gcwconnect

A simple wireless configuration manager for the GCW-Zero
7 stars 10 forks source link

Causing screen flickering on RG350M #5

Closed Ripper00420 closed 3 years ago

Ripper00420 commented 3 years ago

Possibly due to resolution, but causes screen flickering on RG350M devices with 640x480 screens

hanskokx commented 3 years ago

I'm not familiar with the device, so it might take a minute to troubleshoot. For starters, can you grab the code from my dev branch, to ensure we're on the same codebase? Then, if you can run it from a shell, any output you gather would be very useful. Finally, (and I know this is a big ask), if you could grab a video of the issue... That might be useful.

Ripper00420 commented 3 years ago

I have no idea how to even do that from this OpenDingux device, but it’s the same as the RG350 that runs this opk perfectly.

I truly believe it’s that your opk output is set to 320x240, and that the RG350M and RG351V are 640x480

Is there any way you could make one with the 640x480 resolution, in an opk, for these devices?

I’m truly sorry I’m not more familiar with coding and repacking

Sent from my iPhone

On Mar 18, 2021, at 9:56 PM, Hans Kokx @.***> wrote:

 I'm not familiar with the device, so it might take a minute to troubleshoot. For starters, can you grab the code from my dev branch, to ensure we're on the same codebase? Then, if you can run it from a shell, any output you gather would be very useful. Finally, (and I know this is a big ask), if you could grab a video of the issue... That might be useful.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

hanskokx commented 3 years ago

https://www.github.com/hanskokx/gcwconnect/tree/dev/gcwconnect.py

Try copying this code to the device. Change lines 38+39. There's a bunch of stuff that won't look right, but it might help fix the flickering. —

Hans Kokx On March 18, 2021 10:38:38 PM Ripper00420 @.***> wrote:

I have no idea how to even do that from this OpenDingux device, but it’s the same as the RG350 that runs this opk perfectly.

I truly believe it’s that your opk output is set to 320x240, and that the RG350M and RG351V are 640x480

Is there any way you could make one with the 640x480 resolution, in an opk, for these devices?

I’m truly sorry I’m not more familiar with coding and repacking

Sent from my iPhone

On Mar 18, 2021, at 9:56 PM, Hans Kokx @.***> wrote:

I'm not familiar with the device, so it might take a minute to troubleshoot. For starters, can you grab the code from my dev branch, to ensure we're on the same codebase? Then, if you can run it from a shell, any output you gather would be very useful. Finally, (and I know this is a big ask), if you could grab a video of the issue... That might be useful.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Ripper00420 commented 3 years ago

I’ll try, but this device only reads opk files from the OS. There isn’t really a way to run python scripts manually, so I’ll see what I can do.

Thanks for the information.

Sent from my iPhone

On Mar 18, 2021, at 11:05 PM, Hans Kokx @.***> wrote:

 https://www.github.com/hanskokx/gcwconnect/tree/dev/gcwconnect.py

Try copying this code to the device. Change lines 38+39. There's a bunch of stuff that won't look right, but it might help fix the flickering. —

Hans Kokx On March 18, 2021 10:38:38 PM Ripper00420 @.***> wrote:

I have no idea how to even do that from this OpenDingux device, but it’s the same as the RG350 that runs this opk perfectly.

I truly believe it’s that your opk output is set to 320x240, and that the RG350M and RG351V are 640x480

Is there any way you could make one with the 640x480 resolution, in an opk, for these devices?

I’m truly sorry I’m not more familiar with coding and repacking

Sent from my iPhone

On Mar 18, 2021, at 9:56 PM, Hans Kokx @.***> wrote:

I'm not familiar with the device, so it might take a minute to troubleshoot. For starters, can you grab the code from my dev branch, to ensure we're on the same codebase? Then, if you can run it from a shell, any output you gather would be very useful. Finally, (and I know this is a big ask), if you could grab a video of the issue... That might be useful.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

hanskokx commented 3 years ago

No shell access at all? I'll see what I can do tomorrow. —

Hans Kokx On March 18, 2021 11:24:19 PM Ripper00420 @.***> wrote:

I’ll try, but this device only reads opk files from the OS. There isn’t really a way to run python scripts manually, so I’ll see what I can do.

Thanks for the information.

Sent from my iPhone

On Mar 18, 2021, at 11:05 PM, Hans Kokx @.***> wrote:

https://www.github.com/hanskokx/gcwconnect/tree/dev/gcwconnect.py

Try copying this code to the device. Change lines 38+39. There's a bunch of stuff that won't look right, but it might help fix the flickering. —

Hans Kokx On March 18, 2021 10:38:38 PM Ripper00420 @.***> wrote:

I have no idea how to even do that from this OpenDingux device, but it’s the same as the RG350 that runs this opk perfectly.

I truly believe it’s that your opk output is set to 320x240, and that the RG350M and RG351V are 640x480

Is there any way you could make one with the 640x480 resolution, in an opk, for these devices?

I’m truly sorry I’m not more familiar with coding and repacking

Sent from my iPhone

On Mar 18, 2021, at 9:56 PM, Hans Kokx @.***> wrote:

I'm not familiar with the device, so it might take a minute to troubleshoot. For starters, can you grab the code from my dev branch, to ensure we're on the same codebase? Then, if you can run it from a shell, any output you gather would be very useful. Finally, (and I know this is a big ask), if you could grab a video of the issue... That might be useful.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Ripper00420 commented 3 years ago

Thank you very much. The RG350M is a handheld emulator with no keyboard, that runs on OpenDingux OS. It runs the GCWconnect.opk and connects fine with an adapter, but is the only app that causes the screen to flicker due to not outputting at 640x480

I wish I could help, but again I’m not very familiar with coding or repacking of opk files currently.

Your are amazing for making devices like mine able to connect to each other for multiplayer gaming with your application Sent from my iPhone

On Mar 18, 2021, at 11:25 PM, Hans Kokx @.***> wrote:

 No shell access at all? I'll see what I can do tomorrow. —

Hans Kokx On March 18, 2021 11:24:19 PM Ripper00420 @.***> wrote:

I’ll try, but this device only reads opk files from the OS. There isn’t really a way to run python scripts manually, so I’ll see what I can do.

Thanks for the information.

Sent from my iPhone

On Mar 18, 2021, at 11:05 PM, Hans Kokx @.***> wrote:

https://www.github.com/hanskokx/gcwconnect/tree/dev/gcwconnect.py

Try copying this code to the device. Change lines 38+39. There's a bunch of stuff that won't look right, but it might help fix the flickering. —

Hans Kokx On March 18, 2021 10:38:38 PM Ripper00420 @.***> wrote:

I have no idea how to even do that from this OpenDingux device, but it’s the same as the RG350 that runs this opk perfectly.

I truly believe it’s that your opk output is set to 320x240, and that the RG350M and RG351V are 640x480

Is there any way you could make one with the 640x480 resolution, in an opk, for these devices?

I’m truly sorry I’m not more familiar with coding and repacking

Sent from my iPhone

On Mar 18, 2021, at 9:56 PM, Hans Kokx @.***> wrote:

I'm not familiar with the device, so it might take a minute to troubleshoot. For starters, can you grab the code from my dev branch, to ensure we're on the same codebase? Then, if you can run it from a shell, any output you gather would be very useful. Finally, (and I know this is a big ask), if you could grab a video of the issue... That might be useful.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

hanskokx commented 3 years ago

So, I'm not sure what version of OpenDingux you're running. The latest version changed a lot when it comes to the networking, so I had to completely rewrite a large portion of the program.

Assuming you're using that updated version of OpenDingux, I'd like you to give this opk a shot: https://github.com/hanskokx/gcwconnect/blob/dev/gcwconnect.opk

If you run into issues with it, you might need to upgrade your OpenDingux firmware. It looks like there's some information about that here

I also found this firmware, but I didn't install it and couldn't look into the disk image to see what version it's running.

For the record, my GCW Zero is currently on a build from Sep 29, 2020, and this should should work fine. Let me know what the outcome is, either way.

Ripper00420 commented 3 years ago

I don’t use the beta version, due to the stability of the OS. I use the second link with the HDMI patch, because it works the best on my setup. I will test the opk, but if it’s for the latest beta, it probably won’t work on mine. This version seems to have fixed the flickering on my devices, but in think he just used the fixes from the Rogue firmware. https://github.com/matdave/gcwconnect/releases This isn’t for Rogue, but uses the fixes from it to work in stock.

Sent from my iPhone

On Mar 19, 2021, at 5:20 PM, Hans Kokx @.***> wrote:

 So, I'm not sure what version of OpenDingux you're running. The latest version changed a lot when it comes to the networking, so I had to completely rewrite a large portion of the program.

Assuming you're using that updated version of OpenDingux, I'd like you to give this opk a shot: https://github.com/hanskokx/gcwconnect/blob/dev/gcwconnect.opk

If you run into issues with it, you might need to upgrade your OpenDingux firmware. It looks like there's some information about that here

I also found this firmware, but I didn't install it and couldn't look into the disk image to see what version it's running.

For the record, my GCW Zero is currently on a build from Sep 29, 2020, and this should should work fine. Let me know what the outcome is, either way.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

pcercuei commented 3 years ago

There is nothing to change in GCWConnect. It will work fine as long as you launch it from GMenu2X. If it causes problems when you launch it from a different menu, then it's the menu's fault.

hanskokx commented 3 years ago

It's a bit of a hacky job, but it should work. ~https://github.com/hanskokx/gcwconnect/blob/main/gcwconnect.opk~

Also, @pcercuei has a good point. I'm thinking this might be a case of two processes trying to write to the framebuffer simultaneously. If that's the case, it would cause screen flickering.

marty-rabens commented 3 years ago

Just a heads-up. The latest commit (from 2 days ago) broke this for me. When I run it on my RG350P, it immediately exits. Running it from the command line shows "Runtime Error: Bad magic number in .pyc file".

The previous commit, 0b721bf from May 14, 2014, works fine for me. I'm on kernal version 3.12.0-dingux+.

hanskokx commented 3 years ago

Just a heads-up. The latest commit (from 2 days ago) broke this for me. When I run it on my RG350P, it immediately exits. Running it from the command line shows "Runtime Error: Bad magic number in .pyc file".

The previous commit, 0b721bf from May 14, 2014, works fine for me. I'm on kernal version 3.12.0-dingux+.

I was afraid something like this might happen. Are you savvy enough to tell me what version of Python is running? (Python 2 vs Python 3.x)

Currently, the pyc is compiled for 3.8.

marty-rabens commented 3 years ago

Ah, didn't consider that. Yeah, looks like it's Python 2.7.8. It's the stock firmware that came on the included SD card when I got it a couple months ago, so that's probably what most RG350 owners will have.

I'll be glad to test any builds.

hanskokx commented 3 years ago

I recompiled for Python 2.7: https://github.com/hanskokx/gcwconnect/blob/dev/gcwconnect.opk Let me know if that helps.

marty-rabens commented 3 years ago

Can't import parse.

Earlier, I unpacked the data folder and copied the uncompiled gcwconnect.py (from the latest main branch) and ran it, and it had the same import error.

from urllib.parse import quote_plus, unquote_plus

Python 2.7 doesn't have a urllib.parse package. It's directly in the urllib package. So, from urllib import quote_plus, unquote_plus works.

That got it to run, but I just a blank screen on the device.

marty-rabens commented 3 years ago

Oh, sorry. I just looked at the dev branch, and I see you are doing from urllib import quote_plus, unquote_plus.

But I'm getting this when I run your dev branch opk:

Traceback (most recent call last):
  File "gcwconnect.py", line 28, in <module>
ImportError: cannot import name parse
marty-rabens commented 3 years ago

Doh! Sorry, I really need to read before I post. In dev branch, you actually have from urllib import parse.

So back to my previous comment about Python 2.7 not having a urllib.parse package.

hanskokx commented 3 years ago

Oof.  Can you grab the python file from the main branch and see if that works?  If it does, I'll compile that into the opk.

— Hans Kokx On 3/23/2021 10:16:03 AM, marty-rabens @.***> wrote: Doh! Sorry, I really need to read before I post. In dev branch, you actually have from urllib import parse. So back to my previous comment about Python 2.7 not having a urllib.parse package. — You are receiving this because you were assigned. Reply to this email directly, view it on GitHub [https://github.com/hanskokx/gcwconnect/issues/5#issuecomment-804938273], or unsubscribe [https://github.com/notifications/unsubscribe-auth/AAOSY37T46TNNF754CKO7D3TFCPCHANCNFSM4ZN3M3DQ].

marty-rabens commented 3 years ago

The python file from the main branch is the one I tried earlier (see earlier comment). I get an import error because of the from urllib.parse import quote_plus, unquote_plus (and Python 2.7 doesn't have a urllib.parse package). Changing it to from urllib import quote_plus, unquote_plus gets it to run, but I get a blank screen.

If I have time later, I'll do some debugging and apply the changes in your 41524e6 commit incrementally, to see if I can isolate what causes the blank screen.

hanskokx commented 3 years ago

Ok; I made a few changes to the files on the main branch.

https://github.com/hanskokx/gcwconnect/blob/main/gcwconnect.py

Lines 82-88 are what are the most likely culprits for causing the blank screen, but go ahead and try to run the code as-is.

hanskokx commented 3 years ago

I wonder if those lines are features only present in PyGame 2.0... 🤔

Can you shell into your device, run python, and try to run those commands? Let's see if we can even use them on older firmware.

marty-rabens commented 3 years ago

Getting a NameError: global name 'DEBUG' not defined on line 177.

This change to gcwconnect.py fixes it:

@@ -78,6 +78,8 @@ mac_addresses = {}
 dev_os = "win32"
 if sys.platform == dev_os:
     DEBUG = True
+else:
+    DEBUG = False

 pygame.init()
 infoObject = pygame.display.Info()

With that fix, the opk is working great on my RG350!

hanskokx commented 3 years ago

Ah, yeah. I probably should have initialized that. 😅 No flickering? All features and functions work? Nothing being displayed incorrectly, out of place, or overlapping?

marty-rabens commented 3 years ago

It all looked good to me.

If I run the opk from the shell (with opkrun), it flickers between the desktop and the app, and I can't do anything (have to hard reset). But I would expect that, since that's not a normal way of running it. Launching from the icon on the device works fine.

marty-rabens commented 3 years ago

Argh. I guess it's inconsistent (those are the worst kind of bugs).

Last night, a couple of times when I launched it (correctly, from the desktop), it was glitchy and flickering. The lower part of the screen (like maybe, 15%) was noise, and the rest of the menu was shifted up so it overlapped with the "GCWCONNECT" header at the top, looking like it was alternating frames between the header and the menu. It was still fully useable, though. I could navigate the menu, connect, etc.

I quit and launched it a couple more times, and it was glitchy like that. I shut down and powered back on, launched gcwconnect, and it was fine every time I launched it. So maybe it gets into some kind of state that gets reset on restart?

This morning, I've shutdown and powered back on a few times, and I haven't been able to reproduce the bug.

marty-rabens commented 3 years ago

Okay, I just got it to happen again. Here's a photo. And here's a video, showing that you can still navigate the menu and use the app.

After I quit and relaunched gcwconnect, it didn't happen again. So I was wrong about it getting into a state that only resets on reboot.

marty-rabens commented 3 years ago

A couple other issues as I've been more thoroughly testing the app.

In Manual Setup, the X and Y buttons are swapped from what they say they do. It says "X Delete Y Shift". But when I press X (the top button on the RG350), it shifts, and when I press Y (the left button), it deletes. A and B work as labeled.

Create AP doesn't work. When selected, it says "Failed to create AP...". The status at the bottom then says "unassociated 10.1.2.1". If I then select Disconnect, it says "Disconnecting" for a couple seconds, but the status at the bottom doesn't change. The log then says "ifdown: interface wlan0 not configured".

Scan for APs no longer works. I can still connect to my saved network, but when I select Scan for APs, it says "Enabling WiFi", then "Scanning...", then shows a ":(". The status at the bottom then shows "wlan0 is off." and my MAC address. There's nothing in the log.

I got it into a state where the glitchy menu happened every time (I launched it several times), even after shutting down and powering back up. I shut down and put an ice pack on the device for a minute, restarted, and the menu was consistently good. So it might be temperature related?

marty-rabens commented 3 years ago

I tried the old 2014 opk (from commit 0b721bf) again. Scan for APs works fine in that build, but Create AP still failed (so I suspect that has never worked on the RG350).

hanskokx commented 3 years ago

I tried the old 2014 opk (from commit 0b721bf) again. Scan for APs works fine in that build, but Create AP still failed (so I suspect that has never worked on the RG350).

Here's the diff between those two builds. https://github.com/hanskokx/gcwconnect/compare/866df69..0b721bf#diff-c2efec2218d3883c31f142d56517b431468b527fb38e78c0dd9ff700dcc8b528

hanskokx commented 3 years ago

A couple other issues as I've been more thoroughly testing the app.

In Manual Setup, the X and Y buttons are swapped from what they say they do. It says "X Delete Y Shift". But when I press X (the top button on the RG350), it shifts, and when I press Y (the left button), it deletes. A and B work as labeled.

I suspect the buttons might be in physically different locations on the device. What are the orientation of the buttons on the face of your device?

Create AP doesn't work. When selected, it says "Failed to create AP...". The status at the bottom then says "unassociated 10.1.2.1". If I then select Disconnect, it says "Disconnecting" for a couple seconds, but the status at the bottom doesn't change. The log then says "ifdown: interface wlan0 not configured".

Did it work in the old build?

Scan for APs no longer works. I can still connect to my saved network, but when I select Scan for APs, it says "Enabling WiFi", then "Scanning...", then shows a ":(". The status at the bottom then shows "wlan0 is off." and my MAC address. There's nothing in the log.

Try changing output = SU.Popen(['iwlist', iface, 'scan'], to output = SU.Popen(['sbin', 'iwlist', iface, 'scan'], to see if that helps. I'm guessing we need to specify the full path of iwlist.

I got it into a state where the glitchy menu happened every time (I launched it several times), even after shutting down and powering back up. I shut down and put an ice pack on the device for a minute, restarted, and the menu was consistently good. So it might be temperature related?

I can't find anything in the code that would cause this to happen. I've tested on my own, physical device, as well as numerous computers and I've never seen anything like this before. I suspect it is specific to your device and could certainly be heat-related.

marty-rabens commented 3 years ago

I suspect the buttons might be in physically different locations on the device. What are the orientation of the buttons on the face of your device?

Mine are like this. Yeah, I see the X and Y are swapped from the GCW Zero, so that makes sense.

Create AP doesn't work. When selected, it says "Failed to create AP...". The status at the bottom then says "unassociated 10.1.2.1". If I then select Disconnect, it says "Disconnecting" for a couple seconds, but the status at the bottom doesn't change. The log then says "ifdown: interface wlan0 not configured".

Did it work in the old build?

Nope. Does the same thing in new and old build.

Scan for APs no longer works. I can still connect to my saved network, but when I select Scan for APs, it says "Enabling WiFi", then "Scanning...", then shows a ":(". The status at the bottom then shows "wlan0 is off." and my MAC address. There's nothing in the log.

Try changing output = SU.Popen(['iwlist', iface, 'scan'], to output = SU.Popen(['sbin', 'iwlist', iface, 'scan'], to see if that helps. I'm guessing we need to specify the full path of iwlist.

I'll try that later when I get a chance.

I got it into a state where the glitchy menu happened every time (I launched it several times), even after shutting down and powering back up. I shut down and put an ice pack on the device for a minute, restarted, and the menu was consistently good. So it might be temperature related?

I can't find anything in the code that would cause this to happen. I've tested on my own, physical device, as well as numerous computers and I've never seen anything like this before. I suspect it is specific to your device and could certainly be heat-related.

Yeah, I don't know. I haven't seen it happen with any other apps, but it's definitely not a problem for me, since the app still functions.

hanskokx commented 3 years ago

I'm fairly convinced that the display corruption is due to poor thermals. Let's close this bug, and open new ones for each of the other three issues (swapped buttons, create AP, and scanning).