From e652c1c9b774ec3236fbcec84ae722d6685425ba Mon Sep 17 00:00:00 2001 From: Packit Date: Sep 15 2020 13:00:44 +0000 Subject: linuxconsoletools-1.6.0 base --- diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d159169 --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e6f8e64 --- /dev/null +++ b/Makefile @@ -0,0 +1,42 @@ +# $Id: Makefile 2413 2011-04-03 17:24:32Z skitt $ +# +# Makefile for Linux input utilities +# +# © 2011-2016 Stephen Kitt +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA. + +VERSION := 1.6.0 + +PACKAGE := linuxconsoletools-$(VERSION) + +all: compile + +clean distclean compile: + $(MAKE) -C utils $@ + +install: + $(MAKE) -C utils $@ + $(MAKE) -C docs $@ + +dist: clean + rm -rf $(PACKAGE) + mkdir $(PACKAGE) + cp -a docs utils COPYING Makefile NEWS README $(PACKAGE) + (cd $(PACKAGE); find . -name .svn -o -name *~ | xargs rm -rf; rm docs/FB-Driver-HOWTO docs/console.txt) + tar cjf $(PACKAGE).tar.bz2 $(PACKAGE) + +.PHONY: all clean distclean compile install dist diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e54d8ae --- /dev/null +++ b/NEWS @@ -0,0 +1,165 @@ +Version 1.6.0 +------------- + +* inputattach supports the Pulse-Eight HDMI CEC dongle (this requires + kernel 4.8 or later; thanks to Hans Verkuil ). + +* evdev-joystick can set the minimum and maximum axis values (thanks + to Jon Sangster ). + +* The udev rules are installed without executable permissions. + +* The evdev-joystick manpage is installed along with the other + manpages. + +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 +------------- + +* inputattach supports a new mouseman4 mode for 4-button Logitech mice + (thanks to Jamie Lentin ). + +* inputattach supports EETI eGalaxTouch touchscreens (thanks to + Böszörményi Zoltán ). + +* inputattach can provide a "ready" notification to systemd (thanks to + Böszörményi Zoltán ). + +* js-set-enum-leds no longer uses hotplug.functions. + +Version 1.4.8 +------------- + +* Set up PS3 controller LEDs correctly (thanks to bri + ). + +* inputattach supports Wacom IV tablets on kernels 3.17 and greater + (thanks to Julian Squires ). + +Version 1.4.7 +------------- + +* Correctly handle newer versions of the Spaceball firwmare (thanks to + Andrew Basterfield ). This fixes Debian + #298494. + +Version 1.4.6 +------------- + +* The force-feedback test tools (ffmvforce, ffset, fftest) now handle + device names longer than 64 characters (thanks to Ralf Jung + ). This fixes Debian #706744. + +Version 1.4.5 +------------- + +* inputattach no longer loops forever in certain situations (thanks to + Josh Bowman for the pointer). + +* Improvements to the force-feedback tools, available elsewhere, have + been merged (thanks to Jaromir Capik ). + +* ELO touchscreens apparently don't work with CRTSCTS, so it's no + longer set (thanks to Thierry Bultel ). + This fixes Debian #699030. + + +Version 1.4.4 +------------- + +* jstest --select correctly resets the timeout, and no longer ends up + using all the CPU. + +* inputattach builds on kernels without TSC-40 support (thanks to Kyle + Manna ). + +* inputattach now supports Genius EasyPen 3x4 tablets on kernels with + the appropriate module (thanks to Denis Gonsiorovsky + ). + + +Version 1.4.3 +------------- + +* inputattach supports PenMount 3000, 6000 and 6250 devices (thanks to + John Sung ) and TSC-40 devices (thanks to + Christian Gmeiner ). + + +Version 1.4.2 +------------- + +* The udev rule matching w8001 devices has been split to handle + devices using different baud rates, and the different baud rates are + documented. + +* inputattach no longer resets the line discipline before exiting when + it discovers the device is already managed by another inputattach + instance. + +* jscal-store creates its target directory if necessary. + + +Version 1.4.1 +------------- + +* inputattach correctly handles non-retry errors other than EINTR + (thanks to Alexander Clouter for the patch). + + +Version 1.4 +----------- + +* inputattach no longer aborts when it receives a recoverable signal + (thanks to Kees Cook for the patch). + + +Version 1.4rc1 +-------------- + +The following user-visible changes have been made since the last +commonly used snapshot (20051019): + +* inputattach has been cleaned up, and now supports the following new + devices: + - Sahara Touch-iT213 + - PS/2 multiplexers on TQM85xx boards + - Zhen Hua PCM-4CH RC transmitters + - TAOS evaluation modules + - Wacom W8001 + - Microtouch, Touchright, Touchwindow, Penmount and Fujitsu + touchscreens + +* jscal tolerates greater jitter (so joysticks which don't send stable + values can still be calibrated). + +* jscal supports axis and button remapping. + +* Various USB devices which caused jscal and/or jstest to segfault are + now handled correctly. + +* jscal-store and jscal-restore allow joystick calibration and + remapping settings to be stored and restored. + +* Documentation is provided, with manpages for all the provided + utilities and sample udev rules. + +In addition, the 20051019 snapshot included the following user-visible +changes since version 1.2.15: + +* jstest includes axis and button names. + +* New utilities: + - inputattach connects devices to the input layer, allowing them to + be used even if they are not directly supported; + - force-feedback utilities; + - evtest event-layer monitoring utility. diff --git a/README b/README new file mode 100644 index 0000000..a626a22 --- /dev/null +++ b/README @@ -0,0 +1,255 @@ + linuxconsole tools + Release 1.5.1 + http://sf.net/projects/linuxconsole/ + + +This package contains the following utilities and associated +documentation: +* inputattach - connects legacy serial devices to the input layer +* joystick utilities - calibrate and test joysticks and joypads + +The evtest tool, which used to be part of this package, is now +maintained separately at http://cgit.freedesktop.org/evtest/ and +https://bugzilla.freedesktop.org/enter_bug.cgi?product=evtest + + +Joystick utilities +------------------ + +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 +* jscal-store, jscal-restore - store and retrieve joystick device + settings as configured using jscal +* jstest - test joystick devices + +The typical scenario when configuring a new device is as follows: +1. Check the basic functions using jstest (number of buttons, axes, + etc.). +2. Calibrate the joystick using jscal (this can be useful even if the + device functions correctly, if only to configure the dead-zone at + the centre). +3. Repeat steps 1 and 2 until the joystick is configured to the user's + satisfaction. +4. Store the device's setup using jscal-store. + + +Installation +------------ + +Most of the utilities have no particular requirement beyond a libc and +the Linux input layer headers (normally part of your libc +installation). ffmvforce requires SDL (libsdl1.2-dev on Debian +derivatives). + +To install the utilities and their manpages, run + make +or + make SYSTEMD_SUPPORT=1 +and then as root + make install +from the distribution's top directory. This will install everything +into /usr/local. Should you wish to install the tools elsewhere, you +can use the PREFIX variable: + PREFIX=/usr make install +The Makefiles also recognise the DESTDIR variable which can be used to +install into a temporary directory (this is useful mainly for +distribution packagers). + + +Auto-loading inputattach and jscal-restore +------------------------------------------ + +udev can be used to start inputattach and jscal-restore when the +appropriate device is connected to the system (or detected when the +system is booting up). + +The following rule restores the stored calibration and axis/button +mappings whenever a joystick device is connected: + KERNEL=="js*", ACTION=="add", RUN+="/usr/bin/jscal-restore %E{DEVNAME}" +(change the path as appropriate). This rule needs /usr to be +available, which can cause issues on systems where udev is run from +the initramfs or where /usr is a separate partition. To work around +this, the Debian package uses a script provided by Debian's udev +package to wait for jscal-restore to become available. Should you wish +to reproduce this, you need to create a udev agent +(/lib/udev/jscal-restore) containing the following: + +#!/bin/sh -e +# udev agent for jscal-restore + +wait_for_file() { + local file=$1 + local count=120 + while [ $count != 0 ]; do + [ -e "$file" ] && return 0 + sleep 1 + count=$(($count - 1)) + done + exit 1 +} + +( + wait_for_file /usr/bin/jscal-restore + exec /usr/bin/jscal-restore $1 +) & + +and change the udev rule to + KERNEL=="js*", ACTION=="add", RUN+="/lib/udev/jscal-restore %E{DEVNAME}" + +The following rule forces flaky Acrux gamepads to stay awake: + KERNEL=="js*", ACTION=="add", ATTRS{name}=="ACRUX USB GAMEPAD 8116", RUN+="/bin/sleep 5000 < /dev/%k" +(This should only be necessary on kernels older than 2.6.39-rc1.) + +The following rule configures a Mouse Systems mouse on the first +serial port: + KERNEL=="ttyS0", ACTION=="add", RUN+="/usr/bin/inputattach --daemon -msc /dev/%k" +If you need to wait for /usr you can adapt the recipe above. + +The following rules configures a Wacom W8001 devices on a Fujitsu +T2010[2] or on Lenovo X200-series laptops and tablets: + SUBSYSTEM=="tty", KERNEL=="ttyS[0-9]*", ATTRS{id}=="FUJ02e5", ACTION=="add|change", RUN+="/usr/bin/inputattach --daemon --baud 19200 --w8001 /dev/%k" + SUBSYSTEM=="tty", KERNEL=="ttyS[0-9]*", ATTRS{id}=="WACf00c", ACTION=="add|change", RUN+="/usr/bin/inputattach --daemon --baud 38400 --w8001 /dev/%k" + +These rules are liable to cause conflicts with the X.org wacom +driver. For example, on some Debian-based systems the +/usr/share/X11/xorg.conf.d/50-wacom.conf configuration file needs to +be amended so that the "MatchProduct" line matching one of the +identifiers used above ("FUJ02e5" or "WACf00c", the latter being +matched by "WACf") no longer contains the matching identifier. The +appropriate X.org driver when using inputattach in this way is evdev. + +A udev rule, especially shipped in a custom OS package is not +always applicable because it cannot handle the conflict presented +by the fact that not all computers are built the same and on one +computer, e.g ttyS1 can be attached to a specific touchscreen, +in another computer it can be attached to a different kind of +touchscreen or a different device or connected at all. +For this case, a wrapper script started from sysvinit, upstart, or +systemd is better suited. systemd needs special treatment inside +inputattach: a notification must be sent to it when inputattach +becomes "ready". To achieve this, the previously mentioned +"make SYSTEMD_SUPPORT=1" must be used to include this support. +Then a systemd unit file and the wrapper script can be added, similar +to the following: + +----8<---- inputattach-wrapper.sh ----8<---- +#!/bin/sh + +SYSTEM=`detect_computer_type` +case $SYSTEM in +type1) + inputattach --daemon -pm9k /dev/ttyS2 + ;; +type2) + inputattach --daemon -mtouch /dev/ttyS2 + ;; +# and so on +*) + # do nothing for other computers + ;; +esac + +# Exit without errors, so systemd won't try to +# restart our script for the "do nothing" case. +exit 0 +----8<- end of inputattach-wrapper.sh-8<---- + +----8<---- inputattach.service ----8<---- +[Unit] +Description=inputattach helper service + +[Service] +Type=forking +NotifyAccess=all +ExecStart=/usr/sbin/inputattach-wrapper.sh + +[Install] +WantedBy=multi-user.target +----8<- end of inputattach.service----8<---- + +Configuring PS3 controller LEDs +------------------------------- + +The js-set-enum-leds can be used with udev to ensure that the +controller LEDs on PS3 controllers match their identifiers as set by +Bluetooth host software. This ensures that if the controllers are +plugged in before the Bluetooth daemon starts, the LEDs still match +the identifier assigned once the daemon has initialised. + +The following udev rule achieves this: + + # Set PS3 controller leds to the same value bluez will choose for it. + # IMPORT{parent} used because $parent did not appear to be working; we + # don't need the devpath of the js device for this so it is OK to overwrite. + ACTION=="add", KERNEL=="js*", IMPORT{parent}="DEVPATH", ATTRS{name}=="Sony PLAYSTATION(R)3 Controller", RUN+="/lib/udev/js-set-enum-leds /sys/%E{DEVPATH}/device/leds/ $number" + + +Contributors +------------ + +The following people have contributed to this release: +* Johann Walles: jscal jitter tolerance. +* Dr. László Kaján: button and axis remapping. +* Sebastian Siewior: EVIOCGBIT correction. +* Krzysztof A. Sobiecki: improvements to the button and axis remapping + functions. +* Claudio Nieder: Sahara Touch-iT213 support. +* Florian Fainelli: evtest fixes. +* Alexander Clouter: W8001 support and error-handling fixes. +* Roberto Neri: much discussion, and fixes and improvements to + jscal-store/jscal-restore and the udev rules given above. +* Jean Delvare: inputattach improvements, TAOS support. +* Brian Murray and Kees Cook: Lenovo W8001 support. +* Raoul Bönish: fixes for the udev rules. +* John Sung: PenMount 3000, 6000 and 6250 support. +* Christian Gmeiner: TSC-40 support. +* Kyle Manna: various build fixes. +* Denis Gonsiorovsky: Genius EasyPen 3x4 tablet support. +* Jaromir Capik: 64-bit fixes and changes from ff-utils (based on a + patch originally by Jean-Philippe Meure). +* Ralf Jung: fixes for long device names. +* Andrew Basterfield: fix for Spaceball 4000FLX support. +* bri: PS3 controller LED configuration +* Julian Squires: Wacom IV support. +* Jamie Lentin: mouseman4 mode. +* Böszörményi Zoltán: eGalaxTouch support, Hampshire support, systemd + notification. +* Stephen Anthony: evdev-joystick (based on G25manage). +* Hans Verkuil: Pulse-Eight HDMI CEC dongle support. +* Jon Sangster: min/max axis control in evdev-joystick. + + +License +------- + +The linuxconsole tools are + Copyright © 1996-2005 Vojtech Pavlik + Copyright © 2001 Oliver Hamann + 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 +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, +USA. + + +The GNU General Public License version 2 is provided in the COPYING +file. diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..fe029f4 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,32 @@ +# $Id: Makefile 2413 2011-04-03 17:24:32Z skitt $ +# +# Makefile for Linux input utilities +# +# © 2011, 2016 Stephen Kitt +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA. + +MANPAGES = inputattach.1 jstest.1 jscal.1 fftest.1 \ + ffmvforce.1 ffset.1 ffcfstress.1 jscal-store.1 \ + jscal-restore.1 evdev-joystick.1 + +PREFIX ?= /usr/local + +install: + install -d $(DESTDIR)$(PREFIX)/share/man/man1 + install -m644 $(MANPAGES) $(DESTDIR)$(PREFIX)/share/man/man1 + +.PHONY: install diff --git a/docs/evdev-joystick.1 b/docs/evdev-joystick.1 new file mode 100644 index 0000000..bcd98d0 --- /dev/null +++ b/docs/evdev-joystick.1 @@ -0,0 +1,85 @@ +.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 [ \-\-minimum +.RI < value >] +.RB [ \-\-maximum +.RI < value >] +.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 \-\-m ", " \-\-minimum " <" \fIvalue\fP > +Change the minimum for the current joystick. +.TP +.BR \-\-M ", " \-\-maximum " <" \fIvalue\fP > +Change the maximum for the current joystick. +.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 . diff --git a/docs/evdev-joystick.txt b/docs/evdev-joystick.txt new file mode 100644 index 0000000..9f23522 --- /dev/null +++ b/docs/evdev-joystick.txt @@ -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 ' + Again, for me, this will output the following: + + Absolute axis 0x00 (0) (X Axis) (value: 132, min: 0, max: 4095, flatness: 128 (=0.00%), fuzz: 15) + Absolute axis 0x01 (1) (Y Axis) (value: 127, min: 0, max: 4095, flatness: 128 (=0.00%), fuzz: 15) + Absolute axis 0x02 (2) (Z Axis) (value: 0, 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 --d 0' + +8) Now check the current deadzone again by typing: + 'evdev-joystick --s ' + + Absolute axis 0x00 (0) (X Axis) (value: 132, min: 0, max: 4095, flatness: 0 (=0.00%), fuzz: 15) + Absolute axis 0x01 (1) (Y Axis) (value: 127, min: 0, max: 4095, flatness: 0 (=0.00%), fuzz: 15) + Absolute axis 0x02 (2) (Z Axis) (value: 0, 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 --git a/docs/ffcfstress.1 b/docs/ffcfstress.1 new file mode 100644 index 0000000..e09ac6f --- /dev/null +++ b/docs/ffcfstress.1 @@ -0,0 +1,54 @@ +.TH ffcfstress 1 "March 8, 2009" ffcfstress +.SH NAME +ffcfstress \- constant force stress test for force-feedback devices +.SH SYNOPSIS +.B ffcfstress +.RB "[" \-d " <\fIdevice\fP>] [" \-u " <\fIupdate rate\fP>] [" \-f " <\fIfrequency\fP>] [" \-a " <\fIamplitude\fP>] [" \-s " <\fIstrength\fP>] [" \-x " <\fIaxis\fP>] [" \-A "] [" \-o "]" +.SH "DESCRIPTION" +ffcfstress stress tests constant non-enveloped forces on a force +feedback device. +It simulates a moving spring force by applying a frequently updated +constant force effect. +.PP +.B Beware, the stress test may damage your device! +.SH OPTIONS +At least one option is required. +.TP +.BR \-d " <\fIdevice\fP>" +The device to test (by default \fI/dev/input/event0\fR). +.TP +.BR \-u " <\fIupdate rate\fP>" +The update rate in Hz (25 by default). +.TP +.BR \-f " <\fIfrequency\fP>" +The spring center motion frequency in Hz (0.1 by default). +.TP +.BR \-a " <\fIamplitude\fP>" +The spring center motion amplitude, between 0.0 and 1.0 (1.0 by +default). +.TP +.BR \-s " <\fIstrength\fP>" +The spring strength factor (1.0 by default). +.TP +.BR \-x " <\fIaxis\fP>" +absolute axis to test (default: 0) +.br +[0 = X, 1 = Y, 2 = Z, 3 = RX, 4 = RY, 5 = RZ, 6 = WHEEL] +.TP +.B \-A +switch off auto-centering +.TP +.B \-o +Dummy option, useful when all defaults should be used. +.SH SEE ALSO +\fBffmvforce\fP(1), \fBfftest\fP(1), \fBjstest\fP(1). +.SH AUTHOR +.B ffcfstress +was written by Oliver Hamann. +.PP +This manual page was written by Stephen Kitt , for the Debian +GNU/Linux system (but may be used by others). +It was last modified for +.B ffcfstress +dated February 15, 2002. + diff --git a/docs/ffmvforce.1 b/docs/ffmvforce.1 new file mode 100644 index 0000000..3468c87 --- /dev/null +++ b/docs/ffmvforce.1 @@ -0,0 +1,30 @@ +.TH ffmvforce 1 "March 8, 2009" ffmvforce +.SH NAME +ffmvforce \- force orientation test for force-feedback devices +.SH SYNOPSIS +.B ffmvforce +.RI "<" device "> [\fB-u\fP <" "update rate" ">]" +.SH "DESCRIPTION" +ffmvforce generates a force in a given direction, indicated by the +position of the mouse pointer in relation to the center of the tool's +window. +.PP +.B Beware, the stress test may damage your device! +.SH OPTIONS +.TP +.RI "<" device ">" +The device to test. +.TP +.BR \-u " <\fIupdate rate\fP>" +The update rate in Hz (5 by default). +.SH SEE ALSO +\fBffcfstress\fP(1), \fBfftest\fP(1), \fBjstest\fP(1). +.SH AUTHOR +.B ffmvforce +was written by Oliver Hamann. +.PP +This manual page was written by Stephen Kitt , for the Debian +GNU/Linux system (but may be used by others). +It was last modified for +.B ffmvforce +dated February 15, 2002. diff --git a/docs/ffset.1 b/docs/ffset.1 new file mode 100644 index 0000000..d554526 --- /dev/null +++ b/docs/ffset.1 @@ -0,0 +1,30 @@ +.TH ffset 1 "March 8, 2009" ffset +.SH NAME +ffset \- set force-feedback device parameters +.SH SYNOPSIS +.B ffset +.RI "<" device "> [\fB\-g\fP <" gain ">] [\fB\-a\fP <" "autocenter strength" ">]" +.SH "DESCRIPTION" +ffset sets the gain and autocenter strength of a force-feedback +device. +.SH OPTIONS +.TP +.RI "<" device ">" +The device to configure. +.TP +.BR \-g " <\fIgain\fP>" +The gain (0-100). +.TP +.BR \-a " <\fIautocenter strength\fP>" +The autocenter strength (0-100). +.SH SEE ALSO +\fBffcfstress\fP(1), \fBffmvforce\fP(1), \fBfftest\fP(1), \fBjscal\fP(1), \fBjstest\fP(1). +.SH AUTHOR +.B ffset +was written by Johann Deneux. +.PP +This manual page was written by Stephen Kitt , for the +Debian GNU/Linux system (but may be used by others). +It was last modified for +.B ffmvforce +dated May 30, 2001. diff --git a/docs/fftest.1 b/docs/fftest.1 new file mode 100644 index 0000000..2179030 --- /dev/null +++ b/docs/fftest.1 @@ -0,0 +1,25 @@ +.TH fftest 1 "March 8, 2009" fftest +.SH NAME +fftest \- tests force-feedback devices. +.SH SYNOPSIS +.B fftest +.RI "<" device ">" +.SH "DESCRIPTION" +fftest provides a variety of tests which can be applied to +force-feedback devices. +.B Beware, the tests may damage your device! +.SH OPTIONS +.TP +.RI "<" device ">" +The device to test. +.SH SEE ALSO +\fBffcfstress\fP(1), \fBffmvforce\fP(1), \fBjstest\fP(1). +.SH AUTHOR +.B fftest +was written by Johann Deneux. +.PP +This manual page was written by Stephen Kitt , for the Debian +GNU/Linux system (but may be used by others). +It was last modified for +.B fftest +dated October 19, 2004. diff --git a/docs/inputattach.1 b/docs/inputattach.1 new file mode 100644 index 0000000..4a4260c --- /dev/null +++ b/docs/inputattach.1 @@ -0,0 +1,178 @@ +.TH inputattach 1 "January 9, 2016" inputattach +.SH NAME +inputattach \- attach a serial line to an input-layer device +.SH SYNOPSIS +.BR inputattach " [" \-\-daemon "] [" \-\-always "] [" \-\-noinit "] [" \-\-baud +.IR baud ">] <" mode "> <" device ">" +.SH DESCRIPTION +.B inputattach +attaches a serial line to an input-layer device via a line +discipline. +.PP +Exactly one of the available modes must be specified on the command +line. +.SH OPTIONS +.TP +.B \-\-daemon +Forks into the background. +.TP +.B \-\-always +Ignore initialization failures when attaching the device. +.TP +.B \-\-noinit +Skip device initialization. +.TP +.B \-\-baud +Specify the baud rate to use. (This is only necessary if the default +rate is incorrect.) +.SS Modes +.TP +.BR \-dump ", " \-\-dump +Just enable device. +.TP +.BR \-eeti ", " \-\-eetiegalax +EETI eGalaxTouch. +.TP +.BR \-ep ", " \-\-easypen +Genius EasyPen 3x4 tablet. +.TP +.BR \-elo3b ", " \-\-elo261-280 +ELO Touchscreen, 3-byte mode. +.TP +.BR \-elo4b ", " \-\-elo271-140 +ELO touchscreen, 4-byte mode. +.TP +.BR \-elo6b ", " \-\-elo4002 +ELO touchscreen, 6-byte mode. +.TP +.BR \-elo ", " \-\-elotouch +ELO touchscreen, 10-byte mode. +.TP +.BR \-fjt ", " \-\-fujitsu +Fujitsu serial touchscreen. +.TP +.BR \-ipaq ", " \-\-h3600ts +Ipaq h3600 touchscreen. +.TP +.BR \-ham ", " \-\-hampshire +Hampshire touchscreen. +.TP +.BR \-ifor ", " \-\-iforce +I-Force joystick or wheel. +.TP +.BR \-ms3 ", " \-\-intellimouse +Microsoft IntelliMouse. +.TP +.BR \-lk ", " \-\-lkkbd +DEC LK201 / LK401 keyboards. +.TP +.BR \-mag ", " \-\-magellan +Magellan / SpaceMouse. +.TP +.BR \-bare ", " \-\-microsoft +2-button Microsoft mouse. +.TP +.BR \-mmw ", " \-\-mmwheel +Logitech mouse with 4-5 buttons or a wheel. +.TP +.BR \-mman4 ", " \-\-mouseman4 +4-button Logitech / Genius mouse. +.TP +.BR \-mman ", " \-\-mouseman +3-button Logitech / Genius mouse. +.TP +.BR \-msc ", " \-\-mousesystems +3-button Mouse Systems mouse. +.TP +.BR \-ms ", " \-\-mshack +3-button mouse in Microsoft mode. +.TP +.BR \-mtouch ", " \-\-mtouch +MicroTouch (3M) touchscreen. +.TP +.BR \-newt ", " \-\-newtonkbd +Newton keyboard. +.TP +.BR \-pm3k ", " \-\-penmount3000 +PenMount 3000 touchscreen. +.TP +.BR \-pm6k ", " \-\-penmount6000 +PenMount 6000 touchscreen. +.TP +.BR \-pmm1 ", " \-\-penmount6250 +PenMount 6250 touchscreen. +.TP +.BR \-pm9k ", " \-\-penmount9000 +PenMount 9000 touchscreen. +.TP +.BR \-ps2m ", " \-\-ps2mult +PS/2 serial multiplexer. +.TP +.BR \-ps2ser ", " \-\-ps2serkbd +PS/2 via serial keyboard. +.TP +.BR \-pulse8\-cec ", " \-\-pulse8\-cec +Pulse Eight HDMI CEC dongle. +.TP +.BR \-sbl ", " \-\-spaceball +SpaceBall 2003 / 3003 / 4000 FLX. +.TP +.BR \-orb ", " \-\-spaceorb +SpaceOrb 360 / SpaceBall Avenger. +.TP +.BR \-sting ", " \-\-stinger +Gravis Stinger. +.TP +.BR \-ipaqkbd ", " \-\-stowawaykbd +Stowaway keyboard. +.TP +.BR \-skb ", " \-\-sunkbd +Sun Type 4 and Type 5 keyboards. +.TP +.BR \-sun ", " \-\-sunmouse +3-button Sun mouse. +.TP +.BR \-taos ", " \-\-taos\-evm +TAOS evaluation module. +.TP +.BR \-t213 ", " \-\-touchit213 +Sahara Touch-iT213 Tablet PC. +.TP +.BR \-tr ", " \-\-touchright +Touchright serial touchscreen. +.TP +.BR \-tw ", " \-\-touchwin +Touchwindow serial touchscreen. +.TP +.BR \-tsc ", " \-\-tsc +TSC-10/25/40 serial touchscreen. +.TP +.BR \-twidjoy ", " \-\-twiddler-joy +Handykey Twiddler used as a joystick. +.TP +.BR \-twid ", " \-\-twiddler +Handykey Twiddler chording keyboard. +.TP +.BR \-vs ", " \-\-vsxxx-aa +DEC VSXXX-AA / VSXXX-GA mouse and VSXXX-A tablet. +.TP +.BR \-w8001 ", " \-\-w8001 +Wacom W8001 pen and/or touch devices. The default baud rate, 38400bps, +allows for touch-only or pen and touch devices; for pen-only devices, +"\fB\-\-baud 19200\fP" must be specified. +.TP +.BR \-wacom_iv ", " \-\-wacom_iv +Wacom protocol IV tablet. +.TP +.BR \-war ", " \-\-warrior +WingMan Warrior. +.TP +.BR \-zhen ", " \-\-zhen-hua +Zhen Hua 5-byte protocol. +.SH AUTHORS +.B inputattach +was written by Vojtech Pavlik and Arndt Schoenewald, and improved by +many others; see the linuxconsole tools documentation for details. +.PP +This manual page was written by Stephen Kitt , for the Debian +GNU/Linux system (but may be used by others). diff --git a/docs/jscal-restore.1 b/docs/jscal-restore.1 new file mode 100644 index 0000000..8c52f19 --- /dev/null +++ b/docs/jscal-restore.1 @@ -0,0 +1,26 @@ +.TH jscal-restore 1 "May 25, 2011" jscal-restore +.SH NAME +jscal-restore \- restores joystick calibration +.SH SYNOPSIS +.BR jscal-restore +.RI "<" device-name ">" +.SH DESCRIPTION +.B jscal-restore +restores the calibration and mapping information for the given +joystick device, previously stored by the +.B jscal-store +command. +.PP +An appropriate rule can be set up with udev so that any stored +calibration settings are restored when the relevant device is +connected. Some distributions (at least Debian, Ubuntu and Slackware) +provide joystick packages which install such rules automatically. +.SH FILES +.TP +/var/lib/joystick/joystick.state +File used to store the calibration settings. +.SH SEE ALSO +\fBjscal\fP(1), \fBjscal-store\fP(1). +.SH AUTHOR +.B jscal-restore +was written by Stephen Kitt. diff --git a/docs/jscal-store.1 b/docs/jscal-store.1 new file mode 100644 index 0000000..949bdbc --- /dev/null +++ b/docs/jscal-store.1 @@ -0,0 +1,26 @@ +.TH jscal-store 1 "April 7, 2010" jscal-store +.SH NAME +jscal-store \- stores joystick calibration +.SH SYNOPSIS +.BR jscal-store +.RI "<" device-name ">" +.SH DESCRIPTION +.B jscal-store +stores the calibration and mapping information for the given joystick +device. This information can later be restored using the +.B jscal-restore +command. +.PP +An appropriate rule can be set up with udev so that any stored +calibration settings are restored when the relevant device is +connected. Some distributions (at least Debian, Ubuntu and Slackware) +provide joystick packages which install such rules automatically. +.SH FILES +.TP +/var/lib/joystick/joystick.state +File used to store the calibration settings. +.SH SEE ALSO +\fBjscal\fP(1), \fBjscal-restore\fP(1). +.SH AUTHOR +.B jscal-store +was written by Stephen Kitt. diff --git a/docs/jscal.1 b/docs/jscal.1 new file mode 100644 index 0000000..32affc4 --- /dev/null +++ b/docs/jscal.1 @@ -0,0 +1,80 @@ +.TH jscal 1 "Jul 11, 2010" jscal +.SH NAME +jscal \- joystick calibration and remapping program +.SH SYNOPSIS +.BR jscal +.RI "[" options "] <" device\(hyname ">" +.SH DESCRIPTION +.B jscal +calibrates joysticks and maps joystick axes and buttons. +Calibrating a joystick ensures the positions on the various axes are +correctly interpreted. +Mapping axes and buttons allows the meanings of the joystick's axes +and buttons to be redefined. +.PP +On Debian systems the calibration settings can be stored and later +applied automatically using the +.B jscal-store +command. +.SH OPTIONS +.TP +.BR \-c ", " \-\-calibrate +Calibrate the joystick. +.TP +.BR \-h ", " \-\-help +Print out a summary of available options. +.TP +.BR \-s ", " \-\-set\-correction " <\fInb_axes\fP,\fItype\fP,\fIprecision\fP,\fIcoefficients\fP,...>" +Sets correction to specified values. +For each axis, specify the correction type (0 for none, 1 for "broken +line"), the precision, and if necessary the correction coefficients +("broken line" corrections take four coefficients). +.TP +.BR \-u ", " \-\-set\-mappings " <\fInb_axes\fP,\fIaxmap1\fP,\fIaxmap2\fP,...,\fInb_buttons\fP,\fIbtnmap1\fP,\fIbtnmap2\fP,...>" +Sets axis and button mappings. +\fIn_of_buttons\fP can be set to 0 to remap axes only. +.IP "\fB\-t\fR, \fB\-\-test\-center\fR" +Tests if the joystick is correctly calibrated. +Returns 2 if the axes are not calibrated, 3 if buttons were pressed, 1 +if there was any other error, and 0 on success. +.IP "\fB\-V\fR, \fB\-\-version\fR" +Prints the version numbers of the running joystick driver and that +which jscal was compiled for. +.IP "\fB\-p\fR, \fB\-\-print\-correction\fR" +Prints the current correction settings. +The format of the output is a jscal command line. +.IP "\fB\-q\fR, \fB\-\-print\-mappings\fR" +Prints the current axis and button mappings. +The format of the output is a jscal command line. +.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), \fBjscal\-store\fP(1). +.SH AUTHORS +.B jscal +was written by Vojtech Pavlik and improved by many others; see the +linuxconsole tools documentation for details. +.PP +This manual page was written by Stephen Kitt , for the Debian +GNU/Linux system (but may be used by others). diff --git a/docs/jskeepalive.1 b/docs/jskeepalive.1 new file mode 100644 index 0000000..39c4659 --- /dev/null +++ b/docs/jskeepalive.1 @@ -0,0 +1,16 @@ +.TH jskeepalive 1 "April 7, 2010" jskeepalive +.SH NAME +jskeepalive \- keeps a joystick alive +.SH SYNOPSIS +.BR jskeepalive +.RI "<" device-name ">" +.SH DESCRIPTION +.B jskeepalive +continuously reads from the given joystick device. (This doesn't +prevent other programs from accessing the same joystick device.) This +is necessary for certains joysticks which disappear if they are not +accessed during a given interval (see +https://bugs.launchpad.net/ubuntu/+source/joystick/+bug/448446). +.SH AUTHOR +.B jskeepalive +was written by Stephen Kitt. diff --git a/docs/jstest.1 b/docs/jstest.1 new file mode 100644 index 0000000..a4f618e --- /dev/null +++ b/docs/jstest.1 @@ -0,0 +1,36 @@ +.TH jstest 1 "April 21, 2009" jstest +.SH NAME +jstest \- joystick test program +.SH SYNOPSIS +.BR jstest " [" \-\-normal "] [" \-\-old "] [" \-\-event "] [" \-\-nonblock "] [" \-\-select "] <\fIdevice-name\fP>" +.SH DESCRIPTION +\fBjstest\fP can be used to test all the features of the Linux +joystick API, including non-blocking and \fBselect\fP(2) access, as +well as version 0.x compatibility mode. +.PP +It is also intended to serve as an example implementation for those +who wish to learn how to write their own joystick using applications. +.SH OPTIONS +.TP +.B \-\-normal +One-line mode showing immediate status. +.TP +.B \-\-old +Same as \-\-normal, using 0.x interface. +.TP +.B \-\-event +Prints events as they come in. +.TP +.B \-\-nonblock +Same as \-\-event, in nonblocking mode. +.TP +.B \-\-select +Same as \--event, using \fBselect\fP(2) call. +.SH SEE ALSO +\fBfftest\fP(1), \fBjscal\fP(1). +.SH AUTHOR +.B jstest +was written by Vojtech Pavlik. +.PP +This manual page was written by Stephen Kitt , for the Debian +GNU/Linux system (but may be used by others). diff --git a/docs/list-inputattach-modes b/docs/list-inputattach-modes new file mode 100755 index 0000000..c563ad3 --- /dev/null +++ b/docs/list-inputattach-modes @@ -0,0 +1,12 @@ +#!/usr/bin/awk -f + +/^ --.*-/ { + print ".TP"; + print ".BR \\-" substr($2, 2) " \", \" " "\\-\\-" substr($1, 3); +# print "\\fB\\-" substr($2, 2) "\\fR, \\fB\\-\\-" substr($1, 3) "\\fR"; + remainder = ""; + for (i = 3; i < NF; i++) + remainder = remainder $i " "; + print remainder $NF "."; +} + diff --git a/utils/80-stelladaptor-joystick.rules.in b/utils/80-stelladaptor-joystick.rules.in new file mode 100644 index 0000000..4fd7031 --- /dev/null +++ b/utils/80-stelladaptor-joystick.rules.in @@ -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 --git a/utils/Makefile b/utils/Makefile new file mode 100644 index 0000000..5b9bca6 --- /dev/null +++ b/utils/Makefile @@ -0,0 +1,91 @@ +# +# $Id$ +# +# Makefile for Linux input utilities +# +# © 1998-2000 Vojtech Pavlik (sponsored by SuSE) +# © 2008-2016 Stephen Kitt +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 USA. +# +# +# Edit the options below to suit your needs +# + +CFLAGS ?= -g -O2 -Wall + +PROGRAMS = inputattach jstest jscal fftest ffmvforce ffset \ + ffcfstress jscal-restore jscal-store evdev-joystick + +PREFIX ?= /usr/local + +compile: $(PROGRAMS) + +distclean: clean +clean: + $(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 $@ + +ffcfstress: ffcfstress.c + $(CC) $(CFLAGS) $(CPPFLAGS) -funsigned-char $^ $(LDFLAGS) -lm -o $@ + +ffmvforce.o: ffmvforce.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@ `sdl-config --cflags` + +ffmvforce: ffmvforce.o + $(CC) $^ -o $@ $(LDFLAGS) -g -lm `sdl-config --libs` + +axbtnmap.o: axbtnmap.c axbtnmap.h + +jscal.o: jscal.c axbtnmap.h + +jscal: jscal.o axbtnmap.o + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $^ -lm -o $@ + +jstest.o: jstest.c axbtnmap.h + +jstest: jstest.o axbtnmap.o + +gencodes: gencodes.c scancodes.h + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) gencodes.c -o $@ + +jscal-restore: jscal-restore.in + sed "s^@@PREFIX@@^$(PREFIX)^g" < $^ > $@ + +jscal-store: jscal-store.in + sed "s^@@PREFIX@@^$(PREFIX)^g" < $^ > $@ + +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/rules.d + install js-set-enum-leds $(DESTDIR)/lib/udev + install -m 644 80-stelladaptor-joystick.rules $(DESTDIR)/lib/udev/rules.d + +.PHONY: compile clean distclean install diff --git a/utils/axbtnmap.c b/utils/axbtnmap.c new file mode 100644 index 0000000..d60d034 --- /dev/null +++ b/utils/axbtnmap.c @@ -0,0 +1,89 @@ +/* + * Axis and button map support functions. + * Copyright © 2009 Stephen Kitt + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include + +#include +#include + +#include +#include + +#include "axbtnmap.h" + +/* The following values come from include/joystick.h in the kernel source. */ +#define JSIOCSBTNMAP_LARGE _IOW('j', 0x33, __u16[KEY_MAX_LARGE - BTN_MISC + 1]) +#define JSIOCSBTNMAP_SMALL _IOW('j', 0x33, __u16[KEY_MAX_SMALL - BTN_MISC + 1]) +#define JSIOCGBTNMAP_LARGE _IOR('j', 0x34, __u16[KEY_MAX_LARGE - BTN_MISC + 1]) +#define JSIOCGBTNMAP_SMALL _IOR('j', 0x34, __u16[KEY_MAX_SMALL - BTN_MISC + 1]) + +int determine_ioctl(int fd, int *ioctls, int *ioctl_used, void *argp) +{ + int i, retval = 0; + + /* Try each ioctl in turn. */ + for (i = 0; ioctls[i]; i++) { + if ((retval = ioctl(fd, ioctls[i], argp)) >= 0) { + /* The ioctl did something. */ + *ioctl_used = ioctls[i]; + return retval; + } else if (errno != -EINVAL) { + /* Some other error occurred. */ + return retval; + } + } + return retval; +} + +int getbtnmap(int fd, uint16_t *btnmap) +{ + static int jsiocgbtnmap = 0; + int ioctls[] = { JSIOCGBTNMAP, JSIOCGBTNMAP_LARGE, JSIOCGBTNMAP_SMALL, 0 }; + + if (jsiocgbtnmap != 0) { + /* We already know which ioctl to use. */ + return ioctl(fd, jsiocgbtnmap, btnmap); + } else { + return determine_ioctl(fd, ioctls, &jsiocgbtnmap, btnmap); + } +} + +int setbtnmap(int fd, uint16_t *btnmap) +{ + static int jsiocsbtnmap = 0; + int ioctls[] = { JSIOCSBTNMAP, JSIOCSBTNMAP_LARGE, JSIOCSBTNMAP_SMALL, 0 }; + + if (jsiocsbtnmap != 0) { + /* We already know which ioctl to use. */ + return ioctl(fd, jsiocsbtnmap, btnmap); + } else { + return determine_ioctl(fd, ioctls, &jsiocsbtnmap, btnmap); + } +} + +int getaxmap(int fd, uint8_t *axmap) +{ + return ioctl(fd, JSIOCGAXMAP, axmap); +} + +int setaxmap(int fd, uint8_t *axmap) +{ + return ioctl(fd, JSIOCSAXMAP, axmap); +} diff --git a/utils/axbtnmap.h b/utils/axbtnmap.h new file mode 100644 index 0000000..37a6e98 --- /dev/null +++ b/utils/axbtnmap.h @@ -0,0 +1,65 @@ +/* + * Axis and button map support functions. + * Copyright © 2009 Stephen Kitt + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __AXBTNMAP_H__ +#define __AXBTNMAP_H__ + +#include +#include + +/* The following values come from include/input.h in the kernel + source; the small variant is used up to version 2.6.27, the large + one from 2.6.28 onwards. We need to handle both values because the + kernel doesn't; it only expects one of the values, and we need to + determine which one at run-time. */ +#define KEY_MAX_LARGE 0x2FF +#define KEY_MAX_SMALL 0x1FF + +/* Axis map size. */ +#define AXMAP_SIZE (ABS_MAX + 1) + +/* Button map size. */ +#define BTNMAP_SIZE (KEY_MAX_LARGE - BTN_MISC + 1) + +/* Retrieves the current axis map in the given array, which must + contain at least AXMAP_SIZE elements. Returns the result of the + ioctl(): negative in case of an error, 0 otherwise for kernels up + to 2.6.30, the length of the array actually copied for later + kernels. */ +int getaxmap(int fd, uint8_t *axmap); + +/* Uses the given array as the axis map. The array must contain at + least AXMAP_SIZE elements. Returns the result of the ioctl(): + negative in case of an error, 0 otherwise. */ +int setaxmap(int fd, uint8_t *axmap); + +/* Retrieves the current button map in the given array, which must + contain at least BTNMAP_SIZE elements. Returns the result of the + ioctl(): negative in case of an error, 0 otherwise for kernels up + to 2.6.30, the length of the array actually copied for later + kernels. */ +int getbtnmap(int fd, uint16_t *btnmap); + +/* Uses the given array as the button map. The array must contain at + least BTNMAP_SIZE elements. Returns the result of the ioctl(): + negative in case of an error, 0 otherwise. */ +int setbtnmap(int fd, uint16_t *btnmap); + +#endif + diff --git a/utils/bitmaskros.h b/utils/bitmaskros.h new file mode 100644 index 0000000..2543022 --- /dev/null +++ b/utils/bitmaskros.h @@ -0,0 +1,40 @@ +/* + * bitmaskros.h + * + * Helper macros for large bit masks management + * + * Copyright (C) 2008 Jean-Philippe Meuret + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* Number of bits for 1 unsigned char */ +#define nBitsPerUchar (sizeof(unsigned char) * 8) + +/* Number of unsigned chars to contain a given number of bits */ +#define nUcharsForNBits(nBits) ((((nBits)-1)/nBitsPerUchar)+1) + +/* Index=Offset of given bit in 1 unsigned char */ +#define bitOffsetInUchar(bit) ((bit)%nBitsPerUchar) + +/* Index=Offset of the unsigned char associated to the bit + at the given index=offset */ +#define ucharIndexForBit(bit) ((bit)/nBitsPerUchar) + +/* Value of an unsigned char with bit set at given index=offset */ +#define ucharValueForBit(bit) (((unsigned char)(1))<> bitOffsetInUchar(bit)) & 1) diff --git a/utils/evdev-joystick.c b/utils/evdev-joystick.c new file mode 100644 index 0000000..ce99120 --- /dev/null +++ b/utils/evdev-joystick.c @@ -0,0 +1,429 @@ +/** + 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 (stephena@users.sf.net). +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +/* 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" + " --minimum, --m [val] Change minimum for current joystick\n" + " --maximum, --M [val] Change maximum for current joystick\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" + "To set the minimum and maximum range values:\n" + " evdev-joystick [ --e /path/to/event/device/file --m minimum_value --M maximum_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) (value: 387, min: 0, max: 16383, flatness: 1023 (=6.24%), fuzz: 63)\n" + " Absolute axis 0x01 (1) (Y Axis) (value: 216, min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n" + " Absolute axis 0x02 (2) (Z Axis) (value: 0, min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n" + " Absolute axis 0x05 (5) (Z Rate Axis) (value: 101, min: 0, max: 255, flatness: 15 (=5.88%), fuzz: 0)\n" + " Absolute axis 0x10 (16) (Hat zero, x axis) (value: 0, min: -1, max: 1, flatness: 0 (=0.00%), fuzz: 0)\n" + " Absolute axis 0x11 (17) (Hat zero, y axis) (value: 0, 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("(value: %d, min: %d, max: %d, flatness: %d (=%.2f%%), fuzz: %d)\n", + abs_features.value, abs_features.minimum, abs_features.maximum, + abs_features.flat, percent_deadzone, abs_features.fuzz); + } + } + + close(fd); + return 0; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +int setAxisInfo(const char* evdev, int axisindex, + __s32 minvalue, __s32 maxvalue, + __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(minvalue != INT_MIN) + { + printf("Setting min value to : %d\n", minvalue); + abs_features.minimum = minvalue; + } + + if(maxvalue != INT_MIN) + { + printf("Setting max value to : %d\n", maxvalue); + abs_features.maximum = maxvalue; + } + + if(deadzonevalue != INT_MIN) + { + 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 != INT_MIN) + { + 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(" (value: %d, min: %d, max: %d, flatness: %d (=%.2f%%), fuzz: %d)\n", + abs_features.value, 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 min = INT_MIN, max = INT_MIN, flat = INT_MIN, fuzz = INT_MIN; + + // 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' }, + { "minimum", required_argument, 0, 'm' }, + { "maximum", required_argument, 0, 'M' }, + { "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:m:M: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 'm': + min = atoi(optarg); + printf("New min value: %d\n", min); + break; + + case 'M': + max = atoi(optarg); + printf("New max value: %d\n", max); + 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(min != INT_MIN || max != INT_MIN || flat != INT_MIN || fuzz != INT_MIN) + { + if(evdevice == NULL) + { + printf( "You must specify the event device for your joystick\n" ); + exit(1); + } + else + { + if(axisindex == -1) + { + if(min != INT_MIN) + printf( "Trying to set all axes minimum to: %d\n", min); + if(max != INT_MIN) + printf( "Trying to set all axes maximum to: %d\n", max); + if(flat != INT_MIN) + printf( "Trying to set all axes deadzone to: %d\n", flat); + if(fuzz != INT_MIN) + printf( "Trying to set all axes fuzz to: %d\n", fuzz); + } + else + { + if(min != INT_MIN) + printf( "Trying to set axis %d minimum to: %d\n", axisindex, min); + if(max != INT_MIN) + printf( "Trying to set axis %d maximum to: %d\n", axisindex, max); + if(flat != INT_MIN) + printf( "Trying to set axis %d deadzone to: %d\n", axisindex, flat); + if(fuzz != INT_MIN) + printf( "Trying to set axis %d fuzz to: %d\n", axisindex, fuzz); + } + + setAxisInfo(evdevice, axisindex, min, max, flat, fuzz); + } + } + + exit(0); +} diff --git a/utils/extract b/utils/extract new file mode 100755 index 0000000..c4320d8 --- /dev/null +++ b/utils/extract @@ -0,0 +1,56 @@ +#!/usr/bin/awk -f + +# Extracts the settings for a given joystick from the joystick +# parameter file, matching the contents of the kernel, name, serial, +# vendor and product variables (typically specified on the command +# line), repectively kernel device, joystick name, joystick serial +# number, USB vendor code, USB product code. +# The exit code is 0 if a section was found, 1 otherwise. If multiple +# sections match, only the first is kept. + +BEGIN { + FS = "\""; + seckernel = ""; + secname = ""; + secserial = ""; + secvendor = ""; + secproduct = ""; +} + +/^DEVICE=/ { + seckernel = $2; +} + +/^NAME=/ { + secname = $2; +} + +/^SERIAL=/ { + secserial = $2; +} + +/^VENDOR=/ { + secvendor = $2; +} + +/^PRODUCT/ { + secproduct = $2; +} + +/(^js)|(^$)/ { + # Command or empty line, ends the match criteria for a given + # section + if ((kernel == "" || seckernel == kernel) && + (name == "" || secname == name) && + (serial == "" || secserial == serial) && + (vendor == "" || secvendor == vendor) && + (product == "" || secproduct == product)) { + # The section matches, output the command or exit if we've + # reached the end of the section + if ($0 ~ /^js/) { + print $0; + } else { + exit 0; + } + } +} diff --git a/utils/ffcfstress.c b/utils/ffcfstress.c new file mode 100644 index 0000000..39e4e25 --- /dev/null +++ b/utils/ffcfstress.c @@ -0,0 +1,360 @@ +/* + * ffcfstress.c + * + * Force Feedback: Constant Force Stress Test + * + * Copyright (C) 2001 Oliver Hamann + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA. + */ + +#define _DEFAULT_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "bitmaskros.h" + + +/* Default values for the options */ +#define DEFAULT_DEVICE_NAME "/dev/input/event0" +#define DEFAULT_UPDATE_RATE 25.0 +#define DEFAULT_MOTION_FREQUENCY 0.1 +#define DEFAULT_MOTION_AMPLITUDE 1.0 +#define DEFAULT_SPRING_STRENGTH 1.0 +#define DEFAULT_AXIS_INDEX 0 +#define DEFAULT_AXIS_CODE ABS_X + +static const char* axis_names[] = { "X", "Y", "Z", "RX", "RY", "RZ", "WHEEL" }; +static const int axis_codes[] = { ABS_X, ABS_Y, ABS_Z, ABS_RX, ABS_RY, ABS_RZ, ABS_WHEEL }; + +/* Options */ +const char * device_name = DEFAULT_DEVICE_NAME; +double update_rate = DEFAULT_UPDATE_RATE; +double motion_frequency = DEFAULT_MOTION_FREQUENCY; +double motion_amplitude = DEFAULT_MOTION_AMPLITUDE; +double spring_strength = DEFAULT_SPRING_STRENGTH; +int axis_index = DEFAULT_AXIS_INDEX; +int axis_code = DEFAULT_AXIS_CODE; +int stop_and_play = 0; /* Stop-upload-play effects instead of updating */ +int autocenter_off = 0; /* switch the autocentering off */ + + +/* Global variables about the initialized device */ +int device_handle; +int axis_min, axis_max; +struct ff_effect effect; + + +/* Parse command line arguments */ +void parse_args(int argc, char * argv[]) +{ + int i; + + int help = (argc < 2); + + for (i=1; i= sizeof(axis_names)/sizeof(char*)) + help = 1; + else + axis_code = axis_codes[axis_index]; + } else help = 1; + } else if (!strcmp(argv[i],"-o")) { + ; + } else if (!strcmp(argv[i],"-A")) { + autocenter_off = 1; + } else help = 1; + } + + + if (help) { + printf("-------- ffcfstress - Force Feedback: Constant Force Stress Test --------\n"); + printf("Description:\n"); + printf(" This program is for stress testing constant non-enveloped forces on\n"); + printf(" a force feedback device via the event interface. It simulates a\n"); + printf(" moving spring force by a frequently updated constant force effect.\n"); + printf(" BE CAREFUL IN USAGE, YOUR DEVICE MAY GET DAMAGED BY THE STRESS TEST!\n"); + printf("Usage:\n"); + printf(" %s