1#!/bin/sh
2# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
3# Script to generate valid Sensors dbus path list.          #
4# To run this script, copy to BMC home or tmp directory     #
5# Power on the system to Runtime and then execute:          #
6# sh sensor.sh                                              #
7# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
8
9dbus_obj="xyz.openbmc_project.HwmonTempSensor xyz.openbmc_project.ADCSensor xyz.openbmc_project.VirtualSensor"
10
11for dobj in $dbus_obj
12do
13    echo DBUS object:$dobj
14    dbus_cmd_out=`busctl tree $dobj --list | grep /sensors/`
15
16    for i in $dbus_cmd_out
17    do
18        exist=`busctl introspect $dobj $i | grep yz.openbmc_project.Sensor.Value`
19        if [ ! -z "$exist" ]; then
20            cmd_value=` busctl get-property $dobj $i xyz.openbmc_project.Sensor.Value Value`
21            echo $i Value=${cmd_value##*d}
22        fi
23    done
24done
25