lazybios 3.0.0
Lightweight SMBIOS/DMI parsing library
Loading...
Searching...
No Matches
Type 22: Portable Battery Guide

Portable battery identity, electrical characteristics, and SBDS data.

Result set and ownership

lazybiosGetType22 returns a lazybiosType22Array_t holding every matching structure. Iterate entries using count. A non-NULL result whose count is zero means the table contains no structure of this type; NULL means the arguments were unusable or an allocation failed. Release the set with lazybiosFreeType22, or assign it to ctx->Type22 and let lazybiosCleanup own it.

Every record carries its own SMBIOS handle and the structure length the firmware reported.

Encoded fields are decoded during parsing into decoded, which mirrors the raw member names (design_capacity, device_chemistry). The raw value stays alongside it, so both the encoding and its meaning are available.

Identity and chemistry

The location, manufacturer, manufacture date, serial number, device name, and SBDS version fields use the SMBIOS string set. Decode device_chemistry with decoded.device_chemistry. For an SMBIOS 2.2 Smart Battery, a zero manufacture-date or serial-number string index selects its corresponding packed SBDS field. An Unknown device chemistry selects sbds_device_chemistry when that string is supplied. The packed serial number, packed date, and SBDS chemistry fields report absent when their respective selector does not make them valid.

Capacity, voltage, and error

design_capacity is measured in mWh and zero means unknown. In SMBIOS 2.2 and later, multiply it by design_capacity_multiplier; use decoded.design_capacity for this calculation. design_voltage is measured in mV and zero means unknown. A maximum_error value of 0xFF means unknown rather than unavailable.

Packed manufacture date

sbds_manufacture_date stores a year biased by 1980, a month, and a day in one 16-bit value. decoded.sbds_manufacture_date formats a valid value as YYYY-MM-DD and reports an out-of-range month or day as invalid.

Ownership

Release the returned array and all contained strings with lazybiosFreeType22, or assign it to lazybiosCTX::Type22 and use lazybiosCleanup.

See also
Type 22: Portable Battery