From 8343794d34a59b23e545b771bca682b67c8063d9 Mon Sep 17 00:00:00 2001 From: Douglas RAILLARD Date: Wed, 5 Jun 2019 15:06:48 +0100 Subject: [PATCH] module/thermal: Gracefully handle unexpected sysfs names Instead of raising an exception, log an warning and carry on. --- devlib/module/thermal.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devlib/module/thermal.py b/devlib/module/thermal.py index 69b7bd3..f2accc9 100644 --- a/devlib/module/thermal.py +++ b/devlib/module/thermal.py @@ -88,6 +88,9 @@ class ThermalModule(Module): for entry in target.list_directory(self.thermal_root): re_match = re.match('^(thermal_zone|cooling_device)([0-9]+)', entry) + if not re_match: + self.logger.warning('unknown thermal entry: %s', entry) + continue if re_match.group(1) == 'thermal_zone': self.add_thermal_zone(re_match.group(2))