This commit is contained in:
Richard Neumann 2019-03-23 14:11:21 +01:00
commit 319eaea1c9
8 changed files with 741 additions and 0 deletions

27
tablet-mode Executable file
View file

@ -0,0 +1,27 @@
#! /usr/bin/env python3
"""Grabs the respective device to discard any input from it."""
from configparser import ConfigParser
from subprocess import run
CONFIG_FILE = '/etc/tablet-mode.conf'
EVTEST = '/usr/bin/evtest'
def grab_device(device):
"""Grabs the respective device via evtest."""
return run((EVTEST, '--grab', device))
def get_device():
"""Reads the device from the config file."""
parser = ConfigParser()
parser.read(CONFIG_FILE)
return parser['Device']['keyboard']
if __name__ == '__main__':
grab_device(get_device())