aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorRoberto Neri <rneri@libero.it>2010-05-12 23:33:39 +0200
committerRobby Workman <rworkman@slackbuilds.org>2010-05-12 23:33:39 +0200
commit13b36e171846fd2c0ace58c1a2453b6161e88c2c (patch)
tree31b8baa9c1b6197366cf736075b5a9b965031699 /system
parent86940cc1a6c2bb311952262ad867f6f14d8dbecf (diff)
system/joystick: Added to 12.2 repository
Diffstat (limited to 'system')
-rw-r--r--system/joystick/README10
-rw-r--r--system/joystick/joystick.SlackBuild72
-rw-r--r--system/joystick/joystick.diff229
-rw-r--r--system/joystick/joystick.info8
-rw-r--r--system/joystick/slack-desc19
5 files changed, 338 insertions, 0 deletions
diff --git a/system/joystick/README b/system/joystick/README
new file mode 100644
index 0000000000000..922da3cdf4a3d
--- /dev/null
+++ b/system/joystick/README
@@ -0,0 +1,10 @@
+jscal (a joystick calibration program, not to be confused with jscalibrator),
+jstest and jsattach are 3 command-line tools which were included in Version 1
+of the Linux Joystick Driver.
+
+The included patch for jscal adds remapping axes and buttons functionality.
+
+If you wish to remap your joystick axes and/or buttons, run jscal with the -q
+option: the output is a line of text containing the "jscal -u" (remap) command
+with the current mappings, which you can save to a file and edit to suit your
+needs.
diff --git a/system/joystick/joystick.SlackBuild b/system/joystick/joystick.SlackBuild
new file mode 100644
index 0000000000000..7c73beb8bb8dd
--- /dev/null
+++ b/system/joystick/joystick.SlackBuild
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+# Slackware build script for joystick
+
+# Written by Roberto Neri <rneri@libero.it>
+
+PRGNAM=joystick
+VERSION=${VERSION:-1.2.15}
+ARCH=${ARCH:-i486}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Patch to add remapping axes and buttons functionality
+# see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=444142
+patch -i $CWD/$PRGNAM.diff -p2 --verbose
+
+make CFLAGS="$SLKCFLAGS" CPPFLAGS="" jsattach jscal jstest
+strip --strip-unneeded jsattach jscal jstest
+
+mkdir -p $PKG/usr/bin
+cp -a jsattach jscal jstest \
+ $PKG/usr/bin
+
+gzip -9 jsattach.1 jscal.1 jstest.1
+mkdir -p $PKG/usr/man/man1
+cp -a jsattach.1.gz jscal.1.gz jstest.1.gz \
+ $PKG/usr/man/man1
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ ChangeLog COPYING joystick-api.txt joystick-parport.txt joystick.txt README \
+ README-API README-parport TODO \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+chmod 644 $PKG/usr/doc/$PRGNAM-$VERSION/*
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
diff --git a/system/joystick/joystick.diff b/system/joystick/joystick.diff
new file mode 100644
index 0000000000000..37e21bd07e601
--- /dev/null
+++ b/system/joystick/joystick.diff
@@ -0,0 +1,229 @@
+Only in joystick-20051019: debian
+Only in /home/kajla/usr/src/joystick/: .svn
+diff -ur joystick-20051019/utils/jscal.c /home/kajla/usr/src/joystick/utils/jscal.c
+--- joystick-20051019/utils/jscal.c 2004-10-19 09:51:52.000000000 +0200
++++ /home/kajla/usr/src/joystick/utils/jscal.c 2007-09-26 12:56:33.000000000 +0200
+@@ -61,6 +61,8 @@
+
+ int fd;
+ struct js_corr corr[MAX_AXES];
++__u8 axmap[ABS_MAX + 1];
++__u16 buttonmap[(KEY_MAX - BTN_MISC + 1)];
+ char axes, buttons, fuzz;
+ int version;
+ struct correction_data corda[MAX_AXES];
+@@ -163,6 +165,12 @@
+ puts(" -V --version Prints the version numbers");
+ puts(" -p --print-correction Prints the current settings as a jscal");
+ puts(" command line");
++ puts(" -q --print-mappings Print the current axis and button");
++ puts(" mappings as a jscal command line");
++ puts(" -u <n_of_axes,axmap1,axmap2,...,");
++ puts(" n_of_buttons,btnmap1,btnmap2,");
++ puts(" ...> --set-mappings Sets axis and button mappings to the");
++ puts(" specified values");
+ putchar('\n');
+ }
+
+@@ -316,6 +324,42 @@
+ (version >> 8) & 0xff, version & 0xff);
+ }
+
++void print_mappings(char *devicename)
++{
++ int i;
++
++ if (ioctl(fd, JSIOCGAXES, &axes)) {
++ perror("jscal: error getting axes");
++ exit(1);
++ }
++ if (ioctl(fd, JSIOCGBUTTONS, &buttons)) {
++ perror("jscal: error getting buttons");
++ exit(1);
++ }
++ if (ioctl(fd, JSIOCGAXMAP, &axmap)) {
++ perror("jscal: error getting axis map");
++ exit(1);
++ }
++ if (ioctl(fd, JSIOCGBTNMAP, &buttonmap)) {
++ perror("jscal: error getting button map");
++ exit(1);
++ }
++
++ printf("jscal -u %d", axes);
++ for (i = 0; i < axes; i++)
++ {
++ printf( ",%d", axmap[i]);
++ }
++
++ printf(",%d", buttons);
++ for (i = 0; i < buttons; i++)
++ {
++ printf( ",%d", buttonmap[i]);
++ }
++
++ printf(" %s\n",devicename);
++}
++
+ void print_settings(char *devicename)
+ {
+ int i,j;
+@@ -342,6 +386,107 @@
+ printf(" %s\n",devicename);
+ }
+
++// n axes n buttons
++// 10,0,1,2,5,6,16,17,40,41,42:13,288,289,290,291,292,293,294,295,296,297,298,299,300
++void set_mappings(char *p)
++{
++ int i;
++ int axes_on_cl = 0;
++ int btns_on_cl = 0;
++ int axis_mapping = 0;
++ int btn_mapping = 0;
++
++ if (ioctl(fd, JSIOCGAXES, &axes)) {
++ perror("jscal: error getting axes");
++ exit(1);
++ }
++ if (ioctl(fd, JSIOCGBUTTONS, &buttons)) {
++ perror("jscal: error getting buttons");
++ exit(1);
++ }
++
++ if (axes > MAX_AXES) axes = MAX_AXES;
++
++ if (!p) {
++ fprintf(stderr, "jscal: missing argument for --set-mappings\n");
++ exit(1);
++ }
++
++ //axes
++ sscanf(p, "%d", &axes_on_cl);
++ p = strstr(p, ",");
++
++ if (axes_on_cl != axes) {
++ fprintf(stderr, "jscal: joystick has %d axes and not %d as specified on command line\n",
++ axes, axes_on_cl);
++ exit(1);
++ }
++
++
++ for (i = 0; i < axes; i++)
++ {
++ if (!p) {
++ fprintf(stderr, "jscal: missing mapping for axis %d\n", i);
++ exit(1);
++ }
++ sscanf(++p, "%d", &axis_mapping);
++ p = strstr(p, ",");
++
++
++ if (axis_mapping > ABS_MAX + 1) {
++ fprintf(stderr, "jscal: invalid axis mapping for axis %d (max is %d)\n", i, ABS_MAX + 1);
++ exit(1);
++ }
++ axmap[i] = axis_mapping;
++ }
++
++ //buttons
++ sscanf(++p, "%d", &btns_on_cl);
++ p = strstr(p, ",");
++
++ if (btns_on_cl != buttons) {
++ fprintf(stderr, "jscal: joystick has %d buttons and not %d as specified on command line\n",
++ buttons, btns_on_cl);
++ exit(1);
++ }
++
++
++ for (i = 0; i < buttons; i++)
++ {
++ if (!p) {
++ fprintf(stderr, "jscal: missing mapping for button %d\n", i);
++ exit(1);
++ }
++ sscanf(++p, "%d", &btn_mapping);
++ p = strstr(p, ",");
++
++
++ if (btn_mapping > KEY_MAX) {
++ fprintf(stderr, "jscal: invalid button mapping for button %d (max is %d)\n", i, KEY_MAX);
++ exit(1);
++ }
++ if (btn_mapping < BTN_MISC) {
++ fprintf(stderr, "jscal: invalid button mapping for button %d (min is %d)\n", i, BTN_MISC);
++ exit(1);
++ }
++ buttonmap[i] = btn_mapping;
++ }
++
++ if (p) {
++ fprintf(stderr, "jscal: too many values\n");
++ exit(1);
++ }
++
++ if (ioctl(fd, JSIOCSAXMAP, &axmap)) {
++ perror("jscal: error setting axis map");
++ exit(1);
++ }
++ if (ioctl(fd, JSIOCSBTNMAP, &buttonmap)) {
++ perror("jscal: error setting button map");
++ exit(1);
++ }
++}
++
+ void set_correction(char *p)
+ {
+ int i,j;
+@@ -461,14 +606,18 @@
+ char *parameter = NULL;
+ int t;
+
++ // /usr/include/getopt.h
+ static struct option long_options[] =
+ {
+ {"calibrate", no_argument, NULL, 'c'},
+ {"help", no_argument, NULL, 'h'},
+ {"set-correction", required_argument, NULL, 's'},
++ {"set-mappings", required_argument, NULL, 'u'},
+ {"test-center", no_argument, NULL, 't'},
+ {"version", no_argument, NULL, 'V'},
+- {"print-correction", no_argument, NULL, 'p'}
++ {"print-correction", no_argument, NULL, 'p'},
++ {"print-mappings", no_argument, NULL, 'q'},
++ {NULL, no_argument, NULL, 0 }
+ };
+
+ if (argc == 1) {
+@@ -477,10 +626,12 @@
+ }
+
+ do {
+- t = getopt_long(argc, argv, "chps:vVt", long_options, &option_index);
++ t = getopt_long(argc, argv, "chpqu:s:vVt", long_options, &option_index);
+ switch (t) {
+ case 'p':
++ case 'q':
+ case 's':
++ case 'u':
+ case 'c':
+ case 't':
+ case 'V':
+@@ -540,9 +691,15 @@
+ case 'p':
+ print_settings(argv[argc -1]);
+ break;
++ case 'q':
++ print_mappings(argv[argc -1]);
++ break;
+ case 's':
+ set_correction(parameter);
+ break;
++ case 'u':
++ set_mappings(parameter);
++ break;
+ case 't':
+ test_center();
+ break;
+Only in /home/kajla/usr/src/joystick/utils: .svn
diff --git a/system/joystick/joystick.info b/system/joystick/joystick.info
new file mode 100644
index 0000000000000..7a05e9503a400
--- /dev/null
+++ b/system/joystick/joystick.info
@@ -0,0 +1,8 @@
+PRGNAM="joystick"
+VERSION="1.2.15"
+HOMEPAGE="http://atrey.karlin.mff.cuni.cz/~vojtech/joystick"
+DOWNLOAD="ftp://atrey.karlin.mff.cuni.cz/pub/linux/joystick/joystick-1.2.15.tar.gz"
+MD5SUM="023500eb6986e1a94aa1a0c30af729c2"
+MAINTAINER="Roberto Neri"
+EMAIL="rneri@libero.it"
+APPROVED="rworkman"
diff --git a/system/joystick/slack-desc b/system/joystick/slack-desc
new file mode 100644
index 0000000000000..9d591adf8d3a5
--- /dev/null
+++ b/system/joystick/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|' on
+# the right side marks the last column you can put a character in. You must make
+# exactly 11 lines for the formatting to be correct. It's also customary to
+# leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+joystick: joystick (Testing and calibration tools for joysticks)
+joystick:
+joystick: Useful tools for using joysticks:
+joystick: jsattach - attach a serial line to a joystick device
+joystick: jscal - joystick calibration program
+joystick: (patched to add remapping axes and buttons functionality)
+joystick: jstest - joystick test program
+joystick:
+joystick: Homepage: http://atrey.karlin.mff.cuni.cz/~vojtech/joystick/
+joystick:
+joystick: