Attention is currently required from: Dinesh Gehlot, Intel coreboot Reviewers, Jayvik Desai, Jérémy Compostella, Kapil Porwal, Karthik Ramasubramanian, Nick Vaccaro, Subrata Banik.
Julius Werner has posted comments on this change by Subrata Banik. ( https://review.coreboot.org/c/coreboot/+/86224?usp=email )
Change subject: soc/intel/alderlake: Display low battery message on screen ......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS2:
Okay, fair enough... […]
You could put this into the locales API but you would have to do string matching, e.g. replace every `return NULL` in there with a `return default_message(name);` and then implement a ``` const char *default_message(const char *name) { if (strcmp("memory_training_desc", name) == 0) return "Your device is finishing..."; if (strcmp("low_battery_desc", name) == 0) return "Battery critically low..."; return "Trying to display unknown message?"; } ``` Actually, it would also be good if we didn't open-code those name strings (like `"memory_training_desc"`) multiple times throughout our sources (that's just a recipe for typos). So I think the best option would be to create an enum for those, e.g. ``` enum ux_locale_msg { UX_LOCALE_MSG_MEMORY_TRAINING, UX_LOCALE_MSG_LOW_BATTERY, }; ``` and then you change the interface from ux_locales_get_text() to take in that enum instead of a string. And then translate it into a string only inside the function: ``` const char *ux_locales_get_text(enum ux_locale_msg msg) { const char *fallback_text; const char *name;
switch (msg) { case UX_LOCALE_MSG_MEMORY_TRAINING: fallback_text = "Your device is finishing..."; name = "memory_training_desc"; case UX_LOCALE_MSG_LOW_BATTERY: fallback_text = "Battery critically low..."; name = "low_battery_desc"; default: return "Trying to display unknown message?"; } ... ``` and then keep the rest of the function the same, just replace every `return NULL` with `return fallback_text`.