Commit 201f6e82 authored by Michael Ott's avatar Michael Ott
Browse files

Add support for parsing Little-Endian (LSB first) responses in IPMI raw commands

parent 0ae6fa60
......@@ -302,11 +302,13 @@ Explanation of the values specific for the IPMI plugin:
| ipmiversion | IPMI version to use for LAN connections (1 or 2)
| cipher | Cipher to use for IPMI 2.0 LAN connections (currently supported: 0, 1, 2, 3, 6, 7, 8, 11, 12)
| cmd | One can define a raw IPMI-command (in hex-notation) to be sent. In this case also the start and stop fields for the response have to be defined. Alternatively, one can define the record-ID of the sensor (see below).
| start | Required if raw command is sent
| stop | Required if raw command is sent
| start | Offset where the wanted return value of an IPMI raw command starts at in the IPMI response<sup>[1](#ipmifn1)</sup>
| stop | Offset where the wanted return value of an IPMI raw command stops at in the IPMI response<sup>[1](#ipmifn1)</sup>
| recordId | Define the record-ID of the sensor to be read. One can look up the corresponding record-IDs for every sensor with the "ipmi-sensors" command line tool (ships with the freeipmi-library). Alternatively, one can define a raw IPMI-command (see above).
| factor | One can specify a factor to scale the read value before it is stored in the database (to adjust precision).
#### Footnotes <a name="ipmiFootnotes"></a>
<a name="ipmifn1">**1**</a>: &ensp; Use start > stop values if response is Little-endian (LSB first), use start < stop if response is Big-Endian (MSB first). Maximum length is 8 bytes.
## Perf-event <a name="perf"></a>
The Perfevent functionality is tasked with collecting data from the CPUs various performance counters (PMUs).
......
......@@ -202,8 +202,14 @@ int64_t IPMIHost::sendRawCmd(const std::vector<uint8_t>& rawCmd,
_errorCount = 0;
int64_t val = 0;
for (i = start; i <= stop; i++) {
val |= ((int64_t) buf[i]) << (stop - i) * 8;
if (stop > start) {
for (i = start; i <= stop; i++) {
val |= ((int64_t) buf[i]) << (stop - i) * 8;
}
} else {
for (i = start; i >= stop; i--) {
val |= ((int64_t) buf[i]) << (i-stop) * 8;
}
}
return val;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment