Message ID | 1328017425-12017-1-git-send-email-alex.hung@canonical.com |
---|---|
State | Rejected |
Headers | show |
On 31/01/12 13:43, Alex Hung wrote: > Signed-off-by: Alex Hung<alex.hung@canonical.com> > --- > src/dmi/dmi_decode/dmi_decode.c | 14 ++++++++++++-- > 1 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/src/dmi/dmi_decode/dmi_decode.c b/src/dmi/dmi_decode/dmi_decode.c > index 00565d6..c922ee4 100644 > --- a/src/dmi/dmi_decode/dmi_decode.c > +++ b/src/dmi/dmi_decode/dmi_decode.c > @@ -49,6 +49,7 @@ > #define DMI_ILLEGAL_MAPPED_ADDR_RANGE "DMIIllegalMappedAddrRange" > #define DMI_MGMT_CTRL_HOST_TYPE "DMIMgmtCtrlHostType" > #define DMI_INVALID_ENTRY_LENGTH "DMIInvalidEntryLength" > +#define DMI_INVALID_HARDWARE_ENTRY "DMIInvalidHardwareEntry" > Once this patch is accepted please make sure to add DMIInvalidHardwareEntry to the table in https://wiki.ubuntu.com/Kernel/Reference/fwts/dmi_decode > #define GET_UINT16(x) (uint16_t)(*(const uint16_t *)(x)) > #define GET_UINT32(x) (uint32_t)(*(const uint32_t *)(x)) > @@ -241,6 +242,8 @@ static void dmi_decode_entry(fwts_framework *fw, > int i; > int len; > int failed_count = fw->minor_tests.failed; > + int battery_count; > + int ret; > > switch (hdr->type) { > case 0: /* 7.1 */ > @@ -644,7 +647,7 @@ static void dmi_decode_entry(fwts_framework *fw, > "(range allowed 0x01..0x08, 0xa0..0xa2) " > "while accessing '%s', field '%s', offset 0x%2.2x", > data[0x5], table, "Interface", 0x5); > -} > + } > break; > > case 22: /* 7.23 */ > @@ -666,8 +669,15 @@ static void dmi_decode_entry(fwts_framework *fw, > break; > if (data[0x09] == 0x02) > dmi_str_check(fw, table, addr, "SBDS Device Chemistry", hdr, 0x14); > - break; > > + ret = fwts_battery_get_count(fw,&battery_count); > + if (ret != FWTS_OK || battery_count< 1) { > + fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_INVALID_HARDWARE_ENTRY, > + "Invalid Hardware Configuration " > + "(no battery found at '%s') ", > + FWTS_PROC_ACPI_BATTERY); Looks, OK, however, sorry to be pedantic, but informing the user at the battery has not been found at FWTS_PROC_ACPI_BATTERY is not entirely correct. This interface will be deprecated in the future (replaced by FWTS_SYS_CLASS_POWER_SUPPLY). Perhaps it is best to just state: "(no battery found)". > + } > + break; > case 23: /* 7.24 */ > table = "System Reset (Type 23)"; > if (hdr->length< 0x0D)
diff --git a/src/dmi/dmi_decode/dmi_decode.c b/src/dmi/dmi_decode/dmi_decode.c index 00565d6..c922ee4 100644 --- a/src/dmi/dmi_decode/dmi_decode.c +++ b/src/dmi/dmi_decode/dmi_decode.c @@ -49,6 +49,7 @@ #define DMI_ILLEGAL_MAPPED_ADDR_RANGE "DMIIllegalMappedAddrRange" #define DMI_MGMT_CTRL_HOST_TYPE "DMIMgmtCtrlHostType" #define DMI_INVALID_ENTRY_LENGTH "DMIInvalidEntryLength" +#define DMI_INVALID_HARDWARE_ENTRY "DMIInvalidHardwareEntry" #define GET_UINT16(x) (uint16_t)(*(const uint16_t *)(x)) #define GET_UINT32(x) (uint32_t)(*(const uint32_t *)(x)) @@ -241,6 +242,8 @@ static void dmi_decode_entry(fwts_framework *fw, int i; int len; int failed_count = fw->minor_tests.failed; + int battery_count; + int ret; switch (hdr->type) { case 0: /* 7.1 */ @@ -644,7 +647,7 @@ static void dmi_decode_entry(fwts_framework *fw, "(range allowed 0x01..0x08, 0xa0..0xa2) " "while accessing '%s', field '%s', offset 0x%2.2x", data[0x5], table, "Interface", 0x5); -} + } break; case 22: /* 7.23 */ @@ -666,8 +669,15 @@ static void dmi_decode_entry(fwts_framework *fw, break; if (data[0x09] == 0x02) dmi_str_check(fw, table, addr, "SBDS Device Chemistry", hdr, 0x14); - break; + ret = fwts_battery_get_count(fw, &battery_count); + if (ret != FWTS_OK || battery_count < 1) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, DMI_INVALID_HARDWARE_ENTRY, + "Invalid Hardware Configuration " + "(no battery found at '%s') ", + FWTS_PROC_ACPI_BATTERY); + } + break; case 23: /* 7.24 */ table = "System Reset (Type 23)"; if (hdr->length < 0x0D)
Signed-off-by: Alex Hung <alex.hung@canonical.com> --- src/dmi/dmi_decode/dmi_decode.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)