1
0
Fork 0

plugin_audio: fixed plugin

This commit is contained in:
Jaroslav Škarvada 2012-10-29 15:45:49 +01:00
parent 17564fdc19
commit 0c81974b37

View file

@ -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"