udev

This modules handles udev-related stuff on Linux. It contains function to generate, check and update rules files.

Note

The functions of this module must only be used with udev-based Linux distro.

rivalcfg.udev.RULES_FILE_PATH = '/etc/udev/rules.d/99-steelseries-rival.rules'

Path to the udev rules file

rivalcfg.udev.are_rules_up_to_date(rules, current_version='4.14.0')

Check if the given udev rules are up to date.

Parameters:
  • rules (str) – The content of an udev rule file to check.

  • current_version (str) – The current rivalcfg version.

Return type:

bool

rivalcfg.udev.generate_rules()

Generates the content of the udev rules file.

Return type:

str

rivalcfg.udev.is_rules_file_up_to_date(path='/etc/udev/rules.d/99-steelseries-rival.rules')

Check if the given udev rules file is up to date.

Parameters:

path (str) – The path of the udev rules file.

Return type:

bool

rivalcfg.udev.reload_rules()

Reload udev rules.

rivalcfg.udev.trigger()

Trigger udev to take into account the new rules.

rivalcfg.udev.write_rules_file(path='/etc/udev/rules.d/99-steelseries-rival.rules')

Generates and write the udev rules file at the given place.

Parameters:

path (str) – The path of the output file.

Raises:

PermissionError – The user has not sufficient permissions to write the file.