Example #1
0
    def __init__(self, fan_name, pTable):
        try:
            self.fan_num = int(fan_name)
            if 'label' in pTable:
                self.label = pTable['label']
            else:
                self.label = "Fan %d" % (self.fan_num)

            if 'sysfs' in pTable['read_source']:
                if 'write_source' in pTable:
                    self.source = FscSensorSourceSysfs(
                        name=fan_name,
                        read_source=pTable['read_source']['sysfs'],
                        write_source=pTable['write_source']['sysfs'])
                else:
                    self.source = FscSensorSourceSysfs(
                        name=fan_name,
                        read_source=pTable['read_source']['sysfs'])
            if 'util' in pTable['read_source']:
                if 'write_source' in pTable:
                    self.source = FscSensorSourceUtil(
                        name=fan_name,
                        read_source=pTable['read_source']['util'],
                        write_source=pTable['write_source']['util'])
                else:
                    self.source = FscSensorSourceUtil(
                        name=fan_name,
                        read_source=pTable['read_source']['util'])
        except Exception:
            Logger.error("Unknown Fan source type")
    def __init__(self, fan_name, pTable):
        try:
            self.fan_num = int(fan_name)
            if "label" in pTable:
                self.label = pTable["label"]
            else:
                self.label = "Fan %d" % (self.fan_num)

            if "sysfs" in pTable["read_source"]:
                if "write_source" in pTable:
                    self.source = FscSensorSourceSysfs(
                        name=fan_name,
                        read_source=pTable["read_source"]["sysfs"],
                        write_source=pTable["write_source"]["sysfs"],
                    )
                else:
                    self.source = FscSensorSourceSysfs(
                        name=fan_name,
                        read_source=pTable["read_source"]["sysfs"])
            if "util" in pTable["read_source"]:
                if "write_source" in pTable:
                    self.source = FscSensorSourceUtil(
                        name=fan_name,
                        read_source=pTable["read_source"]["util"],
                        write_source=pTable["write_source"]["util"],
                    )
                else:
                    self.source = FscSensorSourceUtil(
                        name=fan_name,
                        read_source=pTable["read_source"]["util"])
        except Exception:
            Logger.error("Unknown Fan source type")
 def __init__(self, sensor_name, pTable):
     try:
         if "read_source" in pTable:
             if "sysfs" in pTable["read_source"]:
                 self.source = FscSensorSourceSysfs(
                     name=sensor_name,
                     read_source=pTable["read_source"]["sysfs"])
             if "util" in pTable["read_source"]:
                 self.source = FscSensorSourceUtil(
                     name=sensor_name,
                     read_source=pTable["read_source"]["util"])
     except Exception:
         Logger.error("Unknown Sensor source type")
Example #4
0
 def __init__(self, sensor_name, pTable):
     try:
         if 'read_source' in pTable:
             if 'sysfs' in pTable['read_source']:
                 self.source = FscSensorSourceSysfs(
                     name=sensor_name,
                     read_source=pTable['read_source']['sysfs'])
             if 'util' in pTable['read_source']:
                 self.source = FscSensorSourceUtil(
                     name=sensor_name,
                     read_source=pTable['read_source']['util'])
     except Exception:
         Logger.error("Unknown Sensor source type")