mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-01-19 00:03:33 +00:00
Simplify doctor rule checking
This commit is contained in:
parent
07e37c857c
commit
510138f525
@ -149,7 +149,6 @@ def check_udev_rules():
|
|||||||
ok = True
|
ok = True
|
||||||
udev_dir = Path("/etc/udev/rules.d/")
|
udev_dir = Path("/etc/udev/rules.d/")
|
||||||
desired_rules = {
|
desired_rules = {
|
||||||
'qmk': {
|
|
||||||
# Atmel DFU
|
# Atmel DFU
|
||||||
_udev_rule("03EB", "2FEF"), # ATmega16U2
|
_udev_rule("03EB", "2FEF"), # ATmega16U2
|
||||||
_udev_rule("03EB", "2FF0"), # ATmega32U2
|
_udev_rule("03EB", "2FF0"), # ATmega32U2
|
||||||
@ -174,7 +173,6 @@ def check_udev_rules():
|
|||||||
_udev_rule("2341", None, 'ENV{ID_MM_DEVICE_IGNORE}="1"'), # Arduino SA
|
_udev_rule("2341", None, 'ENV{ID_MM_DEVICE_IGNORE}="1"'), # Arduino SA
|
||||||
_udev_rule("2A03", None, 'ENV{ID_MM_DEVICE_IGNORE}="1"') # dog hunter AG
|
_udev_rule("2A03", None, 'ENV{ID_MM_DEVICE_IGNORE}="1"') # dog hunter AG
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# These rules are no longer recommended, only use them to check for their presence.
|
# These rules are no longer recommended, only use them to check for their presence.
|
||||||
deprecated_rules = {
|
deprecated_rules = {
|
||||||
@ -197,14 +195,13 @@ def check_udev_rules():
|
|||||||
current_rules.add(line)
|
current_rules.add(line)
|
||||||
|
|
||||||
# Check if the desired rules are among the currently present rules
|
# Check if the desired rules are among the currently present rules
|
||||||
for bootloader, rules in desired_rules.items():
|
for rules in desired_rules.items():
|
||||||
# For caterina, check if ModemManager is running
|
# For caterina, check if ModemManager is running
|
||||||
if bootloader == "caterina":
|
|
||||||
if check_modem_manager():
|
if check_modem_manager():
|
||||||
ok = False
|
ok = False
|
||||||
cli.log.warn("{bg_yellow}Detected ModemManager without the necessary udev rules. Please either disable it or set the appropriate udev rules if you are using a Pro Micro.")
|
cli.log.warn("{bg_yellow}Detected ModemManager without the necessary udev rules. Please either disable it or set the appropriate udev rules if you are using a Pro Micro.")
|
||||||
if not rules.issubset(current_rules):
|
if not rules.issubset(current_rules):
|
||||||
deprecated_rule = deprecated_rules.get(bootloader)
|
for bootloader, rules in deprecated_rules.items():
|
||||||
if deprecated_rule and deprecated_rule.issubset(current_rules):
|
if deprecated_rule and deprecated_rule.issubset(current_rules):
|
||||||
cli.log.warn("{bg_yellow}Found old, deprecated udev rules for '%s' boards. The new rules on https://docs.qmk.fm/#/faq_build?id=linux-udev-rules offer better security with the same functionality.", bootloader)
|
cli.log.warn("{bg_yellow}Found old, deprecated udev rules for '%s' boards. The new rules on https://docs.qmk.fm/#/faq_build?id=linux-udev-rules offer better security with the same functionality.", bootloader)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user