chuwi-minibook-tablet-mode/tablet-mode
Richard Neumann 319eaea1c9 init
2019-03-23 14:11:21 +01:00

28 lines
568 B
Python
Executable file

#! /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())