chuwi-minibook-tablet-mode/tablet-mode

28 lines
568 B
Text
Raw Permalink Normal View History

2019-03-23 14:11:21 +01:00
#! /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())