Hi Quentin,
+static int button_remap_phone_keys(int code)
+{
+    switch (code) {
+    case KEY_VOLUMEUP:
+        return KEY_UP;
+    case KEY_VOLUMEDOWN:
+        return KEY_DOWN;
+    case KEY_POWER:
+        return KEY_ENTER;
+    default:
+        return code;
+    }
+}
+

....... I suggest to make this a weak function that can be overridden by boards (should it maybe be only defined in boards C file?) so that it's easy for people to come up with their own mapping without having to deal with two people/the maintainer disagreeing with what should be the one and true mapping for that key.

This is intentionally not a board specific feature. It is a generic option that does precisely one thing: remap the keys on a phone to be useful for navigating boot menus.

If some folks have a strong disagreement about e.g. what KEY_CAMERA should be (for the devices that have it) then I would rather propose making this all configurable via an environment variable, or better yet introducing a new bootloader,code property in devicetree to define what a key should do in a bootloader.

Cheers,
Quentin

--
// Caleb (they/them)

Reply via email to