input: Supersede input_key_get_status() with input_is_key_pressed()
Status from this message: Applied, thanks!
Get series with b4
b4 am [email protected] change-id 20260507-input_is_key_pressed-4472a8a29980Versions newest first
- v2 Latest2 patches 1 replyApplied
- v12 patches 0 repliesSuperseded
Changes in v2 from the cover letter
- make the loop over input_devices a bit more idiomatic
- Link to v1: https://lore.barebox.org/barebox/[email protected]
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | input: add input_is_key_pressed() to read single keydrivers/ include/ | +15 | 0 replies | |
| 2/2 | ARM: boards: protonic-imx6: use input_is_key_pressed()arch/ | +1 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/2] input: Supersede input_key_get_status() with input_is_key_pressed()
Reading a GPIO button via gpio-keys can be preferable over direct GPIO access as gpio-keys abstracts away from GPIO hardware via the devicetree, consistently across barebox and linux.
Trying to read a single key state analogous to prt_imx6_init_prtvt7 failed as input_key_get_status should have been provided with the keycode in question plus one to ensure a large enough bitfield to contain the desired key state.
The correct way of reading a single key state via the input_key_get_status() interface is as complicated as
bool is_button_pressed(int key) {
unsigned long *keys;
bool pressed;
keys = bitmap_xzalloc(key + 1);
input_key_get_status(keys, key + 1);
pressed = test_bit(key, keys);
free(keys);
return pressed;}
This series implements a simple way to read the state of a single key directly in the input driver.
As this can easily be invoked twice to check for a key combination, replace this single occurence of input_key_get_status() with input_is_key_pressed().
While those changes where thoroughly tested on a board with boardcode very similar to protonic-imx6, the change to protonic-imx6 itself is untested.
I suppose we have to keep input_key_get_status() for now for backwards compatibility with downstream board code?
---
Changes in v2:
- make the loop over input_devices a bit more idiomatic
- Link to v1: https://lore.barebox.org/barebox/[email protected]
---
Jonas Rebmann (2):
input: add input_is_key_pressed() to read single key
ARM: boards: protonic-imx6: use input_is_key_pressed()
arch/arm/boards/protonic-imx6/board.c | 8 +------- drivers/input/input.c | 14 ++++++++++++++ include/input/input.h | 1 + 3 files changed, 16 insertions(+), 7 deletions(-)
---
base-commit: 7a178f01f6e25474a5eb6e071ca479076b8d4d92
change-id: 20260507-input_is_key_pressed-4472a8a29980
Best regards,
Signature · 1 line
Jonas Rebmann <[email protected]>