MRW changes for non-sensor sensors
Resolves openbmc/openbmc#1558
Added change to take additional parameters from input yaml
and get the path from input yaml if there is no proper
inventory path available.
Change-Id: I495ea16f9caea4fa911b0212c7edf55bfcb26b0f
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/gen_ipmi_sensor.pl b/gen_ipmi_sensor.pl
index 8dceaf4..a54341e 100755
--- a/gen_ipmi_sensor.pl
+++ b/gen_ipmi_sensor.pl
@@ -105,13 +105,18 @@
$obmcPath = Util::getObmcName(\@inventory,$path);
#if unable to get the obmc path then get from yaml
if (not defined $obmcPath) {
- my @pathelements =split(/\//,$path);
- foreach my $elem (@pathelements) {
- #split element-instance_number
- my ($elemName,$elemNum) = split(/-([^-]+)$/,$elem);
- if((defined $elemName) and ($elemName eq "proc_socket")) {
- $obmcPath = $sensorTypeConfig->{$sensorType}->{"path"}."occ".$elemNum;
- last;
+ if ($path eq "/sys-0") {
+ $obmcPath = $sensorTypeConfig->{$sensorType}->{"path"};
+ }
+ else {
+ my @pathelements =split(/\//,$path);
+ foreach my $elem (@pathelements) {
+ #split element-instance_number
+ my ($elemName,$elemNum) = split(/-([^-]+)$/,$elem);
+ if ((defined $elemName) and ($elemName eq "proc_socket")) {
+ $obmcPath = $sensorTypeConfig->{$sensorType}->{"path"}."occ".$elemNum;
+ last;
+ }
}
}
}
@@ -144,6 +149,12 @@
print $fh " sensorReadingType: ".$sensorReadingType."\n";
print $fh " updateInterface: ".$sensorTypeConfig->{$sensorType}->{"updateInterface"}."\n";
+ if (defined($sensorTypeConfig->{$sensorType}->{"readingType"})) {
+ print $fh " readingType: ".$sensorTypeConfig->{$sensorType}->{"readingType"}."\n";
+ }
+ if (defined($sensorTypeConfig->{$sensorType}->{"byteOffset"})) {
+ print $fh " byteOffset: ".$sensorTypeConfig->{$sensorType}->{"byteOffset"}."\n";
+ }
print $fh " interfaces:"."\n";
my $interfaces = $sensorTypeConfig->{$sensorType}->{"interfaces"};