Add cmdpad (#2979)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@10135 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2008-01-06 13:44:36 +00:00
parent 577695f3e4
commit 39a8588d75
4 changed files with 119 additions and 0 deletions

57
utils/cmdpad/Makefile Normal file
View File

@ -0,0 +1,57 @@
#
# Copyright (C) 2007 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: $
include $(TOPDIR)/rules.mk
PKG_NAME:=cmdpad
PKG_VERSION:=0.0.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=http://prdownloads.sourceforge.net/cmdpad/
PKG_MD5SUM:=6633b2354b7f23f9cd8e2bfb6e735965
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
include $(INCLUDE_DIR)/package.mk
define Package/cmdpad
SECTION:=utils
CATEGORY:=Utilities
TITLE:=execute commands when a key is pressed, released or hold down
URL:=http://cmdpad.sourceforge.net/index.php
endef
CONFIGURE_ARGS += \
--enable-static \
--enable-shared
define Package/cmdpad/description
cmdpad - execute commands when a key is pressed, released or hold down.
Should be started from /etc/rc or /etc/rc.local. To run it as deamon you
need to start it with '&'. All logs are printed to standard out and standard
error (to write the log to disk use cmdpad > /var/log/cmdpad). Cmdpad
searches for /etc/cmdpad.conf and load the key bindings. Then wait for
key event and check each command to see if it should be run.
endef
MAKE_FLAGS += \
$(TARGET_CONFIGURE_OPTS) \
$(1)
define Package/cmdpad/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/cmdpad $(1)/usr/sbin
$(INSTALL_CONF) $(PKG_BUILD_DIR)/src/cmdpad.conf $(1)/etc
$(INSTALL_BIN) ./files/cmdpad.init $(1)/etc/init.d/cmdpad
endef
$(eval $(call BuildPackage,cmdpad))

View File

@ -0,0 +1,12 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2007 OpenWrt.org
START=93
start() {
/usr/sbin/cmdpad --quiet > /dev/null &
}
stop() {
killall cmdpad
}

View File

@ -0,0 +1,35 @@
--- cmdpad-0.0.3/src/Makefile.orig 2008-01-05 23:29:44.000000000 +0100
+++ cmdpad-0.0.3/src/Makefile 2008-01-05 23:30:23.000000000 +0100
@@ -5,25 +5,25 @@
TOP=..
include $(TOP)/Makefile.common
-INCLUDE= -I/usr/include
-LIBS= -L/usr/lib -lc
-CFLAGS= -g3
-LDFLAGS= -Xlinker -Map -Xlinker $(PROG).map #,--stack,16Mb
+#INCLUDE= -I/usr/include
+#LIBS= -L/usr/lib -lc
+#CFLAGS= -g3
+#LDFLAGS= -Xlinker -Map -Xlinker $(PROG).map #,--stack,16Mb
OBJ= main.o command.o parse.o
SCRIPTS= *.sh
build: $(PROG)
$(PROG): $(OBJ)
- gcc -o $(PROG) $(OBJ) $(LIBS) $(LDFLAGS)
+ $(GCC) -o $(PROG) $(OBJ) $(LIBS) $(LDFLAGS)
@echo "==============================================="
@echo "edit $(PROG).conf file to set default preferences"
%.o : %.c
- gcc $(CFLAGS) -D__COPYLEFT__='$(COPYLEFT)' -c $<
+ $(GCC) $(CFLAGS) -D__COPYLEFT__='$(COPYLEFT)' -c $<
%.o : %.c %.h
- gcc $(CFLAGS) -D__COPYLEFT__='$(COPYLEFT)' -c $<
+ $(GCC) $(CFLAGS) -D__COPYLEFT__='$(COPYLEFT)' -c $<
distclean clean:
rm $(PROG) *~ *.o -vf

View File

@ -0,0 +1,15 @@
--- cmdpad-0.0.3/src/parse.orig 2008-01-05 23:55:32.000000000 +0100
+++ cmdpad-0.0.3/src/parse.c 2008-01-05 23:56:07.000000000 +0100
@@ -289,6 +289,12 @@
pchEventDevice = strdup( pchValue) ;
return 1 ;
}
+ if( (pchValue != NULL) &&
+ (strncmp( pchValue, "/dev/event", 6) == 0) )
+ {
+ pchEventDevice = strdup( pchValue) ;
+ return 1 ;
+ }
printf( "Option 'device' expects a /dev/input/eventX argument\n");
return -1 ;
}