input: kbd_matrix: skip column with empty mask

The active key mask can be used for supporting multiple keyboard layouts
with a single firmware. A possible use case is to support keyboard with
or without a numpad, in which case an entire set of columns may be
missing. Add a check to detect this condition and skip scanning that
column entirely if no keys are defined in it.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2024-01-05 15:00:02 +00:00 committed by Alberto Escolar
commit ad9f2c599b

View file

@ -88,6 +88,11 @@ static bool input_kbd_matrix_scan(const struct device *dev)
kbd_row_t key_event = 0U;
for (int col = 0; col < cfg->col_size; col++) {
if (cfg->actual_key_mask != NULL &&
cfg->actual_key_mask[col] == 0) {
continue;
}
input_kbd_matrix_drive_column(dev, col);
/* Allow the matrix to stabilize before reading it */