Skip to content

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

@joerick

Description

@joerick

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions