dmi_firmware_language

Synopsis

#include <opendmi/entity/firmware-language.h>

typedef struct dmi_firmware_language {
    size_t language_count;
    const char **languages;
    dmi_firmware_language_flags_t flags;
    const char *current_language;
} dmi_firmware_language_t;

Description

The dmi_firmware_language_t structure holds the decoded firmware language information structure (type 13) of SMBIOS: the languages the firmware can show its messages in, and the one which is installed.

The names of the languages come in one of two formats, which the flags of the structure tell apart (see dmi_firmware_language_flags): the long one gives an ISO 639-1 language code, an ISO 3166-1 alpha-2 territory code and an encoding, separated by vertical bars, e.g. "de|DE|iso8859-1"; the abbreviated one glues the two codes together, e.g. "deDE".

The structure is returned by dmi_entity_info for the structures of type DMI_TYPE(firmware_language), and lives as long as the context it has been decoded in.

Fields

language_count

Number of languages the firmware can install, as the structure declares it, and number of elements of languages.

languages

Names of the languages, one per string of the structure, in order; nullptr if language_count is 0. An element is nullptr if the string it refers to is missing.

flags

Flags, see dmi_firmware_language_flags. Defined since SMBIOS 2.1; the byte is reserved, and zero, in older data.

current_language

Name of the language installed, one of languages; nullptr if the structure does not carry it.

Examples

dmi_registry_t          *registry = dmi_get_registry(context);
dmi_entity_t            *entity   = dmi_registry_lookup_first(registry,
                                        DMI_TYPE(firmware_language), true);
dmi_firmware_language_t *info     = dmi_entity_info(entity,
                                        DMI_TYPE(firmware_language));

for (size_t i = 0; (info != nullptr) && (i < info->language_count); i++) {
    const char *language = info->languages[i];

    if (language == nullptr)
        continue;

    bool current = (info->current_language != nullptr) &&
                   (strcmp(language, info->current_language) == 0);

    printf("%s%s\n", language, current ? " (installed)" : "");
}

Standards

DMTF SMBIOS Specification (DSP0134), version 2.0 or newer.