Rename EEPROM sensor type.
Sensor type name cannot start with digits. This is because entity
manager will create an Configuration interface based on the type, which
is an illegal interface name.
Signed-off-by: Hao Jiang <jianghao@google.com>
Change-Id: I8fbcf45e6f3963a68dd8eba666924263f074bdbd
diff --git a/docs/my_first_sensors.md b/docs/my_first_sensors.md
index 44976c7..e9ebf8b 100644
--- a/docs/my_first_sensors.md
+++ b/docs/my_first_sensors.md
@@ -128,7 +128,7 @@
"Address": "$address",
"Bus": "$bus",
"Name": "$bus great eeprom",
- "Type": "24C02"
+ "Type": "EEPROM_24C02"
},
{
"Address": "0x4c",
@@ -158,7 +158,11 @@
In our example we only care about the eeprom and the temperature sensor. The
`Type` field is checked against a device export map and if it matches a known
-device, it'll attempt to install the device.
+device, it'll attempt to install the device. Be noticed that dbus only allows an
+interface name as an dot delimited string with each truncated substring starting
+with alphabets(a-z, A-Z). So the Type is intensionally renamed as EEPROM_24C02.
+It is safe to do so since Entity manager types are not required to be 1:1 with
+Linux types.
For the card found on bus 18:
diff --git a/include/devices.hpp b/include/devices.hpp
index c375b1c..50fbe63 100644
--- a/include/devices.hpp
+++ b/include/devices.hpp
@@ -39,10 +39,12 @@
const boost::container::flat_map<const char*, ExportTemplate, CmpStr>
exportTemplates{
- {{"24C02", ExportTemplate("24c02 $Address",
- "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
- {"24C64", ExportTemplate("24c64 $Address",
- "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
+ {{"EEPROM_24C02",
+ ExportTemplate("24c02 $Address",
+ "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
+ {"EEPROM_24C64",
+ ExportTemplate("24c64 $Address",
+ "/sys/bus/i2c/devices/i2c-$Bus/new_device")},
{"ADM1266",
ExportTemplate("adm1266 $Address",
"/sys/bus/i2c/devices/i2c-$Bus/new_device")},