From 0c81974b373ac1dabc9dc7b8bffc5af5bab8f2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Mon, 29 Oct 2012 15:45:49 +0100 Subject: [PATCH] plugin_audio: fixed plugin --- tuned/plugins/plugin_audio.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tuned/plugins/plugin_audio.py b/tuned/plugins/plugin_audio.py index ca0f2c7..ce1d551 100644 --- a/tuned/plugins/plugin_audio.py +++ b/tuned/plugins/plugin_audio.py @@ -14,6 +14,13 @@ class AudioPlugin(base.Plugin): Plugin for tuning audio cards powersaving options. """ + @classmethod + def tunable_devices(self): + # hack, it should be splitted to ac97 and hda_intel devices + if os.path.isfile(AudioPlugin._ac97_powersave_file()) or os.path.isfile(AudioPlugin._hda_intel_powersave_file()): + devices = ["audio"] + return devices + def _post_init(self): self._dynamic_tuning = False @@ -24,6 +31,7 @@ class AudioPlugin(base.Plugin): "hda_intel_powersave" : None, } + @classmethod def _ac97_powersave_file(self): return "/sys/module/snd_ac97_codec/parameters/power_save" @@ -34,7 +42,7 @@ class AudioPlugin(base.Plugin): log.warn("Incorrect ac97_powersave value.") return - sys_file = self._ac97_powersave_file() + sys_file = AudioPlugin._ac97_powersave_file() if not os.path.exists(sys_file): return @@ -42,11 +50,12 @@ class AudioPlugin(base.Plugin): @command_get("ac97_powersave") def _get_ac97_powersave(self): - sys_file = self._ac97_powersave_file() + sys_file = AudioPlugin._ac97_powersave_file() if not os.path.exists(sys_file): return None return tuned.utils.commands.read_file(sys_file) + @classmethod def _hda_intel_powersave_file(self): return "/sys/module/snd_hda_intel/parameters/power_save"