Get PSU version from vendor specific tool
The code was getting the version from PSU inventory object.
This commit changes the behavior to use a vendor-specific tool to get
the version directly, where the tool is expected to be configured during
build time.
Add an example get_version app that shows the expected behavior of the
tool:
* It accepts an argument of PSU inventory object;
* It outputs the version to stdout.
Tested: 1. Put and configure to use the example get_version on witherspoon,
verify that PSU software objects are created with the version
returned by the exmaple tool.
2. With the Witherspoon specific tool in
https://gerrit.openbmc-project.xyz/c/openbmc/witherspoon-pfault-analysis/+/24811,
verify the version is correctly got from the PSU inventory path
and the software objects are created.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I5195cb6fc8998a76b09abcfe0b107364cb180c01
diff --git a/meson_options.txt b/meson_options.txt
index e5297cf..1509ac2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,6 @@
option('tests', type: 'feature', description: 'Build tests')
option('oe-sdk', type: 'feature', description: 'Enable OE SDK')
+option('examples', type: 'boolean', value: true, description: 'Build vendor-example')
option('MANIFEST_FILE',
type: 'string',
@@ -15,3 +16,14 @@
type: 'string',
value: '/xyz/openbmc_project/inventory/system',
description: 'The base path for PSU inventory')
+
+
+# The PSU_VERSION_UTIL specifies an executable that accepts the PSU
+# inventory path as input, and output the version string, e.g
+# psutils get-version /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0
+# or in vendor-example
+# get-version <some-psu-path>
+option('PSU_VERSION_UTIL',
+ type: 'string',
+ value: '/usr/bin/psutils --getversion',
+ description: 'The command and arguments to get PSU version')