blob: 0b78a242dabbb1ca2cc0f0b04a3a9fdd9f430ab3 [file] [log] [blame]
// Copyright 2015 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THERMALD_HWMON_TEMPERATURE_SENSOR_H_
#define THERMALD_HWMON_TEMPERATURE_SENSOR_H_
#include <string>
#include "base/files/file_path.h"
#include "base/macros.h"
#include "thermald/temperature_sensor_common.h"
namespace thermald {
// Class to read the temperature from a Linux hwmon sensor:
//
// https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
class HwmonTemperatureSensor : public TemperatureSensorCommon {
public:
// Construct a hwmon sensor with a custom name.
HwmonTemperatureSensor(int hwmon_dev_id, int sensor_id,
const std::string &name);
// Construct a hwmon sensor with the default name.
// The name of the sensor will be hwmon<dev id>.temp<sensor id>
HwmonTemperatureSensor(int hwmon_dev_id, int sensor_id);
// Read the temperature from the sensor.
bool ReadTemperature(int *value) override;
private:
const base::FilePath sysfs_attr_input_;
DISALLOW_COPY_AND_ASSIGN(HwmonTemperatureSensor);
};
} // namespace thermald
#endif // THERMALD_HWMON_TEMPERATURE_SENSOR_H_