openwrt / openwrt/packages

triggerhappy: triggerhappy handles event 2 times

Open
#23,474 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Makefile
Stars
4.6k
Forks
4k
Avg merge
3d 12h
Merged PRs (30d)
134

Description

Maintainer: @thess
Environment: (armv7l, custom, OpenWrt 22.03.5)

Description:
thriggerhappy handles event 2 times
When testing event with command thd --dump /dev/input/event* I correctly see the press, longpress and release, but when I attach a command to an event with the configuration file I see the event is fired 2 times.

Step to reproduce:

  1. Using command thd --dump /dev/input/event* find a suitable key for test, in my case KEY_HOME
  2. create a new file under /etc/triggerhappy/triggers.d/ and call it test.conf
  3. Inside the new created file add teh line KEY_HOME 1 /root/keyLogger.sh
  4. create a new file inside /root and call it keyLogger.sh
  5. Inside the new file add this block of code
#!/bin/ash
COUNT_FILE=/tmp/cnt.txt
BTN_PRESS=0

check_previous_pressions() {
        if test -f "$COUNT_FILE"; then
                BTN_PRESS=$(cat $COUNT_FILE)
        else
                touch "$STATUS_FILE"
        fi
        #echo "$BTN_PRESS"
}

check_previous_pressions

BTN_PRESS=$(( BTN_PRESS+1 ))

echo "$BTN_PRESS" > "$COUNT_FILE"
  1. save the file and make it executable with chmod +x <name of the file>
  2. reboot the system
  3. After reboot check the contnent of the file /tmp/cnt.txt, every pression of the test key (in my case KEY_HOME) the counter increase by 2

The problem seems to be releted to the 2 files of the repo

  • utils/triggerhappy/files/triggerhappy.init
  • utils/triggerhappy/files/triggerhappy.hotplug

The init file attach all event found at boot time, then the hotplug file re-attach things

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading utils/triggerhappy/files/triggerhappy.init and utils/triggerhappy/files/triggerhappy.hotplug, then compare how each attaches input events during boot and hotplug. Reproduce with thd --dump /dev/input/event*, the test.conf KEY_HOME entry, and the provided keyLogger.sh script. Done means each key press increments /tmp/cnt.txt once rather than twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, shell
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.