mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 22:43:17 +02:00
libflashrom: Add API to get the list of supported programmers
There were no options available to obtain the list of programmers. The implementation is based on flashrom_supported_flash_chips. Arrays of constant strings are returned, and the array must be freed using flashrom_data_free. Testing: Both unit tests and CLI tools serve as libflashrom clients. All unit tests run successfully. Change-Id: Ib5275b742b849183b1fe701900040fee369a1d78 Signed-off-by: Dmitry Zhadinets <dzhadinets@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/86921 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
6ff43de0e0
commit
bc029c2f45
@ -194,6 +194,18 @@ const char *flashrom_version_info(void)
|
||||
return flashrom_version;
|
||||
}
|
||||
|
||||
const char **flashrom_supported_programmers(void)
|
||||
{
|
||||
const char **result = malloc(sizeof(char*) * (programmer_table_size + 1));
|
||||
if (!result)
|
||||
return NULL;
|
||||
for (unsigned int i = 0; i < programmer_table_size; ++i) {
|
||||
result[i] = programmer_table[i]->name;
|
||||
}
|
||||
result[programmer_table_size] = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
struct flashrom_flashchip_info *flashrom_supported_flash_chips(void)
|
||||
{
|
||||
struct flashrom_flashchip_info *supported_flashchips =
|
||||
|
Reference in New Issue
Block a user