Hi Armin, On Wed, 2 Oct 2024 17:02:06 +0200, Armin Wolf wrote: > OEM DMI type 178 is used by the dell-wmi-base driver to translate > WMI event scancodes into hotkey events. Include the available > information in the output of dmidecode. > > Signed-off-by: Armin Wolf <w_ar...@gmx.de> > --- > dmioem.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/dmioem.c b/dmioem.c > index 964f287..f6ade2f 100644 > --- a/dmioem.c > +++ b/dmioem.c > @@ -144,6 +144,21 @@ static void dmi_dell_bios_flags(u64 flags) > pr_attr("ACPI WMI Supported", "%s", (flags.l & (1 << 1)) ? "Yes" : > "No"); > } > > +static void dmi_dell_hotkeys(const struct dmi_header *h) > +{ > + int count = (h->length - 0x04) / 0x04; > + u8 *hotkey;
Looks good to me. I would only suggest taking a quick exit here if count is 0, so as to never print an empty list. > + > + pr_list_start("Hotkey Mappings", NULL); > + for (int i = 0; i < count; i++) > + { > + hotkey = h->data + 0x04 + 0x04 * i; You could also initialize hotkey to h->data + 0x04 before the loop, and do hotkey += 0x04 after every iteration. This saves a multiplication and an addition per iteration, so should be slightly faster. > + pr_list_item("Scancode 0x%04hx -> Keycode 0x%04hx", > + WORD(hotkey + 0x00), WORD(hotkey + 0x02)); > + } > + pr_list_end(); > +} > + > static void dmi_dell_indexed_io_access(const struct dmi_header *h) > { > static const char *checksum_types[] = { > @@ -225,6 +240,11 @@ static int dmi_decode_dell(const struct dmi_header *h) > dmi_dell_bios_flags(QWORD(data + 0x04)); > break; > > + case 178: > + pr_handle_name("Dell Hotkeys"); > + dmi_dell_hotkeys(h); > + break; > + > case 212: > pr_handle_name("Dell Indexed I/O Access"); > if (h->length < 0x0C) break; Thanks, -- Jean Delvare SUSE L3 Support