#!/usr/bin/env python3
-# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
-# SPDX-License-Identifier: MIT
+# SPDX-License-Identifier: MIT
#
-# This file is part of systemd. It is distrubuted under the MIT license, see
-# below.
-#
-# Copyright 2016 Zbigniew Jędrzejewski-Szmek
+# This file is distributed under the MIT license, see below.
#
# The MIT License (MIT)
#
import os
try:
- from pyparsing import (Word, White, Literal, ParserElement, Regex,
- LineStart, LineEnd,
+ from pyparsing import (Word, White, Literal, ParserElement, Regex, LineEnd,
OneOrMore, Combine, Or, Optional, Suppress, Group,
nums, alphanums, printables,
stringEnd, pythonStyleComment, QuotedString,
('KEYBOARD_LED_NUMLOCK', Literal('0')),
('KEYBOARD_LED_CAPSLOCK', Literal('0')),
('ACCEL_MOUNT_MATRIX', mount_matrix),
+ ('ACCEL_LOCATION', STRING),
)
fixed_props = [Literal(name)('NAME') - Suppress('=') - val('VALUE')
for name, val in props]
if len(defaults) > 1:
error('More than one star entry: {!r}', prop)
+def check_one_accel_location(prop, value):
+ if value not in ['base', 'display']:
+ error('Wrong accel location: {!r}', prop)
+
def check_one_mount_matrix(prop, value):
numbers = [s for s in value if s not in {';', ','}]
if len(numbers) != 9:
check_one_default(prop, parsed.VALUE.SETTINGS)
elif parsed.NAME == 'ACCEL_MOUNT_MATRIX':
check_one_mount_matrix(prop, parsed.VALUE)
+ elif parsed.NAME == 'ACCEL_LOCATION':
+ check_one_accel_location(prop, parsed.VALUE)
elif parsed.NAME.startswith('KEYBOARD_KEY_'):
check_one_keycode(prop, parsed.VALUE)