Make Send Command feature more flexible
The sendOemCommand command, used to send NCSI_CMD_SEND_CMD payloads,
is hardcoded to only send one command.
Update the sendOemCommand function to allow the sub-operation to be
passed as a command line argument. This is done by prepending the
sub-operation byte to the front of the Send Cmd payload.
Doing this allows sub-operations without any payload bytes to be
called. For example "-o 0a", where the sub-operation for Send Cmd is
the 0x0a value.
Tested:
Sent 'ncsi-netlink -x 3 -p 0 -c 0 -o 50000001572100' and confirmed
the 0x50 byte worked the same way as the original hard-coded value.
Sent 'ncsi-netlink -x 3 -p 0 -c 0 -o 0a' and confirmed the 0x0a
sub-operation functioned on the submitters SUT.
Change-Id: I20f093fd8296f549fce03dc5729b8e5fedcab313
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
diff --git a/src/ncsi_util.hpp b/src/ncsi_util.hpp
index eaa076d..750f0f1 100644
--- a/src/ncsi_util.hpp
+++ b/src/ncsi_util.hpp
@@ -20,10 +20,11 @@
* @param[in] ifindex - Interface Index.
* @param[in] package - NCSI Package.
* @param[in] channel - Channel number with in the package.
+ * @param[in] opcode - NCSI Send Command sub-operation
* @param[in] payload - OEM data to send.
* @returns 0 on success and negative value for failure.
*/
-int sendOemCommand(int ifindex, int package, int channel,
+int sendOemCommand(int ifindex, int package, int channel, int opcode,
std::span<const unsigned char> payload);
/* @brief This function will ask underlying NCSI driver