blob: 8eb87d1a4c2d13e2ca68ac64b326557516e68ee6 [file] [log] [blame]
James Feist053a6642018-10-15 13:17:09 -07001/*
2// Copyright (c) 2018 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16
17#pragma once
18#include <boost/container/flat_map.hpp>
19
20namespace devices
21{
22
23struct CmpStr
24{
25 bool operator()(const char *a, const char *b) const
26 {
27 return std::strcmp(a, b) < 0;
28 }
29};
30
31struct ExportTemplate
32{
33 ExportTemplate(const char *parameters, const char *device) :
34 parameters(parameters), device(device){};
35 const char *parameters;
36 const char *device;
37};
38
39const boost::container::flat_map<const char *, ExportTemplate, CmpStr>
40 exportTemplates{
41 {{"PCA9543Mux",
42 ExportTemplate("pca9543 $Address",
43 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
44 {"PCA9545Mux",
45 ExportTemplate("pca9545 $Address",
46 "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
47 {"TMP75", ExportTemplate("tmp75 $Address",
48 "/sys/bus/i2c/devices/i2c-$Bus/new_device")
49
50 },
51 {"TMP421", ExportTemplate("tmp421 $Address",
52 "/sys/bus/i2c/devices/i2c-$Bus/new_device")
53
54 }}};
55} // namespace devices