blob: 7b31390dc910196bb7373304d9f775729a3512ad [file] [log] [blame]
/*
// Copyright (c) 2018 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/
/// \file devices.hpp
#pragma once
#include <boost/container/flat_map.hpp>
namespace devices
{
struct CmpStr
{
bool operator()(const char* a, const char* b) const
{
return std::strcmp(a, b) < 0;
}
};
struct ExportTemplate
{
ExportTemplate(const char* params, const char* dev, const char* constructor,
const char* destructor, bool createsHWMon) :
parameters(params),
devicePath(dev), add(constructor), remove(destructor),
createsHWMon(createsHWMon){};
const char* parameters;
const char* devicePath;
const char* add;
const char* remove;
bool createsHWMon;
};
const boost::container::flat_map<const char*, ExportTemplate, CmpStr>
exportTemplates{
{{"EEPROM_24C02",
ExportTemplate("24c02 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", false)},
{"EEPROM_24C64",
ExportTemplate("24c64 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", false)},
{"ADM1266",
ExportTemplate("adm1266 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", false)},
{"ADM1272",
ExportTemplate("adm1272 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", false)},
{"EEPROM",
ExportTemplate("eeprom $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", false)},
{"EMC1412",
ExportTemplate("emc1412 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"EMC1413",
ExportTemplate("emc1413 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"EMC1414",
ExportTemplate("emc1414 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"Gpio", ExportTemplate("$Index", "/sys/class/gpio", "export",
"unexport", false)},
{"INA230",
ExportTemplate("ina230 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"ISL68137",
ExportTemplate("isl68137 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"ISL68223",
ExportTemplate("isl68223 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"ISL69243",
ExportTemplate("isl69243 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"MAX16601",
ExportTemplate("max16601 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"MAX20710",
ExportTemplate("max20710 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"MAX20730",
ExportTemplate("max20730 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"MAX20734",
ExportTemplate("max20734 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"MAX20796",
ExportTemplate("max20796 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"MAX31725",
ExportTemplate("max31725 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"MAX31730",
ExportTemplate("max31730 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"MAX34440",
ExportTemplate("max34440 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"MAX34451",
ExportTemplate("max34451 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"MAX6654",
ExportTemplate("max6654 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"PCA9543Mux",
ExportTemplate("pca9543 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", false)},
{"PCA9544Mux",
ExportTemplate("pca9544 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", false)},
{"PCA9545Mux",
ExportTemplate("pca9545 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", false)},
{"PCA9546Mux",
ExportTemplate("pca9546 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", false)},
{"PCA9547Mux",
ExportTemplate("pca9547 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", false)},
{"SBTSI",
ExportTemplate("sbtsi $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"pmbus",
ExportTemplate("pmbus $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"LM95234",
ExportTemplate("lm95234 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"TMP112",
ExportTemplate("tmp112 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"TMP175",
ExportTemplate("tmp175 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"TMP421",
ExportTemplate("tmp421 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"TMP441",
ExportTemplate("tmp441 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"LM75A",
ExportTemplate("lm75a $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)},
{"TMP75",
ExportTemplate("tmp75 $Address", "/sys/bus/i2c/devices/i2c-$Bus",
"new_device", "delete_device", true)}}};
} // namespace devices