mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
implement 'DeviceType' property
Signed-off-by: Julian Kandlhofer <julian.kandlhofer@gmail.com>
This commit is contained in:
committed by
Yaroslav Chvanov
parent
931ec44ff2
commit
4f36371af3
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user