mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-11-01 18:58:20 +00:00
Fix unprintable model and serial numbers.
Some systems support model and serial numbers for their fans and psus but they might not be programmed correctly. This fix uses the printable string datatype to make sure the result can be marshalled by other tools.
This commit is contained in:
@@ -310,10 +310,10 @@ onlp_fan_show(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags)
|
||||
else {
|
||||
iof_iprintf(&iof, "Status: Running");
|
||||
if(fi.model[0]) {
|
||||
iof_iprintf(&iof, "Model: %s", fi.model);
|
||||
iof_iprintf(&iof, "Model: %{pstr}", fi.model, '?');
|
||||
}
|
||||
if(fi.serial[0]) {
|
||||
iof_iprintf(&iof, "SN: %s", fi.serial);
|
||||
iof_iprintf(&iof, "SN: %{pstr}", fi.serial, '?');
|
||||
}
|
||||
if(fi.caps & ONLP_FAN_CAPS_GET_RPM) {
|
||||
iof_iprintf(&iof, "RPM: %d", fi.rpm);
|
||||
@@ -336,4 +336,3 @@ onlp_fan_show(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags)
|
||||
}
|
||||
iof_pop(&iof);
|
||||
}
|
||||
|
||||
|
||||
@@ -196,8 +196,8 @@ onlp_psu_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags)
|
||||
}
|
||||
else {
|
||||
iof_iprintf(&iof, "Status: Running");
|
||||
if(pi.model[0]) iof_iprintf(&iof, "Model: %s", pi.model);
|
||||
if(pi.serial[0]) iof_iprintf(&iof, "SN: %s", pi.serial);
|
||||
if(pi.model[0]) iof_iprintf(&iof, "Model: %{pstr}", pi.model, '?');
|
||||
if(pi.serial[0]) iof_iprintf(&iof, "SN: %{pstr}", pi.serial, '?');
|
||||
if(pi.caps & ONLP_PSU_CAPS_AC) {
|
||||
iof_iprintf(&iof, "Type: AC");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user