WizardKit/scripts/wk/hw/keyboard.py

32 lines
716 B
Python

"""WizardKit: Keyboard test functions"""
# vim: sts=2 sw=2 ts=2
import logging
from wk.exe import run_program
from wk.std import PLATFORM
from wk.ui.cli import print_warning # TODO: This is lazy
# STATIC VARIABLES
LOG = logging.getLogger(__name__)
# Functions
def keyboard_test() -> None:
"""Test keyboard using OS specific functions."""
if PLATFORM == 'Linux':
run_xev()
else:
print_warning(f'Not supported under this OS: {PLATFORM}')
def run_xev() -> None:
"""Test keyboard using xev."""
LOG.info('Keyboard Test (xev)')
cmd = ['xev', '-event', 'keyboard']
run_program(cmd, check=False, pipe=False)
if __name__ == '__main__':
print("This file is not meant to be called directly.")