1
0
forked from drath/libratbag

implement 'DeviceType' property

Signed-off-by: Julian Kandlhofer <julian.kandlhofer@gmail.com>
This commit is contained in:
Julian Kandlhofer
2020-06-09 09:16:20 +02:00
committed by Yaroslav Chvanov
parent 931ec44ff2
commit 4f36371af3
116 changed files with 258 additions and 5 deletions

View File

@@ -64,6 +64,11 @@ def check_match_str(string: str):
assert(pid == '{:04x}'.format(int(pid, 16)))
def check_devicetype_str(string):
permitted_types = ['mouse', 'keyboard', 'other']
assertIn(string, permitted_types)
def check_ledtypes_str(string: str):
permitted_types = [
'battery',
@@ -83,7 +88,7 @@ def check_ledtypes_str(string: str):
def check_section_device(section: configparser.SectionProxy):
required_keys = ['Name', 'Driver', 'DeviceMatch']
required_keys = ['Name', 'Driver', 'DeviceMatch', 'DeviceType']
permitted_keys = required_keys + ['LedTypes']
for key in section.keys():
@@ -92,6 +97,8 @@ def check_section_device(section: configparser.SectionProxy):
for r in required_keys:
assertIn(r, section)
check_devicetype_str(section['DeviceType'])
try:
check_ledtypes_str(section['LedTypes'])
except KeyError: