Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Asked
Viewed 2k times
2

In my embedded linux system, I defined some GPIOs as keys in the device tree so I can use them as keys in my application. This works fine so far.

Now I want to add an early startup script to respond to one of those keys before my application starts, but I can't access the gpios via /sys/class/gpio anymore, because they are already keys (trying to export them gives write error: Device or resource busy).

I could install evtest or simply read /dev/input/event0 where I can see key presses and releases, but I can't see a straight forward way to detect a long key press that way in a shell script. Any suggestion how this should be done?

2
  • Maybe this is related? stackoverflow.com/questions/5060710/format-of-dev-input-event
    gerhard d.
    –  gerhard d.
    2022-05-13 09:04:36 +00:00
    Commented May 13, 2022 at 9:04
  • @gerhardd. Thank you, I'm able to extract the wanted key and whether this is a press or release, just in a shell script I would need to read that device file with half a second timeout after my key was pressed to detect a long press. which seems like an extremely ugly approach.
    Philippos
    –  Philippos
    2022-05-13 10:04:44 +00:00
    Commented May 13, 2022 at 10:04

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.