Import triggerhappy from oldpackages, update copyright, license and pkg info

Signed-off-by: Ted Hess <thess@kitschensync.net>
This commit is contained in:
Ted Hess 2014-07-18 16:37:27 -04:00
parent 9df311619c
commit e217ab6931
5 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,58 @@
#
# Copyright (C) 2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=triggerhappy
PKG_VERSION:=0.3.4
PKG_REV:=649bf670a012558393d7c41f3660d0a017edd982
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=git://github.com/wertarbyte/triggerhappy
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
PKG_LICENSE:=GPL-3.0+
PKG_LICENSE_FILE:=COPYING
include $(INCLUDE_DIR)/package.mk
define Package/triggerhappy
SECTION:=utils
CATEGORY:=Utilities
TITLE:=handle input events and run configured programs
URL:=http://github.com/wertarbyte/triggerhappy
endef
define Package/triggerhappy/description
triggerhappy - handle input events and run configured programs
The daemon thd can handle hotplugged input devices and is configured through
simple configuration files in /etc/triggerhappy/triggers.d/.
endef
MAKE_FLAGS += \
$(TARGET_CONFIGURE_OPTS) \
$(1)
define Package/triggerhappy/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/triggerhappy
$(INSTALL_DIR) $(1)/etc/triggerhappy/triggers.d/
$(INSTALL_DIR) $(1)/etc/hotplug.d/input/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/thd $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/th-cmd $(1)/usr/sbin
$(INSTALL_BIN) ./files/triggerhappy.init $(1)/etc/init.d/triggerhappy
$(INSTALL_BIN) ./files/triggerhappy.hotplug $(1)/etc/hotplug.d/input/10-triggerhappy
$(INSTALL_BIN) ./files/triggerhappy-example.conf $(1)/etc/triggerhappy/triggers.d/example.conf
endef
$(eval $(call BuildPackage,triggerhappy))

View File

@ -0,0 +1,14 @@
# This is an example configuration for the triggerhappy daemon (thd)
# please note that every file to be processed must end in ".conf"
#
# To view a list of supported event codes, use "thd --listevents" or
# "thd --dump /dev/input/event*"
#
# Format:
# <eventcode> <value> <command>
#
# values for key events are 1 (pressed), 0 (released) or 2 (held)
#
## control an mpd instance
# KEY_NEXTSONG 1 /usr/bin/mpc next
# KEY_PREVSONG 1 /usr/bin/mpc prev

View File

@ -0,0 +1,15 @@
#!/bin/sh
THD_SOCKET=/tmp/triggerhappy.socket
[ -S "$THD_SOCKET" ] || exit
case "$ACTION" in
add)
DEVICE="/dev/$DEVNAME"
[ -c "$DEVICE" ] || exit
# offer device to triggerhappy daemon
/usr/sbin/th-cmd --socket "$THD_SOCKET" --add "$DEVICE"
;;
remove)
# nothing to do
;;
esac

View File

@ -0,0 +1,10 @@
#!/bin/sh /etc/rc.common
START=93
start() {
/usr/sbin/thd --socket /tmp/triggerhappy.socket --triggers /etc/triggerhappy/triggers.d/ --daemon /dev/input/event*
}
stop() {
/usr/sbin/th-cmd --socket /tmp/triggerhappy.socket --quit
}

View File

@ -0,0 +1,11 @@
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ THCMD_COMPS := th-cmd cmdsocket
MAKEDEPEND = $(CC) -M -MG $(CPPFLAGS) -o $*.d $<
-LINUX_INPUT_H := $(shell echo '\#include <linux/input.h>' | $(CC) $(CPPFLAGS) -M -E - | awk 'NR==1 {print $$2}')
+LINUX_INPUT_H := $(shell for i in `echo | $(CC) $(CPPFLAGS) -M -E -include 'linux/input.h' -`; do test -f "$$i" && echo "$$i" && break; done)
all: thd th-cmd man