This project is a fork from UFFAF (UEFI Firmware Foundational Automation Framework) tool from Intel(R) (formerly XmlCli), unfortunately, the original project seems to be intended as a standalone tool rather than a Python module, this project aims to update the tool to make it easier to work with on any other Python project.
This module is intended to be used to read BIOS knobs and system information with an easy-to-use API.
Note
Not all the functionality of XmlCli will be ported since the scope of the projects are different, XmlCli-Module is intended to be used to read BIOS knobs and some other system information, while XmlCli can be used for several more things that are out-of-scope of this project.
This module requires XmlCli BIOS driver enabled and ROOT privileges.
Important
This is a Linux only module, there's no support for any other OS. PIP will fail to install this package on any other OS.
To use this module simply create an instance of XmlCli:
>>> # Create instance f XmlCli
>>> from xmlcli_knob import XmlCli
>>> xmlcli = XmlCli()
>>>
>>> # Read one BIOS Knob
>>> xmlcli.get_knob("WheaErrorInjSupportEn")
Knob(name='WheaErrorInjSupportEn', type='scalar', description='Enable/Disable WHEA Error Injection Support', default=0, value=1, _size='01', _offset='0x00AD')
>>>
>>> # get_kobs returns a dataclass for later usage
>>> knob = xmlcli.get_knob("WheaErrorInjSupportEn")
>>> knob.description
'Enable/Disable WHEA Error Injection Support'
>>> knob.value
1
>>>
>>> # It is possible to compare a knob (using it's name) to a value
>>> xmlcli.compare_knob("WheaErrorInjSupportEn", 0)
False
>>> xmlcli.compare_knob("WheaErrorInjSupportEn", 1)
True
>>>
>>> # The RAW xml data can be saved to a file
>>> xmlcli.save_xml_knobs("some_file.xml")
>>>
It is also possible to use execute the module as a python application, in this case the module will generate a xml with all the BIOS information:
[root@some_folder]# xmlcli -h
usage: xmlcli [-h] [-d] filename
XmlCli Module based on UFFAF to generate an xml file with Bios information
positional arguments:
filename Name of the output file
options:
-h, --help show this help message and exit
-d, --debug Enable debug messages
[root@some_folder]# xmlcli bios_data.xml
2024-10-21 15:44:28,546 [INFO] Getting BIOS information
2024-10-21 15:44:32,256 [INFO] Saving data to file 'bios_data.xml'