summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetteri Räty <betelgeuse@gentoo.org>2006-11-21 17:05:44 +0000
committerPetteri Räty <betelgeuse@gentoo.org>2006-11-21 17:05:44 +0000
commit0d6cb16fae9751560827d8082a5ef6d3f9247807 (patch)
tree6f02b214e82b7f03fccbf0f33686088eef24f757
parentRemoving stale files. (diff)
downloadbetelgeuse-0d6cb16fae9751560827d8082a5ef6d3f9247807.tar.gz
betelgeuse-0d6cb16fae9751560827d8082a5ef6d3f9247807.tar.bz2
betelgeuse-0d6cb16fae9751560827d8082a5ef6d3f9247807.zip
Added an ebuild for revoco.
svn path=/; revision=109
-rw-r--r--app-misc/revoco/Manifest11
-rw-r--r--app-misc/revoco/files/digest-revoco-0.20
-rw-r--r--app-misc/revoco/files/revoco-0.2.c179
-rw-r--r--app-misc/revoco/revoco-0.2.ebuild33
4 files changed, 223 insertions, 0 deletions
diff --git a/app-misc/revoco/Manifest b/app-misc/revoco/Manifest
new file mode 100644
index 0000000..822d046
--- /dev/null
+++ b/app-misc/revoco/Manifest
@@ -0,0 +1,11 @@
+AUX revoco-0.2.c 3937 RMD160 2af70f6c45aef2cefca0edc8b5485bda236f6e50 SHA1 46f8e5ef4676f7b4b74e2c23df654a80ddcb51f5 SHA256 c53eea3eaa2b021cd84bc766ea0de395562a54a51bfbdfc9fe41350d261cc766
+MD5 ec675fa4297b430c2b3165404566d0cb files/revoco-0.2.c 3937
+RMD160 2af70f6c45aef2cefca0edc8b5485bda236f6e50 files/revoco-0.2.c 3937
+SHA256 c53eea3eaa2b021cd84bc766ea0de395562a54a51bfbdfc9fe41350d261cc766 files/revoco-0.2.c 3937
+EBUILD revoco-0.2.ebuild 612 RMD160 4ba701c1e8d09dccf9c387540204bd8ba64827f2 SHA1 2ddaf240a5afa337f5ca477a61f2b64a30b0ddf3 SHA256 c824d6cf5941829193dd113372b059ebed91b9787141a37c43b551aac25b3380
+MD5 da9ff7e681e49f2c459bd1ffc4e51f6f revoco-0.2.ebuild 612
+RMD160 4ba701c1e8d09dccf9c387540204bd8ba64827f2 revoco-0.2.ebuild 612
+SHA256 c824d6cf5941829193dd113372b059ebed91b9787141a37c43b551aac25b3380 revoco-0.2.ebuild 612
+MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-revoco-0.2 0
+RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-revoco-0.2 0
+SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 files/digest-revoco-0.2 0
diff --git a/app-misc/revoco/files/digest-revoco-0.2 b/app-misc/revoco/files/digest-revoco-0.2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app-misc/revoco/files/digest-revoco-0.2
diff --git a/app-misc/revoco/files/revoco-0.2.c b/app-misc/revoco/files/revoco-0.2.c
new file mode 100644
index 0000000..a41a0f4
--- /dev/null
+++ b/app-misc/revoco/files/revoco-0.2.c
@@ -0,0 +1,179 @@
+/*
+ * Simple hack to control the wheel of Logitech's MX-Revolution mouse.
+ *
+ * Requires hiddev.
+ *
+ * Written November 2006 by E. Toernig's bonobo - no copyrights.
+ *
+ * Contact: Edgar Toernig <froese@gmx.de>
+ *
+ */
+
+// Needed for hiddev.h
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <asm/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <linux/hiddev.h>
+
+#include <stdarg.h>
+#include <errno.h>
+
+#define streq(a,b) (strcmp((a), (b)) == 0)
+#define strneq(a,b,c) (strncmp((a), (b), (c)) == 0)
+
+#define LOGITECH 0x046d
+#define MX_REVOLUTION 0xc51a
+
+static void
+fatal(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ fprintf(stderr, "revoco: ");
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+ exit(1);
+}
+
+static int
+open_dev(void)
+{
+ char buf[128];
+ int i, fd;
+ struct hiddev_devinfo dinfo;
+
+ for (i = 0; i < 16; ++i)
+ {
+ sprintf(buf, "/dev/usb/hiddev%d", i);
+ fd = open(buf, O_RDWR);
+ if (fd >= 0)
+ {
+ if (ioctl(fd, HIDIOCGDEVINFO, &dinfo) == 0)
+ if (dinfo.vendor == (short)LOGITECH)
+ if (dinfo.product == (short)MX_REVOLUTION)
+ return fd;
+ close(fd);
+ }
+ }
+ return -1;
+}
+
+static void
+close_dev(int fd)
+{
+ close(fd);
+}
+
+static void
+send_cmd(int fd, int b1, int b2, int b3)
+{
+ struct hiddev_usage_ref_multi uref;
+ struct hiddev_report_info rinfo;
+
+ uref.uref.report_type = HID_REPORT_TYPE_OUTPUT;
+ uref.uref.report_id = 0x10;
+ uref.uref.field_index = 0;
+ uref.uref.usage_index = 0;
+ uref.num_values = 6;
+ uref.values[0] = 0x01; // ET: No idea what the first three values
+ uref.values[1] = 0x80; // mean. The SetPoint software sends them ...
+ uref.values[2] = 0x56;
+ uref.values[3] = b1;
+ uref.values[4] = b2;
+ uref.values[5] = b3;
+ if (ioctl(fd, HIDIOCSUSAGES, &uref) == -1)
+ fatal("HIDIOCSUSAGES: %s", strerror(errno));
+
+ rinfo.report_type = HID_REPORT_TYPE_OUTPUT;
+ rinfo.report_id = 0x10;
+ rinfo.num_fields = 1;
+ if (ioctl(fd, HIDIOCSREPORT, &rinfo) == -1)
+ fatal("HIDIOCSREPORT: %s", strerror(errno));
+}
+
+
+static int
+getarg(const char *str, int def, int min, int max)
+{
+ if (*str == '\0')
+ return def;
+
+ if (*str == '=')
+ {
+ int n = atoi(str + 1);
+
+ if (n >= min && n <= max)
+ return n;
+
+ fatal("argument `%s' out of range (%d-%d)", str + 1, min, max);
+ }
+
+ fatal("bad argument `%s'", str);
+ return 0;
+}
+
+static void
+configure(int handle, int argc, char **argv)
+{
+ int i, arg;
+
+ for (i = 1; i < argc; ++i)
+ if (streq(argv[i], "free"))
+ {
+ send_cmd(handle, 1, 0, 0);
+ }
+ else if (streq(argv[i], "click"))
+ {
+ send_cmd(handle, 2, 0, 0);
+ }
+ else if (strneq(argv[i], "manual", 6))
+ {
+ arg = getarg(argv[i] + 6, 3, 0, 15);
+ send_cmd(handle, 8, arg, 0);
+ // 3=middle, 4=back, 5=forw, 6=find, 7=wheel-left, 8=wheel-right
+ // 9=sidewheel-forw, 11=sidewheel-back, 13=sidewheel-press
+ // 0+1+2+10+12+14+15=ignore
+ }
+ else if (strneq(argv[i], "auto", 4))
+ {
+ arg = getarg(argv[i] + 4, 5, 1, 47);
+ send_cmd(handle, 5, arg, arg); // up, down
+ }
+ else
+ fatal("unknown option `%s'", argv[i]);
+}
+
+int
+main(int argc, char **argv)
+{
+ int handle;
+
+ if (argc < 2 ||
+ (argc > 1 && (streq(argv[1], "-h") || streq(argv[1], "--help"))))
+ {
+ printf("Revoco v0.1 - Change the wheel behaviour of "
+ "Logitech's MX-Revolution mouse.\n");
+ printf("Usage:\n");
+ printf(" revoco free free spinning mode\n");
+ printf(" revoco click click-to-click mode\n");
+ printf(" revoco manual[=button] manual mode change via button\n");
+ printf(" revoco auto[=speed] automatic mode change (0<speed<48)\n");
+ exit(0);
+ }
+
+ handle = open_dev();
+ if (handle == -1)
+ fatal("No Logitech MX-Revolution (%04x:%04x) found.",
+ LOGITECH, MX_REVOLUTION);
+ configure(handle, argc, argv);
+
+ close_dev(handle);
+ exit(0);
+}
diff --git a/app-misc/revoco/revoco-0.2.ebuild b/app-misc/revoco/revoco-0.2.ebuild
new file mode 100644
index 0000000..9ef26fa
--- /dev/null
+++ b/app-misc/revoco/revoco-0.2.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit toolchain-funcs linux-info
+
+DESCRIPTION="Tool for controlling Logitech MX Revolution mouses"
+HOMEPAGE="http://goron.de/~froese/"
+SRC_URI=""
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~x86"
+
+IUSE=""
+
+DEPEND=""
+
+CONFIG_CHECK="USB_HIDDEV"
+ERROR_USB_HIDDEN="You need to the CONFIG_USB_HIDDEV option turned on."
+
+S=${WORKDIR}
+
+src_compile() {
+ $(tc-getCC) -Wl,-z,now ${CFLAGS} ${LDFLAGS} ${FILESDIR}/${P}.c -o ${PN}
+}
+
+src_install() {
+ exeinto /usr/bin
+ exeopts -m 4711
+ doexe ${PN}
+}
+