summaryrefslogtreecommitdiff
path: root/community/inputattach
diff options
context:
space:
mode:
Diffstat (limited to 'community/inputattach')
-rw-r--r--community/inputattach/0001-Add-w8001-flag.patch27
-rw-r--r--community/inputattach/0002-Allow-for-custom-baud-rates.patch70
-rw-r--r--community/inputattach/PKGBUILD42
-rw-r--r--community/inputattach/inputattach.conf.d13
-rw-r--r--community/inputattach/inputattach.install11
-rw-r--r--community/inputattach/inputattach.rc.d49
6 files changed, 153 insertions, 59 deletions
diff --git a/community/inputattach/0001-Add-w8001-flag.patch b/community/inputattach/0001-Add-w8001-flag.patch
new file mode 100644
index 000000000..ba6f9394b
--- /dev/null
+++ b/community/inputattach/0001-Add-w8001-flag.patch
@@ -0,0 +1,27 @@
+From 729257077e328e0b2fa1bba5a5509c09a743d5d0 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Tue, 13 Jul 2010 11:49:47 +1000
+Subject: [PATCH 2/3] Add w8001 flag for serial Wacom devices.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+---
+ inputattach.c | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/inputattach.c b/inputattach.c
+index a7de302..0382954 100644
+--- a/inputattach.c
++++ b/inputattach.c
+@@ -495,6 +495,9 @@ static struct input_types input_types[] = {
+ { "--dump", "-dump", "Just enable device",
+ B2400, CS8,
+ 0, 0x00, 0x00, 0, dump_init },
++{ "--w8001", "-w8001", "Wacom W8001",
++ B38400, CS8,
++ SERIO_W8001, 0x00, 0x00, 0, NULL },
+ { NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL }
+ };
+
+--
+1.7.2.3
+
diff --git a/community/inputattach/0002-Allow-for-custom-baud-rates.patch b/community/inputattach/0002-Allow-for-custom-baud-rates.patch
new file mode 100644
index 000000000..78f5d19c8
--- /dev/null
+++ b/community/inputattach/0002-Allow-for-custom-baud-rates.patch
@@ -0,0 +1,70 @@
+From 5d9373f24f1b519c030024b2f36277ba9713697c Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Wed, 21 Jul 2010 14:41:04 +1000
+Subject: [PATCH 3/3] Allow for custom baud rates.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+---
+ inputattach.c | 25 ++++++++++++++++++++++++-
+ 1 files changed, 24 insertions(+), 1 deletions(-)
+
+diff --git a/inputattach.c b/inputattach.c
+index 0382954..6806fc8 100644
+--- a/inputattach.c
++++ b/inputattach.c
+@@ -506,7 +506,7 @@ static void show_help(void)
+ struct input_types *type;
+
+ puts("");
+- puts("Usage: inputattach [--daemon] <mode> <device>");
++ puts("Usage: inputattach [--daemon] [--baud <baud>] <mode> <device>");
+ puts("");
+ puts("Modes:");
+
+@@ -530,6 +530,7 @@ int main(int argc, char **argv)
+ int i;
+ char c;
+ int retval;
++ int baud = -1;
+
+ for (i = 1; i < argc; i++) {
+ if (!strcasecmp(argv[i], "--help")) {
+@@ -540,6 +541,15 @@ int main(int argc, char **argv)
+ } else if (need_device) {
+ device = argv[i];
+ need_device = 0;
++ } else if (!strcasecmp(argv[i], "--baud")) {
++ if (argc <= i + 1) {
++ show_help();
++ fprintf(stderr,
++ "inputattach: require baud rate\n");
++ return EXIT_FAILURE;
++ }
++
++ baud = atoi(argv[++i]);
+ } else {
+ if (type && type->name) {
+ fprintf(stderr,
+@@ -580,6 +590,19 @@ int main(int argc, char **argv)
+ return 1;
+ }
+
++ switch(baud) {
++ case -1: break;
++ case 2400: type->speed = B2400; break;
++ case 4800: type->speed = B4800; break;
++ case 9600: type->speed = B9600; break;
++ case 19200: type->speed = B19200; break;
++ case 38400: type->speed = B38400; break;
++ default:
++ fprintf(stderr, "inputattach: invalid baud rate '%d'\n",
++ baud);
++ return EXIT_FAILURE;
++ }
++
+ setline(fd, type->flags, type->speed);
+
+ if (type->flush)
+--
+1.7.2.3
+
diff --git a/community/inputattach/PKGBUILD b/community/inputattach/PKGBUILD
index 54b3af023..0953d0a3a 100644
--- a/community/inputattach/PKGBUILD
+++ b/community/inputattach/PKGBUILD
@@ -2,30 +2,42 @@
pkgname=inputattach
pkgver=1.24
-pkgrel=2
+pkgrel=3
pkgdesc="Attach serial mice, keyboards and other input devices to the kernel input system"
arch=('i686' 'x86_64')
url="http://linuxconsole.sourceforge.net/"
license=('GPL')
-depends=('glibc' 'bash')
+depends=('bash')
makedepends=('gcc')
-backup=(etc/conf.d/inputattach.conf)
+backup=(etc/conf.d/inputattach)
install=inputattach.install
source=('http://kernel.org/pub/linux/kernel/people/dtor/inputattach.c'
'http://kernel.org/pub/linux/kernel/people/dtor/serio-ids.h'
- 'inputattach.conf.d'
- 'inputattach.rc.d')
-md5sums=('eb595a766ca363edb3b14c25404596ce'
- '93d34d96cd3ad19ea1aeca7f68a66b4a'
- 'ca36071f8384314c037e1e8b15c63afe'
- 'd484778b0464e25b22cda89ac7fed156')
+ 'inputattach.conf.d' 'inputattach.rc.d'
+ '0001-Add-w8001-flag.patch' '0002-Allow-for-custom-baud-rates.patch')
+md5sums=('eb595a766ca363edb3b14c25404596ce' '93d34d96cd3ad19ea1aeca7f68a66b4a'
+ '7ca903e54829764c8241233af5069216' '8d62f8840a2e6457a953f667df39ef99'
+ 'f1b3ddae308351357f557cbd5c6cda81' '8f76908449cae24a95adbf0bc0a17721')
build() {
- cc $CFLAGS inputattach.c -o inputattach || return 1
+ cd "$srcdir"
- install -D -m755 inputattach $startdir/pkg/usr/sbin/inputattach && \
- install -D -m644 $startdir/src/inputattach.conf.d \
- $startdir/pkg/etc/conf.d/inputattach.conf && \
- install -D -m755 $startdir/src/inputattach.rc.d \
- $startdir/pkg/etc/rc.d/inputattach
+ # Add support for serial wacom tablets
+ patch -Np1 -i "$srcdir/0001-Add-w8001-flag.patch"
+ patch -Np1 -i "$srcdir/0002-Allow-for-custom-baud-rates.patch"
+
+ cc $CFLAGS inputattach.c -o inputattach
+}
+
+package() {
+ cd "$srcdir"
+
+ install -Dm755 inputattach \
+ "$pkgdir/usr/sbin/inputattach"
+
+ install -Dm644 $srcdir/inputattach.conf.d \
+ "$pkgdir/etc/conf.d/inputattach"
+
+ install -Dm755 $srcdir/inputattach.rc.d \
+ "$pkgdir/etc/rc.d/inputattach"
}
diff --git a/community/inputattach/inputattach.conf.d b/community/inputattach/inputattach.conf.d
index 1e04240fa..ae8d1842a 100644
--- a/community/inputattach/inputattach.conf.d
+++ b/community/inputattach/inputattach.conf.d
@@ -1,11 +1,10 @@
#
# Configuration for inputattach
#
+# IAPARAMS is an array of inputattach arguments, see 'inputattach --help'.
+# An inputattach instance will be started for each element.
-# inputattach mode - see 'inputattach --help' for list e.g. "--microsoft" for
-# 2 button Microsoft mouse
-IAMODE="--microsoft"
-
-# inputattach device - /dev file entry where device is attached e.g.
-# "/dev/ttyS0" for device attached to first system serial port
-IADEV="/dev/ttyS0"
+IAPARAMS=(
+ "--microsoft /dev/ttyS0"
+ #"--baud 9600 --w8001 /dev/ttyS1"
+)
diff --git a/community/inputattach/inputattach.install b/community/inputattach/inputattach.install
index 965958b6b..b5381e14a 100644
--- a/community/inputattach/inputattach.install
+++ b/community/inputattach/inputattach.install
@@ -1,9 +1,18 @@
## arg 1: the new package version
+
+post_upgrade() {
+ (( $(vercmp 1.24-3 $2) > 0 )) && cat <<MSG
+ATTENTION:
+ /etc/conf.d/inputattach.conf has been replaced by /etc/conf.d/inputattach
+ Make sure you adjust the new config file, which has a new format.
+MSG
+}
+
post_install() {
cat << EOF
The correct device mode and /dev device file will need to be set in
-/etc/conf.d/inputattach.conf before starting /etc/rc.d/inputattach
+/etc/conf.d/inputattach before starting /etc/rc.d/inputattach
EOF
}
diff --git a/community/inputattach/inputattach.rc.d b/community/inputattach/inputattach.rc.d
index 7f260f9f8..6b92827be 100644
--- a/community/inputattach/inputattach.rc.d
+++ b/community/inputattach/inputattach.rc.d
@@ -1,60 +1,37 @@
#!/bin/bash
-daemon_name=inputattach
-
. /etc/rc.conf
-
-. /etc/conf.d/$daemon_name.conf
-
. /etc/rc.d/functions
-
-get_pid() {
- pidof $daemon_name
-}
+. /etc/conf.d/inputattach
case "$1" in
start)
- stat_busy "Starting $daemon_name daemon"
-
- PID=`get_pid`
- if [ -z "$PID" ]; then
- [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
- # RUN
- $daemon_name --daemon $IAMODE $IADEV
- #
- if [ $? -gt 0 ]; then
+ stat_busy "Starting inputattach"
+ for param in ${IAPARAMS[@]}; do
+ if ! /usr/sbin/inputattach --daemon $param; then
stat_fail
exit 1
- else
- echo `get_pid` > /var/run/$daemon_name.pid
- add_daemon $daemon_name
- stat_done
fi
- else
- stat_fail
- exit 1
- fi
- ;;
+ done
+ add_daemon inputattach
+ stat_done
+ ;;
stop)
- stat_busy "Stopping $daemon_name daemon"
- PID=`get_pid`
- # KILL
- [ ! -z "$PID" ] && kill $PID &> /dev/null
- #
+ stat_busy "Stopping inputattach"
+ PID=`pidof -o %PPID /usr/sbin/inputattach`
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
- rm -f /var/run/$daemon_name.pid &> /dev/null
- rm_daemon $daemon_name
+ rm_daemon inputattach
stat_done
fi
;;
-
restart)
$0 stop
- sleep 3
+ sleep 1
$0 start
;;
*)