triggerhappy: triggerhappy handles event 2 times
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:
- Using command
thd --dump /dev/input/event*find a suitable key for test, in my case KEY_HOME - create a new file under
/etc/triggerhappy/triggers.d/and call ittest.conf - Inside the new created file add teh line
KEY_HOME 1 /root/keyLogger.sh - create a new file inside
/rootand call itkeyLogger.sh - 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"
- save the file and make it executable with
chmod +x <name of the file> - reboot the system
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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