--- xinput-1.3.0.orig/autogen.sh +++ xinput-1.3.0/autogen.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir + +autoreconf -v --install || exit 1 +cd $ORIGDIR || exit $? + +$srcdir/configure --enable-maintainer-mode "$@" + --- xinput-1.3.0.orig/ChangeLog +++ xinput-1.3.0/ChangeLog @@ -1,3 +1,13 @@ +commit b06af76677cd70912c9c4f381b0baed28b4f89a4 +Author: Julien Cristau +Date: Thu Jan 10 20:19:55 2008 +0100 + + Change xinput_CFLAGS to AM_CFLAGS to clear automake-1.10 warning + + src/Makefile.am:27: compiling `buttonmap.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac' + + Also remove -lm from xinput_LDADD, as it isn't needed. + commit 456a1eab4b0b2f4a9bdc8ca02657869595c4bc60 Author: Philip Langdale Date: Wed Jan 9 18:25:27 2008 -0800 --- xinput-1.3.0.orig/Imakefile +++ xinput-1.3.0/Imakefile @@ -0,0 +1,49 @@ +# +# Copyright 1996-1997 by Frederic Lepied, France. +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of Frederic Lepied not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Frederic Lepied makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. +# +# $Id: Imakefile,v 1.7 1997/06/14 19:11:49 fred Exp $ + +# must be kept in synch with version.c +VERSION = 1.2 + +DEPLIBS = $(DEPXILIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XILIB) $(XLIB) + +OBJS = xinput.o feedback.o buttonmap.o setptr.o setmode.o list.o test.o version.o setint.o state.o +SRCS = xinput.c feedback.c buttonmap.c setptr.c setmode.c list.c test.c version.c setint.c state.c +HDRS = xinput.h +AUX = xinput.man Imakefile README ChangeLog COPYRIGHT + +ComplexProgramTarget(xinput) + +distrib: + @test -f setptr.c + rm -rf xinput-$(VERSION) xinput-$(VERSION).tar.gz + mkdir xinput-$(VERSION) + ln $(AUX) $(HDRS) $(SRCS) xinput-$(VERSION) + tar cvf xinput-$(VERSION).tar xinput-$(VERSION) + gzip --best --verbose xinput-$(VERSION).tar + +clean:: + @test -f setptr.c + rm -rf xinput-$(VERSION) xinput-$(VERSION).tar.gz + +# end of Imakefile --- xinput-1.3.0.orig/man/xinput.man +++ xinput-1.3.0/man/xinput.man @@ -56,6 +56,24 @@ Query the device state. Uses XQueryDeviceState(3). .PP .TP 8 +.B xinput list-props \fIdevice_name\fP [\fIdevice_name\fP...] +Lists properties that can be set for the given device(s). +.PP +.TP 8 +.B xinput set-int-prop \fIdevice_name\fP \fIproperty\fP \fIformat\fP \fIvalue\fP +Sets an integer property for the device. Values for \fIformat\fP should +be 8, 16, or 32 according to the size of integer to use. +.PP +.TP 8 +.B xinput watch-props \fIdevice_name\fP +Prints to standard out when property changes occur. +.PP +.TP 8 +.B xinput delete-prop \fIdevice_name\fP \fIproperty\fP +Delete the property from the device. +.PP +.PP +.TP 8 .B xinput test [-proximity] \fIdevice_name\fP Register all extended events from \fIdevice_name\fP and enter an endless loop displaying events received. If the -proximity is given, ProximityIn --- xinput-1.3.0.orig/src/Makefile.am +++ xinput-1.3.0/src/Makefile.am @@ -21,13 +21,14 @@ bin_PROGRAMS = xinput -xinput_CFLAGS = $(XINPUT_CFLAGS) -xinput_LDADD = $(XINPUT_LIBS) -lm +AM_CFLAGS = $(XINPUT_CFLAGS) +xinput_LDADD = $(XINPUT_LIBS) xinput_SOURCES = \ buttonmap.c \ feedback.c \ list.c \ + property.c \ setint.c \ setmode.c \ setptr.c \ --- xinput-1.3.0.orig/src/xinput.h +++ xinput-1.3.0/src/xinput.h @@ -152,5 +152,49 @@ #endif ); +int +list_props( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +set_int_prop( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +watch_props( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + +int +delete_prop( +#if NeedFunctionPrototypes + Display* display, + int argc, + char *argv[], + char *prog_name, + char *prog_desc +#endif +); + /* end of xinput.h */ --- xinput-1.3.0.orig/src/xinput.c +++ xinput-1.3.0/src/xinput.c @@ -81,6 +81,22 @@ "", version }, + { "list-props", + " [ ...]", + list_props + }, + { "set-int-prop", + " [ ...]", + set_int_prop + }, + { "watch-props", + "", + watch_props + }, + { "delete-prop", + " ", + delete_prop + }, {0, 0, 0 } }; --- xinput-1.3.0.orig/src/property.c +++ xinput-1.3.0/src/property.c @@ -0,0 +1,314 @@ +/* + * Copyright 2007 Peter Hutterer + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the author shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization + * from the author. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "xinput.h" + +static void +print_property(Display *dpy, XDevice* dev, Atom property) +{ + Atom act_type; + char *name; + int act_format; + unsigned long nitems, bytes_after; + unsigned char *data, *ptr; + int j; + + name = XGetAtomName(dpy, property); + printf("\t%s:\t", name); + + if (XGetDeviceProperty(dpy, dev, property, 0, 1000, False, + AnyPropertyType, &act_type, &act_format, + &nitems, &bytes_after, &data) == Success) + { + ptr = data; + printf("\t"); + + for (j = 0; j < nitems; j++) + { + switch(act_type) + { + case XA_INTEGER: + switch(act_format) + { + case 8: + printf("%d", *((int8_t*)ptr)); + break; + case 16: + printf("%d", *((int16_t*)ptr)); + break; + case 32: + printf("%d", *((int32_t*)ptr)); + break; + } + break; + case XA_STRING: + printf("\t%s\n", ptr); + break; + case XA_ATOM: + printf("\t%s\n", XGetAtomName(dpy, (Atom)(*ptr))); + break; + default: + printf("\t\t... of unknown type %s\n", + XGetAtomName(dpy, act_type)); + break; + } + + ptr += act_format/8; + + if (j < nitems - 1) + printf(", "); + if (act_type == XA_STRING) + break; + } + printf("\n"); + XFree(data); + } else + printf("\tFetch failure\n"); +} + +int list_props(Display *dpy, int argc, char** argv, char* name, char *desc) +{ + XDeviceInfo *info; + XDevice *dev; + int i; + int nprops; + Atom *props; + + if (argc == 0) + { + fprintf(stderr, "Usage: xinput %s %s\n", name, desc); + return EXIT_FAILURE; + } + + for (i = 0; i < argc; i++) + { + info = find_device_info(dpy, argv[i], False); + if (!info) + { + fprintf(stderr, "unable to find device %s\n", argv[i]); + continue; + } + + dev = XOpenDevice(dpy, info->id); + if (!dev) + { + fprintf(stderr, "unable to open device '%s'\n", info->name); + continue; + } + + props = XListDeviceProperties(dpy, dev, &nprops); + if (!nprops) + { + printf("Device '%s' does not report any properties.\n", info->name); + continue; + } + + printf("Device '%s':\n", info->name); + while(nprops--) + { + print_property(dpy, dev, props[nprops]); + } + + XFree(props); + XCloseDevice(dpy, dev); + } + return EXIT_SUCCESS; +} + +int +set_int_prop(Display *dpy, int argc, char** argv, char* n, char *desc) +{ + XDeviceInfo *info; + XDevice *dev; + Atom prop; + char *name; + int i; + Bool is_atom = True; + char *data; + int format, nelements = 0; + + if (argc < 3) + { + fprintf(stderr, "Usage: xinput %s %s\n", n, desc); + return EXIT_FAILURE; + } + + info = find_device_info(dpy, argv[0], False); + if (!info) + { + fprintf(stderr, "unable to find device %s\n", argv[0]); + return EXIT_FAILURE; + } + + dev = XOpenDevice(dpy, info->id); + if (!dev) + { + fprintf(stderr, "unable to open device %s\n", argv[0]); + return EXIT_FAILURE; + } + + name = argv[1]; + + for(i = 0; i < strlen(name); i++) { + if (!isdigit(name[i])) { + is_atom = False; + break; + } + } + + if (!is_atom) + prop = XInternAtom(dpy, name, False); + + nelements = argc - 3; + format = atoi(argv[2]); + if (format != 8 && format != 16 && format != 32) + { + fprintf(stderr, "Invalid format %d\n", format); + return EXIT_FAILURE; + } + + data = calloc(nelements, format/8); + for (i = 0; i < nelements; i++) + { + switch(format) + { + case 8: + *(((int8_t*)data) + i) = atoi(argv[3 + i]); + break; + case 16: + *(((int16_t*)data) + i) = atoi(argv[3 + i]); + break; + case 32: + *(((int32_t*)data) + i) = atoi(argv[3 + i]); + break; + } + } + + XChangeDeviceProperty(dpy, dev, prop, XA_INTEGER, format, PropModeReplace, + (unsigned char*)data, nelements); + + free(data); + XCloseDevice(dpy, dev); + return EXIT_SUCCESS; +} + + +int watch_props(Display *dpy, int argc, char** argv, char* n, char *desc) +{ + XDevice *dev; + XDeviceInfo *info; + XEvent ev; + XDevicePropertyNotifyEvent *dpev; + char *name; + int type_prop; + XEventClass cls_prop; + + if (list_props(dpy, argc, argv, n, desc) != EXIT_SUCCESS) + return EXIT_FAILURE; + + info = find_device_info(dpy, argv[0], False); + if (!info) + { + fprintf(stderr, "unable to find device %s\n", argv[0]); + return EXIT_FAILURE; + } + + dev = XOpenDevice(dpy, info->id); + if (!dev) + { + fprintf(stderr, "unable to open device '%s'\n", info->name); + return EXIT_FAILURE; + } + + DevicePropertyNotify(dev, type_prop, cls_prop); + XSelectExtensionEvent(dpy, DefaultRootWindow(dpy), &cls_prop, 1); + + while(1) + { + XNextEvent(dpy, &ev); + + dpev = (XDevicePropertyNotifyEvent*)&ev; + if (dpev->type != type_prop) + continue; + + name = XGetAtomName(dpy, dpev->atom); + printf("Property '%s' changed.\n", name); + print_property(dpy, dev, dpev->atom); + } + + XCloseDevice(dpy, dev); +} + +int delete_prop(Display *dpy, int argc, char** argv, char* n, char *desc) +{ + XDevice *dev; + XDeviceInfo *info; + char *name; + int i; + Bool is_atom = True; + Atom prop; + + info = find_device_info(dpy, argv[0], False); + if (!info) + { + fprintf(stderr, "unable to find device %s\n", argv[0]); + return EXIT_FAILURE; + } + + dev = XOpenDevice(dpy, info->id); + if (!dev) + { + fprintf(stderr, "unable to open device '%s'\n", info->name); + return EXIT_FAILURE; + } + name = argv[1]; + + for(i = 0; i < strlen(name); i++) { + if (!isdigit(name[i])) { + is_atom = False; + break; + } + } + + if (!is_atom) + prop = XInternAtom(dpy, name, False); + else + prop = atoi(name); + + XDeleteDeviceProperty(dpy, dev, prop); + + XCloseDevice(dpy, dev); + return EXIT_SUCCESS; +} + --- xinput-1.3.0.orig/debian/compat +++ xinput-1.3.0/debian/compat @@ -0,0 +1 @@ +5 --- xinput-1.3.0.orig/debian/rules +++ xinput-1.3.0/debian/rules @@ -0,0 +1,73 @@ +#!/usr/bin/make -f +# This file is public domain software, originally written by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) + +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + confflags = --build $(DEB_HOST_GNU_TYPE) +else + confflags = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) +endif + + +build: build-stamp +build-stamp: obj-$(DEB_BUILD_GNU_TYPE)/config.status + dh_testdir + + cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) + + touch build-stamp + +obj-$(DEB_BUILD_GNU_TYPE)/config.status: configure + dh_testdir + mkdir obj-$(DEB_BUILD_GNU_TYPE) + cd obj-$(DEB_BUILD_GNU_TYPE) && ../configure --prefix=/usr $(confflags) + +configure: configure.ac + autoreconf -vfi + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + rm -rf obj-* + rm -f Makefile.in */Makefile.in + rm -f aclocal.m4 config.guess config.sub config.h.in configure + rm -f depcomp install-sh missing + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + cd obj-$(DEB_BUILD_GNU_TYPE) && \ + $(MAKE) DESTDIR=$(CURDIR)/debian/xinput install + +# Build architecture-independent files here. +binary-indep: build install + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs README + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- xinput-1.3.0.orig/debian/watch +++ xinput-1.3.0/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://xorg.freedesktop.org/releases/individual/app/ xinput-(.*)\.tar\.gz --- xinput-1.3.0.orig/debian/control +++ xinput-1.3.0/debian/control @@ -0,0 +1,14 @@ +Source: xinput +Section: x11 +Priority: optional +Maintainer: Ubuntu Core Developers +XSBC-Original-Maintainer: Julien Cristau +Standards-Version: 3.7.3 +Build-Depends: debhelper (>= 5), libx11-dev, libxi-dev (>= 2:1.1.3-1ubuntu3), libxext-dev, x11proto-input-dev (>= 1.4-2ubuntu3), pkg-config, automake, autoconf, xutils-dev, quilt + +Package: xinput +Architecture: any +Depends: ${shlibs:Depends} +Description: Runtime configuration and test of XInput devices + Xinput is an utility for configuring and testing XInput + devices. --- xinput-1.3.0.orig/debian/changelog +++ xinput-1.3.0/debian/changelog @@ -0,0 +1,112 @@ +xinput (1.3.0-1ubuntu3) intrepid; urgency=low + + * Update to current property API. + * Bump the build-dep on libxi-dev and x11proto-input-dev. + + -- Timo Aaltonen Mon, 29 Sep 2008 09:58:55 +0300 + +xinput (1.3.0-1ubuntu2) intrepid; urgency=low + + * Applied a patch to update man page for input-device properties. + + -- Bryce Harrington Fri, 29 Aug 2008 18:36:31 -0700 + +xinput (1.3.0-1ubuntu1) intrepid; urgency=low + + * Applied a patch to support input-device properties. + + -- Timo Aaltonen Thu, 14 Aug 2008 12:05:58 +0300 + +xinput (1.3.0-1) unstable; urgency=low + + * New upstream release. + * Update debian/copyright. + * Use autoconf instead of imake. + * New maintainer (closes: #460127). Thanks to Frédéric Lepied for his work + on this package so far. + + -- Julien Cristau Thu, 10 Jan 2008 23:20:05 +0100 + +xinput (1.2-5.3) unstable; urgency=medium + + * Non-maintainer upload. + * Replace debmake with debhelper. Closes: #368274. + * debian/rules: Remove reference to /usr/X11R6. Closes: #367843. + * debian/prerm: Remove /usr/doc compatibility code. + * Conforms to Standards version 3.7.2. + + -- Matej Vela Mon, 5 Jun 2006 10:10:46 +0200 + +xinput (1.2-5.2) unstable; urgency=high + + * Non-maintainer upload. + * Split xlibs-dev build-dep (Closes: #346819). + + -- Luk Claes Fri, 20 Jan 2006 23:25:03 +0100 + +xinput (1.2-5.1) unstable; urgency=low + + * Non-Maintainer Upload. + * debian/control: + - Bumped Standards-Version to 3.5.8. + - Replaced xlib6g-dev build dependency with xlibs-dev. Closes: #170168. + - Removed full-stop from short description. + - Changed long descripting which must not be the same as the + long description. + * debian/postinst: removed. It is no longer necessary since its + only purpose was to create the /usr/doc link for the package. + * debian/rules: fixed call to dpkg-gencontrol to force inclusion + of section and priority in control file. + + -- Jerome Marant Sat, 8 Mar 2003 10:06:30 +0100 + +xinput (1.2-5) unstable; urgency=low + + * corrected Build-Depends + + -- Frederic Lepied Tue, 20 Nov 2001 01:52:48 +0000 + +xinput (1.2-4) unstable; urgency=low + + * updated Standards-Version and added Build-Depends. + + -- Frederic Lepied Sat, 23 Dec 2000 10:42:46 +0000 + +xinput (1.2-3) unstable; urgency=low + + * compiled with xlib6g (bug #12809). + + -- Frederic Lepied Fri, 12 Sep 1997 17:15:26 +0200 + +xinput (1.2-2) unstable; urgency=low + + * compiled with libc6. + + -- Frederic Lepied Sun, 6 Jul 1997 08:45:55 +0200 + +xinput (1.2-1) unstable; urgency=low + + * rename changelog.upstream into changelog (bug #9632). + * Upstream release. + + -- Frederic Lepied Wed, 18 Jun 1997 05:36:57 +0200 + +xinput (1.1.1-1) unstable; urgency=low + + * Upstream release. + + -- Frederic Lepied Tue, 11 Feb 1997 09:24:23 +0100 + +xinput (1.1-1) unstable; urgency=low + + * Upstream release. + + -- Frederic Lepied Fri, 17 Jan 1997 18:51:09 +0100 + +xinput (1.0.1-1) unstable; urgency=low + + * debianized + + -- Frederic Lepied Fri, 18 Oct 1996 14:43:37 +0200 + + --- xinput-1.3.0.orig/debian/copyright +++ xinput-1.3.0/debian/copyright @@ -0,0 +1,26 @@ +This package was debianized by Frederic Lepied Lepied@debian.org on +Fri, 17 Jan 1997 18:51:09 +0100. + +It was downloaded from http://xorg.freedesktop.org/releases/individual/app/ + +Copyright 1996-1997 by Frederic Lepied, France. + + +License: +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of Frederic Lepied not be used in +advertising or publicity pertaining to distribution of the software without +specific, written prior permission. Frederic Lepied makes no +representations about the suitability of this software for any purpose. It +is provided "as is" without express or implied warranty. + +FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. --- xinput-1.3.0.orig/debian/patches/100_idp_support.patch +++ xinput-1.3.0/debian/patches/100_idp_support.patch @@ -0,0 +1,358 @@ +From: Peter Hutterer +Date: Tue, 8 Jul 2008 08:30:21 +0000 (+0930) +Subject: Add list-props, set-int-prop and watch-props parameters. +X-Git-Url: http://gitweb.freedesktop.org/?p=xorg/app/xinput.git;a=commitdiff;h=6ebdca422d12e3326f9ab59767e05eefd24ff85f + +Add list-props, set-int-prop and watch-props parameters. + +These parameters allow modification and display of input device properties. +--- + +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -26,7 +26,7 @@ xinput_LDADD = $(XINPUT_LIBS) + + + if HAVE_XI2 +- xinput2_files = hierarchy.c setcp.c ++ xinput2_files = hierarchy.c setcp.c property.c + endif # HAVE_XI2 + + xinput_SOURCES = \ +--- /dev/null ++++ b/src/property.c +@@ -0,0 +1,297 @@ ++/* ++ * Copyright 2007 Peter Hutterer ++ * ++ * Permission to use, copy, modify, distribute, and sell this software and its ++ * documentation for any purpose is hereby granted without fee, provided that ++ * the above copyright notice appear in all copies and that both that ++ * copyright notice and this permission notice appear in supporting ++ * documentation. ++ * ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ++ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR ++ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ++ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ++ * OTHER DEALINGS IN THE SOFTWARE. ++ * ++ * Except as contained in this notice, the name of the author shall ++ * not be used in advertising or otherwise to promote the sale, use or ++ * other dealings in this Software without prior written authorization ++ * from the author. ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "xinput.h" ++ ++static void ++print_property(Display *dpy, XDevice* dev, Atom property) ++{ ++ Atom act_type; ++ char *name; ++ int act_format; ++ unsigned long nitems, bytes_after; ++ unsigned char *data, *ptr; ++ int j; ++ ++ name = XGetAtomName(dpy, property); ++ printf("\t%s:\t", name); ++ ++ if (XGetDeviceProperty(dpy, dev, property, 0, 1000, False, ++ AnyPropertyType, &act_type, &act_format, ++ &nitems, &bytes_after, &data) == Success) ++ { ++ ptr = data; ++ printf("\t"); ++ ++ for (j = 0; j < nitems; j++) ++ { ++ switch(act_type) ++ { ++ case XA_INTEGER: ++ switch(act_format) ++ { ++ case 8: ++ printf("%d", *((int8_t*)ptr)); ++ break; ++ case 16: ++ printf("%d", *((int16_t*)ptr)); ++ break; ++ case 32: ++ printf("%d", *((int32_t*)ptr)); ++ break; ++ } ++ break; ++ case XA_STRING: ++ printf("\t%s\n", ptr); ++ break; ++ case XA_ATOM: ++ printf("\t%s\n", XGetAtomName(dpy, (Atom)(*ptr))); ++ break; ++ default: ++ printf("\t\t... of unknown type %s\n", ++ XGetAtomName(dpy, act_type)); ++ break; ++ } ++ ++ ptr += act_format/8; ++ ++ if (j < nitems - 1) ++ printf(", "); ++ if (act_type == XA_STRING) ++ break; ++ } ++ printf("\n"); ++ XFree(data); ++ } else ++ printf("\tFetch failure\n"); ++ ++} ++ ++int list_props(Display *dpy, int argc, char** argv, char* name, char *desc) ++{ ++ XDeviceInfo *info; ++ XDevice *dev; ++ int i; ++ int nprops; ++ Atom *props; ++ ++ if (argc == 0) ++ { ++ fprintf(stderr, "Usage: xinput %s %s\n", name, desc); ++ return EXIT_FAILURE; ++ } ++ ++ for (i = 0; i < argc; i++) ++ { ++ info = find_device_info(dpy, argv[i], False); ++ if (!info) ++ { ++ fprintf(stderr, "unable to find device %s\n", argv[i]); ++ continue; ++ } ++ ++ dev = XOpenDevice(dpy, info->id); ++ if (!dev) ++ { ++ fprintf(stderr, "unable to open device '%s'\n", info->name); ++ continue; ++ } ++ ++ props = XListDeviceProperties(dpy, dev, &nprops); ++ if (!nprops) ++ { ++ printf("Device '%s' does not report any properties.\n", info->name); ++ continue; ++ } ++ ++ printf("Device '%s':\n", info->name); ++ while(nprops--) ++ { ++ print_property(dpy, dev, props[nprops]); ++ } ++ ++ XFree(props); ++ XCloseDevice(dpy, dev); ++ } ++ return EXIT_SUCCESS; ++} ++ ++int ++set_int_prop(Display *dpy, int argc, char** argv, char* n, char *desc) ++{ ++ XDeviceInfo *info; ++ XDevice *dev; ++ Atom prop; ++ char *name; ++ int i; ++ Bool is_atom = True; ++ char *data; ++ int format, nelements = 0; ++ ++ if (argc < 3) ++ { ++ fprintf(stderr, "Usage: xinput %s %s\n", n, desc); ++ return EXIT_FAILURE; ++ } ++ ++ info = find_device_info(dpy, argv[0], False); ++ if (!info) ++ { ++ fprintf(stderr, "unable to find device %s\n", argv[0]); ++ return EXIT_FAILURE; ++ } ++ ++ dev = XOpenDevice(dpy, info->id); ++ if (!dev) ++ { ++ fprintf(stderr, "unable to open device %s\n", argv[0]); ++ return EXIT_FAILURE; ++ } ++ ++ name = argv[1]; ++ ++ for(i = 0; i < strlen(name); i++) { ++ if (!isdigit(name[i])) { ++ is_atom = False; ++ break; ++ } ++ } ++ ++ if (!is_atom) ++ prop = XInternAtom(dpy, name, False); ++ ++ nelements = argc - 3; ++ format = atoi(argv[2]); ++ if (format != 8 && format != 16 && format != 32) ++ { ++ fprintf(stderr, "Invalid format %d\n", format); ++ return EXIT_FAILURE; ++ } ++ ++ data = calloc(nelements, format/8); ++ for (i = 0; i < nelements; i++) ++ { ++ switch(format) ++ { ++ case 8: ++ *(((int8_t*)data) + i) = atoi(argv[3 + i]); ++ break; ++ case 16: ++ *(((int16_t*)data) + i) = atoi(argv[3 + i]); ++ break; ++ case 32: ++ *(((int32_t*)data) + i) = atoi(argv[3 + i]); ++ break; ++ } ++ } ++ ++ XChangeDeviceProperty(dpy, dev, prop, XA_INTEGER, format, PropModeReplace, ++ (unsigned char*)data, nelements); ++ ++ free(data); ++ XCloseDevice(dpy, dev); ++ return EXIT_SUCCESS; ++} ++ ++ ++int watch_props(Display *dpy, int argc, char** argv, char* n, char *desc) ++{ ++ XDevice *dev; ++ XDeviceInfo *info; ++ XEvent ev; ++ XDevicePropertyNotifyEvent *dpev; ++ char *name; ++ int type_prop; ++ XEventClass cls_prop; ++ ++ if (list_props(dpy, argc, argv, n, desc) != EXIT_SUCCESS) ++ return EXIT_FAILURE; ++ ++ info = find_device_info(dpy, argv[0], False); ++ if (!info) ++ { ++ fprintf(stderr, "unable to find device %s\n", argv[0]); ++ return EXIT_FAILURE; ++ } ++ ++ dev = XOpenDevice(dpy, info->id); ++ if (!dev) ++ { ++ fprintf(stderr, "unable to open device '%s'\n", info->name); ++ return EXIT_FAILURE; ++ } ++ ++ DevicePropertyNotify(dev, type_prop, cls_prop); ++ XSelectExtensionEvent(dpy, DefaultRootWindow(dpy), &cls_prop, 1); ++ ++ while(1) ++ { ++ XNextEvent(dpy, &ev); ++ ++ dpev = (XDevicePropertyNotifyEvent*)&ev; ++ if (dpev->type != type_prop) ++ continue; ++ ++ name = XGetAtomName(dpy, dpev->atom); ++ printf("Property '%s' changed.\n", name); ++ print_property(dpy, dev, dpev->atom); ++ } ++ ++ XCloseDevice(dpy, dev); ++} +--- a/src/xinput.c ++++ b/src/xinput.c +@@ -102,6 +102,18 @@ static entry drivers[] = + " ", + set_clientpointer + }, ++ { "list-props", ++ " [ ...]", ++ list_props ++ }, ++ { "set-int-prop", ++ " [ ...]", ++ set_int_prop ++ }, ++ { "watch-props", ++ "", ++ watch_props ++ }, + #endif + {0, 0, 0 + } +--- a/src/xinput.h ++++ b/src/xinput.h +@@ -211,4 +211,38 @@ set_clientpointer( + #endif + ); + ++int ++list_props( ++#if NeedFunctionPrototypes ++ Display* display, ++ int argc, ++ char *argv[], ++ char *prog_name, ++ char *prog_desc ++#endif ++); ++ ++ ++int ++set_int_prop( ++#if NeedFunctionPrototypes ++ Display* display, ++ int argc, ++ char *argv[], ++ char *prog_name, ++ char *prog_desc ++#endif ++); ++ ++int ++watch_props( ++#if NeedFunctionPrototypes ++ Display* display, ++ int argc, ++ char *argv[], ++ char *prog_name, ++ char *prog_desc ++#endif ++); ++ + /* end of xinput.h */ --- xinput-1.3.0.orig/debian/patches/101_man_props.patch +++ xinput-1.3.0/debian/patches/101_man_props.patch @@ -0,0 +1,23 @@ +diff -Nurp xinput-1.3.0/man/xinput.man xinput-1.3.0-working/man/xinput.man +--- xinput-1.3.0/man/xinput.man 2008-01-09 18:16:26.000000000 -0800 ++++ xinput-1.3.0-working/man/xinput.man 2008-08-29 18:32:56.000000000 -0700 +@@ -56,6 +56,19 @@ Change the button mapping of \fIdevice_n + Query the device state. Uses XQueryDeviceState(3). + .PP + .TP 8 ++.B xinput list-props \fIdevice_name\fP [\fIdevice_name\fP...] ++Lists properties that can be set for the given device(s). ++.PP ++.TP 8 ++.B xinput set-int-prop \fIdevice_name\fP \fIproperty\fP \fIformat\fP \fIvalue\fP ++Sets an integer property for the device. Values for \fIformat\fP should ++be 8, 16, or 32 according to the size of integer to use. ++.PP ++.TP 8 ++.B xinput watch-props \fIdevice_name\fP ++Prints to standard out when property changes occur. ++.PP ++.TP 8 + .B xinput test [-proximity] \fIdevice_name\fP + Register all extended events from \fIdevice_name\fP and enter an endless + loop displaying events received. If the -proximity is given, ProximityIn