Hello community, here is the log from the commit of package linuxconsoletools for openSUSE:Factory checked in at 2016-09-30 15:24:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/linuxconsoletools (Old) and /work/SRC/openSUSE:Factory/.linuxconsoletools.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "linuxconsoletools" Changes: -------- --- /work/SRC/openSUSE:Factory/linuxconsoletools/linuxconsoletools.changes 2016-02-17 12:15:14.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.linuxconsoletools.new/linuxconsoletools.changes 2016-09-30 15:24:46.000000000 +0200 @@ -1,0 +2,9 @@ +Tue Sep 27 19:17:56 UTC 2016 - [email protected] + +- update to 1.5.1 + * Correctly install 80-stelladaptor-joystick.rules. +- update to 1.5.0 + * Add Stephen Anthony's evdev-joystick tool, with his agreement. +- set PREFIX for compilation too (bsc#1000895) + +------------------------------------------------------------------- Old: ---- linuxconsoletools-1.4.9.tar.bz2 New: ---- linuxconsoletools-1.5.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ linuxconsoletools.spec ++++++ --- /var/tmp/diff_new_pack.STJXJ9/_old 2016-09-30 15:24:47.000000000 +0200 +++ /var/tmp/diff_new_pack.STJXJ9/_new 2016-09-30 15:24:47.000000000 +0200 @@ -17,7 +17,7 @@ Name: linuxconsoletools -Version: 1.4.9 +Version: 1.5.1 Release: 0 Summary: A set of utilities for joysticks License: GPL-2.0+ @@ -26,7 +26,7 @@ Source0: http://sourceforge.net/projects/linuxconsole/files/%{name}-%{version}.tar.bz2 BuildRequires: libSDL-devel BuildRequires: linux-kernel-headers -BuildRequires: pkg-config +BuildRequires: pkgconfig BuildRequires: systemd-devel BuildRequires: udev # moved in 13.2 @@ -51,18 +51,29 @@ %setup -q %build -make %{?_smp_mflags} CFLAGS="%{optflags}" SYSTEMD_SUPPORT=1 +make %{?_smp_mflags} \ + CFLAGS="%{optflags}" \ + PREFIX=%{_prefix} \ + SYSTEMD_SUPPORT=1 %install -make %{?_smp_mflags} DESTDIR=%{buildroot} PREFIX=%{_prefix} install +make %{?_smp_mflags} \ + DESTDIR=%{buildroot} \ + PREFIX=%{_prefix} \ + install +# fix permissions chmod 644 %{buildroot}%{_mandir}/man1/* -# Fix udev dir +chmod 644 %{buildroot}/lib/udev/rules.d/80-stelladaptor-joystick.rules +# Fix udev dirs mkdir -p %{buildroot}%{_libexecdir}/udev mv %{buildroot}/lib/udev/js-set-enum-leds %{buildroot}%{_libexecdir}/udev/js-set-enum-leds +mkdir -p %{buildroot}%{_udevrulesdir} +mv %{buildroot}/lib/udev/rules.d/80-stelladaptor-joystick.rules %{buildroot}%{_udevrulesdir}/80-stelladaptor-joystick.rules %files %defattr(-,root,root) %doc COPYING NEWS README +%{_bindir}/evdev-joystick %{_bindir}/ffcfstress %{_bindir}/ffmvforce %{_bindir}/ffset @@ -83,5 +94,6 @@ %{_mandir}/man1/jstest.1%{ext_man} %{_datadir}/joystick/ %{_libexecdir}/udev/js-set-enum-leds +%{_udevrulesdir}/80-stelladaptor-joystick.rules %changelog ++++++ linuxconsoletools-1.4.9.tar.bz2 -> linuxconsoletools-1.5.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/Makefile new/linuxconsoletools-1.5.1/Makefile --- old/linuxconsoletools-1.4.9/Makefile 2016-01-09 16:31:52.000000000 +0100 +++ new/linuxconsoletools-1.5.1/Makefile 2016-04-19 22:22:59.000000000 +0200 @@ -19,7 +19,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA. -VERSION := 1.4.9 +VERSION := 1.5.1 PACKAGE := linuxconsoletools-$(VERSION) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/NEWS new/linuxconsoletools-1.5.1/NEWS --- old/linuxconsoletools-1.4.9/NEWS 2016-01-07 20:38:13.000000000 +0100 +++ new/linuxconsoletools-1.5.1/NEWS 2016-04-19 22:22:06.000000000 +0200 @@ -1,3 +1,13 @@ +Version 1.5.1 +------------- + +* Correctly install 80-stelladaptor-joystick.rules. + +Version 1.5.0 +------------- + +* Add Stephen Anthony's evdev-joystick tool, with his agreement. + Version 1.4.9 ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/README new/linuxconsoletools-1.5.1/README --- old/linuxconsoletools-1.4.9/README 2016-01-07 20:42:32.000000000 +0100 +++ new/linuxconsoletools-1.5.1/README 2016-04-19 22:21:45.000000000 +0200 @@ -1,5 +1,5 @@ linuxconsole tools - Release 1.4.9 + Release 1.5.1 http://sf.net/projects/linuxconsole/ @@ -17,6 +17,8 @@ ------------------ The following utilities are provided to calibrate and test joysticks: +* evdev-joystick - calibrate joystick devices (including dead zones + and fuzz) * ffcfstress, ffmvforce, fftest - test force-feedback devices * ffset - set force-feedback device parameters * jscal - calibrate joystick devices, reconfigure the axes and buttons @@ -216,6 +218,7 @@ * Jamie Lentin: mouseman4 mode. * Böszörményi Zoltán: eGalaxTouch support, Hampshire support, systemd notification. +* Stephen Anthony: evdev-joystick (based on G25manage). License @@ -227,6 +230,7 @@ Copyright © 2001-2002 Johann Deneux Copyright © 2001 Arndt Schoenewald Copyright © 2008-2016 Stephen Kitt + Copyright © 2016 Stephen Anthony This program is free software; you can redistribute it and/or modify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/docs/evdev-joystick.1 new/linuxconsoletools-1.5.1/docs/evdev-joystick.1 --- old/linuxconsoletools-1.4.9/docs/evdev-joystick.1 1970-01-01 01:00:00.000000000 +0100 +++ new/linuxconsoletools-1.5.1/docs/evdev-joystick.1 2016-04-19 21:45:37.000000000 +0200 @@ -0,0 +1,75 @@ +.TH evdev-joystick 1 "Apr 19, 2016" evdev-joystick +.SH NAME +evdev\-joystick \- joystick calibration program +.SH SYNOPSIS +.B evdev\-joystick \-\-help +.br +.B evdev\-joystick \-\-listdevs +.br +.B evdev\-joystick \-\-showcal \fR<\fIdevice\(hypath\fP>\fP +.br +.B evdev\-joystick \-\-evdev \fR\fIdevice\(hypath\fP> +.RB [ \-\-axis +.RI < axis >] +.RB [ \-\-deadzone +.RI < value >] +.RB [ \-\-fuzz +.RI < value >] +.SH DESCRIPTION +.B evdev\-joystick +calibrates joysticks. +Calibrating a joystick ensures the positions on the various axes are +correctly interpreted. +.SH OPTIONS +.TP +.BR \-\-h ", " \-\-help +Print out a summary of available options. +.TP +.BR \-\-l ", " \-\-listdevs +List all joystick devices found. +.TP +.BR \-\-s ", " \-\-showcal " <" \fIdevice\(hypath\fP > +Show the current calibration for the specified \fIdevice\fP. +.TP +.BR \-\-e ", " \-\-evdev " <" \fIdevice\(hypath\fP > +Specify the joystick \fIdevice\fP to modify. +.TP +.BR \-\-a ", " \-\-axis " <" \fIaxis\fP > +Specify the \fIaxis\fP to modify (by default, all axes are +calibrated). +.TP +.BR \-\-d ", " \-\-deadzone " <" \fIvalue\fP > +Change the deadzone for the current joystick. +.TP +.BR \-\-f ", " \-\-fuzz " <" \fIvalue\fP > +Change the fuzz for the current joystick. +.SH CALIBRATION +Using the Linux input system, joysticks are expected to produce values +between \-32767 and 32767 for axes, with 0 meaning the joystick is +centred. +Thus, full\(hyleft should produce \-32767 on the X axis, full\(hyright +32767 on the X axis, full\(hyforward \-32767 on the Y axis, and so on. +.PP +Many joysticks and gamepads (especially older ones) are slightly +mis\(hyaligned; as a result they may not use the full range of values +(for the extremes of the axes), or more annoyingly they may not give 0 +when centred. +Calibrating a joystick provides the kernel with information on a +joystick's real behaviour, which allows the kernel to correct various +joysticks' deficiencies and produce consistent output as far as +joystick\(hyusing software is concerned. +.PP +\fBjstest\fP(1) is useful to determine whether a joystick is +calibrated: when run, it should produce all 0s when the joystick is at +rest, and each axis should be able to produce the values \-32767 and +32767. +Analog joysticks should produce values in between 0 and the extremes, +but this is not necessary; digital directional pads work fine with +only the three values. +.SH SEE ALSO +\fBffset\fP(1), \fBjstest\fP(1). +.SH AUTHORS +.B evdev\-joystick +was written by Stephen Anthony, based on VDrift's G25manage tool. +.PP +This manual page was written by Stephen Kitt <[email protected]>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/docs/evdev-joystick.txt new/linuxconsoletools-1.5.1/docs/evdev-joystick.txt --- old/linuxconsoletools-1.4.9/docs/evdev-joystick.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/linuxconsoletools-1.5.1/docs/evdev-joystick.txt 2016-04-19 20:55:22.000000000 +0200 @@ -0,0 +1,83 @@ +EVDEV-JOYSTICK +-------------- + +This program is based on G25manage, located at: + https://github.com/VDrift/vdrift/tree/master/tools/G25manage + +It is developed by Stephen Anthony, and released under the GPL/v2. + +evdev-joystick is used to set the deadzone for Linux 'evdev' joystick devices. +Currently, other than G25manage there is no other standalone program available +to perform such calibration. This program was originally developed for Stella +(stella.sf.net), an Atari 2600 emulator, and as such much of this document +refers to Stella. The program itself can be used to calibrate any joystick +for any application, though, and is not specific to Stella. + + +Short Explanation (Stella users with Stelladaptor, 2600-daptor, etc.) +----------------- + +1) Decompress the archive +2) Build the application by typing 'make' +3) Install it by typing 'sudo make install' +4) Unplug your 'daptor device, re-plug them, and play a game. + + +Long Explanation (For the curious, or if something doesn't work, etc.) +---------------- + +1) Decompress the archive +2) Build the application by typing 'make' + +3) Type './evdev-joystick --l'. For me, it produces output as follows: + +/dev/input/by-id/usb-Microsoft_Inc._Controller_101F9B0-event-joystick +/dev/input/by-id/usb-Microchip_Technology_Inc._2600-daptor_II-event-joystick +/dev/input/by-id/usb-RetroUSB.com_SNES_RetroPort-event-joystick + +4) Make note of the name of the device. For 2600-daptor II users, this + would be: + +/dev/input/by-id/usb-Microchip_Technology_Inc._2600-daptor_II-event-joystick + +5) Check the current deadzone (known as 'flatness') by typing: + 'evdev-joystick --s <NAME_OF_DEVICE>' + Again, for me, this will output the following: + + Absolute axis 0x00 (0) (X Axis) (min: 0, max: 4095, flatness: 128 (=0.00%), fuzz: 15) + Absolute axis 0x01 (1) (Y Axis) (min: 0, max: 4095, flatness: 128 (=0.00%), fuzz: 15) + Absolute axis 0x02 (2) (Z Axis) (min: 0, max: 15, flatness: 0 (=0.00%), fuzz: 0) + +6) Notice that the flatness/deadzone for axes 0 & 1 is 128. + +7) Now, we change the deadzone by typing 'evdev-joystick --s <NAME_OF_DEVICE> --d 0' + +8) Now check the current deadzone again by typing: + 'evdev-joystick --s <NAME_OF_DEVICE>' + + Absolute axis 0x00 (0) (X Axis) (min: 0, max: 4095, flatness: 0 (=0.00%), fuzz: 15) + Absolute axis 0x01 (1) (Y Axis) (min: 0, max: 4095, flatness: 0 (=0.00%), fuzz: 15) + Absolute axis 0x02 (2) (Z Axis) (min: 0, max: 15, flatness: 0 (=0.00%), fuzz: 0) + +9) Note that the 'flatness' has changed to 0? If so, then the program is + working as intended. + +10) Note that there are other options to the program. You can change the + 'fuzz' value, change attributes for only certain axis, etc. See the + options by typing 'evdev-joystick'. + +11) Once you're certain that the application is working, type 'sudo make install' + to install it. + + +RULES File +---------- + +Included in the archive is a udev .rules file that will automatically run +evdev-joystick with the correct parameters for a Stelladaptor, 2600-daptor, +and 2600-daptor II. If you have another joystick you wish to modify, +simply add the proper entry to the .rules file. Note that it is necessary +to add all joysticks (where you want to change the deadzone) to this file, +since the settings are lost when the device is unplugged and plugged in again. +When using a .rules file, the system will automatically re-run evdev-joystick +and set your deadzone values again. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/utils/80-stelladaptor-joystick.rules.in new/linuxconsoletools-1.5.1/utils/80-stelladaptor-joystick.rules.in --- old/linuxconsoletools-1.4.9/utils/80-stelladaptor-joystick.rules.in 1970-01-01 01:00:00.000000000 +0100 +++ new/linuxconsoletools-1.5.1/utils/80-stelladaptor-joystick.rules.in 2016-04-19 20:52:46.000000000 +0200 @@ -0,0 +1,8 @@ +# Stelladaptor (Pixels Past / Stelladaptor 2600-to-USB Interface) +KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="beef", ACTION=="add", RUN+="@@PREFIX@@/bin/evdev-joystick --e /dev/input/%k --d 0" + +# 2600-daptor (Microchip Technology Inc. / 2600-daptor) +KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="fa1d", ACTION=="add", RUN+="@@PREFIX@@/bin/evdev-joystick --e /dev/input/%k --d 0" + +# 2600-daptor II (Microchip Technology Inc. / 2600-daptor II) +KERNEL=="event*", NAME="input/%k", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="f947", ACTION=="add", RUN+="@@PREFIX@@/bin/evdev-joystick --e /dev/input/%k --d 0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/utils/Makefile new/linuxconsoletools-1.5.1/utils/Makefile --- old/linuxconsoletools-1.4.9/utils/Makefile 2015-12-17 08:51:26.000000000 +0100 +++ new/linuxconsoletools-1.5.1/utils/Makefile 2016-04-19 22:20:50.000000000 +0200 @@ -4,7 +4,7 @@ # Makefile for Linux input utilities # # © 1998-2000 Vojtech Pavlik (sponsored by SuSE) -# © 2008-2012 Stephen Kitt <[email protected]> +# © 2008-2016 Stephen Kitt <[email protected]> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ CFLAGS ?= -g -O2 -Wall PROGRAMS = inputattach jstest jscal fftest ffmvforce ffset \ - ffcfstress jscal-restore jscal-store + ffcfstress jscal-restore jscal-store evdev-joystick PREFIX ?= /usr/local @@ -36,12 +36,14 @@ distclean: clean clean: - $(RM) *.o *.swp $(PROGRAMS) *.orig *.rej map *~ + $(RM) *.o *.swp $(PROGRAMS) *.orig *.rej map *~ *.rules ifeq ($(SYSTEMD_SUPPORT),1) SYSTEMDFLAGS = -DSYSTEMD_SUPPORT=1 $(shell pkg-config --cflags --libs libsystemd) endif +evdev-joystick: evdev-joystick.c + inputattach: inputattach.c $(CC) $(CFLAGS) $(CPPFLAGS) -funsigned-char $^ $(LDFLAGS) $(SYSTEMDFLAGS) -lm -o $@ @@ -74,12 +76,16 @@ jscal-store: jscal-store.in sed "s^@@PREFIX@@^$(PREFIX)^g" < $^ > $@ -install: compile +80-stelladaptor-joystick.rules: 80-stelladaptor-joystick.rules.in + sed "s^@@PREFIX@@^$(PREFIX)^g" < $^ > $@ + +install: compile 80-stelladaptor-joystick.rules install -d $(DESTDIR)$(PREFIX)/bin install $(PROGRAMS) $(DESTDIR)$(PREFIX)/bin install -d $(DESTDIR)$(PREFIX)/share/joystick install extract filter ident $(DESTDIR)$(PREFIX)/share/joystick - install -d $(DESTDIR)/lib/udev + install -d $(DESTDIR)/lib/udev/rules.d install js-set-enum-leds $(DESTDIR)/lib/udev + install 80-stelladaptor-joystick.rules $(DESTDIR)/lib/udev/rules.d .PHONY: compile clean distclean install diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/utils/evdev-joystick.c new/linuxconsoletools-1.5.1/utils/evdev-joystick.c --- old/linuxconsoletools-1.4.9/utils/evdev-joystick.c 1970-01-01 01:00:00.000000000 +0100 +++ new/linuxconsoletools-1.5.1/utils/evdev-joystick.c 2016-04-19 20:49:19.000000000 +0200 @@ -0,0 +1,390 @@ +/** + This program is based on G25manage, located at: + https://github.com/VDrift/vdrift/tree/master/tools/G25manage + + This code is released under the GPLv2, and modified from the + original by Stephen Anthony ([email protected]). +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <getopt.h> +#include <unistd.h> +#include <sys/stat.h> +#include <sys/ioctl.h> +#include <stdio.h> +#include <errno.h> +#include <stdint.h> +#include <string.h> +#include <dirent.h> + +#include <sys/ioctl.h> +#include <sys/types.h> +#include <asm/types.h> +#include <fcntl.h> + +#include <linux/input.h> + +/* this macro is used to tell if "bit" is set in "array" + * it selects a byte from the array, and does a boolean AND + * operation with a byte that only has the relevant bit set. + * eg. to check for the 12th bit, we do (array[1] & 1<<4) + */ +#define test_bit(bit, array) (array[bit/8] & (1<<(bit%8))) + +// The default location for evdev devices in Linux +#define EVDEV_DIR "/dev/input/by-id/" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void help() +{ + printf("%s","Usage:\n\n" + " --help, --h The message you're now reading\n" + " --listdevs, --l List all joystick devices found\n" + " --showcal, --s [path] Show current calibration for joystick device\n" + " --evdev, --e [path] Set the joystick device to modify\n" + " --deadzone, --d [val] Change deadzone for current joystick\n" + " --fuzz, --f [val] Change fuzz for current joystick\n" + " --axis, --a [val] The axis to modify for current joystick (by default, all axes)\n" + "\n" + "To see calibration information: \n" + " evdev-joystick [ --s /path/to/event/device/file ]\n" + "\n" + "To set the deadzone values:\n" + " evdev-joystick [ --e /path/to/event/device/file --d deadzone_value [ --a axis_index ] ]\n" + "\n" + "Example:\n" + "\n" + "I want to see the calibration values of my event managed joystick:\n" + " evdev-joystick --s /dev/input/event6\n" + "\n" + "Supported Absolute axes:\n" + " Absolute axis 0x00 (0) (X Axis) (min: 0, max: 16383, flatness: 1023 (=6.24%), fuzz: 63)\n" + " Absolute axis 0x01 (1) (Y Axis) (min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n" + " Absolute axis 0x02 (2) (Z Axis) (min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n" + " Absolute axis 0x05 (5) (Z Rate Axis) (min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n" + " Absolute axis 0x10 (16) (Hat zero, x axis) (min: -1, max: 1, flatness: 0 (=0.00%), fuzz: 0)\n" + " Absolute axis 0x11 (17) (Hat zero, y axis) (min: -1, max: 1, flatness: 0 (=0.00%), fuzz: 0)\n" + "\n" + "I want to get rid of the deadzone on all axes on my joystick:\n" + " evdev-joystick --e /dev/input/event6 --d 0\n" + "\n"); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void listDevices() +{ + DIR* dirp = opendir(EVDEV_DIR); + struct dirent* dp; + + if(dirp == NULL) + return; + + // Loop over dir entries using readdir + int len = strlen("event-joystick"); + while((dp = readdir(dirp)) != NULL) + { + // Only select names that end in 'event-joystick' + int devlen = strlen(dp->d_name); + if(devlen >= len) + { + const char* start = dp->d_name + devlen - len; + if(strncmp(start, "event-joystick", len) == 0) + printf("%s%s\n", EVDEV_DIR, dp->d_name); + } + } +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void printAxisType(int i) +{ + switch(i) + { + case ABS_X : printf(" (X Axis) "); break; + case ABS_Y : printf(" (Y Axis) "); break; + case ABS_Z : printf(" (Z Axis) "); break; + case ABS_RX : printf(" (X Rate Axis) "); break; + case ABS_RY : printf(" (Y Rate Axis) "); break; + case ABS_RZ : printf(" (Z Rate Axis) "); break; + case ABS_THROTTLE : printf(" (Throttle) "); break; + case ABS_RUDDER : printf(" (Rudder) "); break; + case ABS_WHEEL : printf(" (Wheel) "); break; + case ABS_GAS : printf(" (Accelerator) "); break; + case ABS_BRAKE : printf(" (Brake) "); break; + case ABS_HAT0X : printf(" (Hat zero, x axis) "); break; + case ABS_HAT0Y : printf(" (Hat zero, y axis) "); break; + case ABS_HAT1X : printf(" (Hat one, x axis) "); break; + case ABS_HAT1Y : printf(" (Hat one, y axis) "); break; + case ABS_HAT2X : printf(" (Hat two, x axis) "); break; + case ABS_HAT2Y : printf(" (Hat two, y axis) "); break; + case ABS_HAT3X : printf(" (Hat three, x axis) "); break; + case ABS_HAT3Y : printf(" (Hat three, y axis) "); break; + case ABS_PRESSURE : printf(" (Pressure) "); break; + case ABS_DISTANCE : printf(" (Distance) "); break; + case ABS_TILT_X : printf(" (Tilt, X axis) "); break; + case ABS_TILT_Y : printf(" (Tilt, Y axis) "); break; + case ABS_MISC : printf(" (Miscellaneous) "); break; + default: printf(" (Unknown absolute feature) "); + } +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int showCalibration(const char* evdev) +{ + int fd = -1, axisindex; + uint8_t abs_bitmask[ABS_MAX/8 + 1]; + float percent_deadzone; + struct input_absinfo abs_features; + + if((fd = open(evdev, O_RDONLY)) < 0) + { + perror("evdev open"); + return 1; + } + + memset(abs_bitmask, 0, sizeof(abs_bitmask)); + if (ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmask)), abs_bitmask) < 0) + perror("evdev ioctl"); + + printf("Supported Absolute axes:\n"); + + for(axisindex = 0; axisindex < ABS_MAX; ++axisindex) + { + if(test_bit(axisindex, abs_bitmask)) + { + // This means that the bit is set in the axes list + printf(" Absolute axis 0x%02x (%d)", axisindex, axisindex); + printAxisType(axisindex); + + if(ioctl(fd, EVIOCGABS(axisindex), &abs_features)) + perror("evdev EVIOCGABS ioctl"); + + percent_deadzone = (float)abs_features.flat * 100 / (float)abs_features.maximum; + printf("(min: %d, max: %d, flatness: %d (=%.2f%%), fuzz: %d)\n", + abs_features.minimum, abs_features.maximum, abs_features.flat, + percent_deadzone, abs_features.fuzz); + } + } + + close(fd); + return 0; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int setDeadzoneAndFuzz(const char* evdev, int axisindex, + __s32 deadzonevalue, __s32 fuzzvalue) +{ + int fd = -1; + uint8_t abs_bitmask[ABS_MAX/8 + 1]; + float percent_deadzone; + struct input_absinfo abs_features; + + if ((fd = open(evdev, O_RDONLY)) < 0) + { + perror("evdev open"); + return 1; + } + + memset(abs_bitmask, 0, sizeof(abs_bitmask)); + if(ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bitmask)), abs_bitmask) < 0) + perror("evdev ioctl"); + + int axis_first = 0, axis_last = ABS_MAX; + if(axisindex >= 0 && axisindex < ABS_MAX) + { + axis_first = axisindex; + axis_last = axisindex + 1; + } + + for(axisindex = axis_first; axisindex < axis_last; ++axisindex) + { + if(test_bit(axisindex, abs_bitmask)) + { + /* this means that the bit is set in the axes list */ + printf(" Absolute axis 0x%02x (%d)", axisindex, axisindex); + printAxisType(axisindex); + + if(ioctl(fd, EVIOCGABS(axisindex), &abs_features)) + { + perror("evdev EVIOCGABS ioctl"); + return 1; + } + + if(deadzonevalue != -1) + { + if(deadzonevalue < abs_features.minimum || + deadzonevalue > abs_features.maximum ) + { + printf("Deadzone value must be between %d and %d for this axis, " + "value requested : %d\n", + abs_features.minimum, abs_features.maximum, deadzonevalue); + } + + printf("Setting deadzone value to : %d\n", deadzonevalue); + abs_features.flat = deadzonevalue; + } + + if(fuzzvalue != -1) + { + if(fuzzvalue < abs_features.minimum || + fuzzvalue > abs_features.maximum ) + { + printf("Fuzz value must be between %d and %d for this axis, " + "value requested : %d\n", + abs_features.minimum, abs_features.maximum, fuzzvalue); + } + + printf("Setting fuzz value to : %d\n", fuzzvalue); + abs_features.fuzz = fuzzvalue; + } + + if(ioctl(fd, EVIOCSABS(axisindex), &abs_features)) + { + perror("evdev EVIOCSABS ioctl"); + return 1; + } + if(ioctl(fd, EVIOCGABS(axisindex), &abs_features)) + { + perror("evdev EVIOCGABS ioctl"); + return 1; + } + percent_deadzone = (float)abs_features.flat * 100 / (float)abs_features.maximum; + printf(" (min: %d, max: %d, flatness: %d (=%.2f%%), fuzz: %d)\n", + abs_features.minimum, abs_features.maximum, abs_features.flat, + percent_deadzone, abs_features.fuzz); + } + } + + close(fd); + return 0; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int main(int argc, char* argv[]) +{ + char* evdevice = NULL; + int c, axisindex = -1; + __s32 flat = -1, fuzz = -1; + + // Show help by default + if(argc == 1) + { + help(); + exit(0); + } + + while(1) + { + static struct option long_options[] = + { + { "help", no_argument, 0, 'h' }, + { "listdevs", no_argument, 0, 'l' }, + { "showcal", required_argument, 0, 's' }, + { "evdev", required_argument, 0, 'e' }, + { "deadzone", required_argument, 0, 'd' }, + { "fuzz", required_argument, 0, 'f' }, + { "axis", required_argument, 0, 'a' }, + { 0, 0, 0, 0 } + }; + // getopt_long stores the option index here + int option_index = 0; + + c = getopt_long(argc, argv, "h:l:s:e:d:f:a:", long_options, &option_index); + + // Detect the end of the options + if(c == -1) + break; + + switch(c) + { + case 0: + // If this option set a flag, do nothing else now. + if(long_options[option_index].flag != 0) + break; + printf("option %s", long_options[option_index].name); + if(optarg) + printf(" with arg %s", optarg); + printf("\n"); + break; + + case 'h': + help(); + break; + + case 'l': + listDevices(); + break; + + case 's': + evdevice = optarg; + showCalibration(evdevice); + break; + + case 'e': + evdevice = optarg; + printf("Event device file: %s\n", evdevice); + break; + + case 'd': + flat = atoi(optarg); + printf("New dead zone value: %d\n", flat); + break; + + case 'f': + fuzz = atoi(optarg); + printf("New fuzz value: %d\n", fuzz); + break; + + case 'a': + axisindex = atoi(optarg); + printf("Axis index to deal with: %d\n", axisindex); + break; + + case '?': + // getopt_long already printed an error message. + break; + + default: + abort(); + } + } + + // Print any remaining command line arguments (not options). + if(optind < argc) + { + printf("non-option ARGV-elements: "); + while(optind < argc) + printf("%s ", argv[optind++]); + putchar('\n'); + } + + if(flat != -1 || fuzz != -1) + { + if(evdevice == NULL) + { + printf( "You must specify the event device for your joystick\n" ); + exit(1); + } + else + { + if(axisindex == -1) + { + if(flat != -1) + printf( "Trying to set all axes deadzone to: %d\n", flat); + if(fuzz != -1) + printf( "Trying to set all axes fuzz to: %d\n", fuzz); + } + else + { + if(flat != -1) + printf( "Trying to set axis %d deadzone to: %d\n", axisindex, flat); + if(fuzz != -1) + printf( "Trying to set axis %d fuzz to: %d\n", axisindex, fuzz); + } + + setDeadzoneAndFuzz(evdevice, axisindex, flat, fuzz); + } + } + + exit(0); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/utils/ffcfstress.c new/linuxconsoletools-1.5.1/utils/ffcfstress.c --- old/linuxconsoletools-1.4.9/utils/ffcfstress.c 2013-02-20 21:15:44.000000000 +0100 +++ new/linuxconsoletools-1.5.1/utils/ffcfstress.c 2016-01-14 20:39:19.000000000 +0100 @@ -21,6 +21,8 @@ * 02110-1301 USA. */ +#define _DEFAULT_SOURCE + #include <linux/input.h> #include <sys/ioctl.h> #include <stdio.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/utils/inputattach.c new/linuxconsoletools-1.5.1/utils/inputattach.c --- old/linuxconsoletools-1.4.9/utils/inputattach.c 2016-01-09 16:27:02.000000000 +0100 +++ new/linuxconsoletools-1.5.1/utils/inputattach.c 2016-01-14 20:35:56.000000000 +0100 @@ -32,6 +32,8 @@ * 02110-1301 USA. */ +#define _DEFAULT_SOURCE + #include <ctype.h> #include <errno.h> #include <fcntl.h> @@ -41,6 +43,7 @@ #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> +#include <sys/select.h> #include <termios.h> #include <unistd.h> #ifdef SYSTEMD_SUPPORT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxconsoletools-1.4.9/utils/jstest.c new/linuxconsoletools-1.5.1/utils/jstest.c --- old/linuxconsoletools-1.4.9/utils/jstest.c 2013-02-20 21:15:36.000000000 +0100 +++ new/linuxconsoletools-1.5.1/utils/jstest.c 2016-01-14 20:36:49.000000000 +0100 @@ -31,6 +31,8 @@ * 02110-1301 USA. */ +#define _DEFAULT_SOURCE + #include <sys/ioctl.h> #include <sys/time.h> #include <sys/types.h> @@ -55,13 +57,34 @@ "?", "?", "?", "?", "?", "?", "?", }; +/* These must match the constants in include/uapi/linux/input.h */ char *button_names[KEY_MAX - BTN_MISC + 1] = { -"Btn0", "Btn1", "Btn2", "Btn3", "Btn4", "Btn5", "Btn6", "Btn7", "Btn8", "Btn9", "?", "?", "?", "?", "?", "?", -"LeftBtn", "RightBtn", "MiddleBtn", "SideBtn", "ExtraBtn", "ForwardBtn", "BackBtn", "TaskBtn", "?", "?", "?", "?", "?", "?", "?", "?", -"Trigger", "ThumbBtn", "ThumbBtn2", "TopBtn", "TopBtn2", "PinkieBtn", "BaseBtn", "BaseBtn2", "BaseBtn3", "BaseBtn4", "BaseBtn5", "BaseBtn6", "BtnDead", -"BtnA", "BtnB", "BtnC", "BtnX", "BtnY", "BtnZ", "BtnTL", "BtnTR", "BtnTL2", "BtnTR2", "BtnSelect", "BtnStart", "BtnMode", "BtnThumbL", "BtnThumbR", "?", -"?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", -"WheelBtn", "Gear up", + /* BTN_0, 0x100, to BTN_9, 0x109 */ + "Btn0", "Btn1", "Btn2", "Btn3", "Btn4", "Btn5", "Btn6", "Btn7", "Btn8", "Btn9", + /* 0x10a to 0x10f */ + "?", "?", "?", "?", "?", "?", + /* BTN_LEFT, 0x110, to BTN_TASK, 0x117 */ + "LeftBtn", "RightBtn", "MiddleBtn", "SideBtn", "ExtraBtn", "ForwardBtn", "BackBtn", "TaskBtn", + /* 0x118 to 0x11f */ + "?", "?", "?", "?", "?", "?", "?", "?", + /* BTN_TRIGGER, 0x120, to BTN_PINKIE, 0x125 */ + "Trigger", "ThumbBtn", "ThumbBtn2", "TopBtn", "TopBtn2", "PinkieBtn", + /* BTN_BASE, 0x126, to BASE6, 0x12b */ + "BaseBtn", "BaseBtn2", "BaseBtn3", "BaseBtn4", "BaseBtn5", "BaseBtn6", + /* 0x12c to 0x12e */ + "?", "?", "?", + /* BTN_DEAD, 0x12f */ + "BtnDead", + /* BTN_A, 0x130, to BTN_TR2, 0x139 */ + "BtnA", "BtnB", "BtnC", "BtnX", "BtnY", "BtnZ", "BtnTL", "BtnTR", "BtnTL2", "BtnTR2", + /* BTN_SELECT, 0x13a, to BTN_THUMBR, 0x13e */ + "BtnSelect", "BtnStart", "BtnMode", "BtnThumbL", "BtnThumbR", + /* 0x13f */ + "?", + /* Skip the BTN_DIGI range, 0x140 to 0x14f */ + "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", + /* BTN_WHEEL / BTN_GEAR_DOWN, 0x150, to BTN_GEAR_UP, 0x151 */ + "WheelBtn", "Gear up", }; #define NAME_LENGTH 128
