From 7a868b6be03e3a1e8c2a997e93c347ffe3892adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Tue, 2 Jun 2015 12:06:42 +0200 Subject: [PATCH] plugin_audio: added check for integer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jaroslav Škarvada --- tuned/plugins/plugin_audio.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tuned/plugins/plugin_audio.py b/tuned/plugins/plugin_audio.py index 917bcfe..7b341af 100644 --- a/tuned/plugins/plugin_audio.py +++ b/tuned/plugins/plugin_audio.py @@ -57,7 +57,11 @@ class AudioPlugin(base.Plugin): @command_set("timeout", per_device = True) def _set_timeout(self, value, device, sim): - timeout = int(value) + try: + timeout = int(value) + except ValueError: + log.error("timeout value '%s' is not integer" % value) + return None if timeout >= 0: sys_file = self._timeout_path(device) if not sim: @@ -71,7 +75,7 @@ class AudioPlugin(base.Plugin): sys_file = self._timeout_path(device) value = cmd.read_file(sys_file) if len(value) > 0: - return int(value) + return value return None @command_set("reset_controller", per_device = True)