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

Add cleanup functionality so tbprocessd can reset the environment for each app #9

Open
joerick opened this issue Oct 14, 2016 · 0 comments

Comments

@joerick
Copy link
Member

joerick commented Oct 14, 2016

We've had some reports of Tingbots getting stuck with a 'black screen' after an app freezes.

The problem occurs when an app freezes such that pygame can't clean up properly on exit, leaving the screen in a strange state. It's something to do with virtual terminals and console modes, something that I'm not that familiar with, but we're close to a fix.

The temporary fix that I've been working on with @WhistleMaster is an app that you can send to the tingbot that resets a couple of things. If you can run this app on a Tingbot (using Tide) while frozen, it should reset the screen and get it back up and running.

fixterm-v2.tingapp

VT_UNLOCKSWITCH = 22028
KDSETMODE = 19258
KD_TEXT = 0

from fcntl import ioctl

with open('/dev/tty0', 'w+') as f:
    ioctl(f, KDSETMODE, KD_TEXT)

import tingbot
from tingbot import *

# setup code here

@every(seconds=1.0/30)
def loop():
    # drawing code here
    screen.fill(color='black')
    screen.text('VT was unlocked!', color='green')

tingbot.run()

fixterm-v2.tingapp.zip

We should integrate this fix into our process daemon, so that we are resetting as much as possible after an app exits, to get back to a clean state each time.

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

1 participant