Commit Graph

197 Commits

Author SHA1 Message Date
Alan Coopersmith
dda82eb25b Strip trailing whitespace from source files
Performed with: `git ls-files | xargs perl -i -p -e 's{[ \t]+$}{}'`

`git diff -w` & `git diff -b` show no diffs from this change

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-joystick/-/merge_requests/10>
2025-08-12 15:56:41 -07:00
Enrico Weigelt, metux IT consult
75daef8c34 use strdup() instead of xstrdup() / Xstrdup()
Those call sites can never pass in NULL, so it's safe to use strdup()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-joystick/-/merge_requests/8>
2025-03-04 14:09:40 +01:00
Enrico Weigelt, metux IT consult
fa296d27fb drop compat with ancient xservers
Relying on >= 1.18, which has XINPUT 22.1.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-joystick/-/merge_requests/6>
2024-07-27 22:37:02 +00:00
Enrico Weigelt, metux IT consult
5f6820549b fix FTBS on FreeBSD
Work around name clash between linux/input.h and xf86str.h

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-joystick/-/merge_requests/7>
2024-06-05 09:42:39 +02:00
theofficialgman
06a4edcea3 use standard mouse button names for left/right/middle click and scroll wheel
also fixes incorrect labeling of absolute and relative axis

Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-joystick/-/merge_requests/5>
2024-05-13 12:15:45 -04:00
Enrico Weigelt, metux IT consult
a5f72befe2 stop using long deprecated xf86BlockSIGIO() and xf86UnblockSIGIO()
These functions have been replaced by input_lock() and input_unlock()
about a decade ago and only exisiting as inlined wrappers.

v2: increase required server version to 1.18.99.2

No need to support almost 1.5 decades old and unmaintained Xserver version,
almost one decade is more than enough ;-)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-02-24 09:55:29 -08:00
Alan Coopersmith
758adebe13 Fix spelling/wording issues
Found by using:
    codespell --builtin clear,rare,usage,informal,code,names

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16 11:01:54 -08:00
Manuel Bouyer
f45c3d0f35 Adapt to USB HID header changes on NetBSD-8.99.9.
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
2018-01-08 15:09:06 -05:00
Matthieu Herrb
60d0e9c451 use xf86{Add,Remove}EnabledDevice()
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-16 18:15:03 +10:00
Hans de Goede
baf8bd4441 Add support for server managed fds
Keep things simple by handling server managed fds in the common parts
of the open and close paths.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-20 12:14:06 +10:00
Hans de Goede
341d23ceaa Add a generic jstkCloseDevice helper function
This is a preparation patch for adding support for server managed fds.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-20 12:13:35 +10:00
Hans de Goede
6de3b75c45 Use jstkCloseDevice_* on error in jstkOpenDevice_* backend functions
This is a preparation patch for adding support for server managed fds, this
also fixes a missing free() in an error handling path in the evdev back-end.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-20 12:12:55 +10:00
Peter Hutterer
a976a85aef Handle DEVICE_ABORT for input ABI 19.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-10 14:02:18 +10:00
Sascha Hlusiak
819ba33c9d jast_axis: tune accelerated axis transformation to better work with circular axis fields
reference: https://bugs.freedesktop.org/show_bug.cgi?id=42399

joysticks with a rectangular field have a
corner position of (32768,32768), joysticks with a
circular field have (23170,23170).

make sure that diagonal movement feels fast. either:
1) linear

  f(32768) ~= f(23170) + f(23170)
  f(32768) ~= a * f(23170)
         a  = 2.0

  on circular joysticks, the time needed for xy movement is
  exactly the time needed for x + the time for y separately.
  absolute diagonal travel speed (in cm/s) is 0.707 times as fast,
  which feels pretty slow.

  on square joysticks, diagonal travel speed is always 1.41 times
  faster than orthogonal travel speed. time needed for diagonal
  movement is always 0.5 times as long as for orthogonal movement.

  the value of a = 2.0 results in a nice, non-linear acceleration.

or
2) trigonometric

  f(32768) ~= sqrt(f(23170)^2 + f(23170)^2))
  f(32768) ~= a * f(23170)
  a = 1.414

on circular joysticks, the absolute pointer travel speed
(in cm/s) is now the same for both linear and diagonal movement,
which feels natural. moving diagonally takes 0.707 times the time
of moving orthogonally.

on square joysticks, values are as in 1)

the value of a = 1.414 results in linear acceleration, which feels
too slow.

to maintain non-linear acceleration, make sure that:

a >>= 1.414

the following formula achieves results inbetween,
so it should feel natural on both devices while maintaining a
nice acceleration:

f(32768) ~= 1.620 * f(23170)
2013-01-16 10:50:40 +01:00
Sascha Hlusiak
342057bf38 backend_evdev: fix scaling overflow for high resolution axes
The module scales all axis values from the kernel to the range of
-32768 .. 32768, for compatibility with the old joystick kernel module.

The current implementation had an integer overflow, if the axis had a high
resolution of > 16384, like the popular XBox 360 controller.

This commitmakes the scaling use float instead to fix erratic behaviour
on high resolution joysticks. The joystick backend was not affected.

Fixes bug: https://bugs.freedesktop.org/show_bug.cgi?id=42399
2013-01-16 10:50:40 +01:00
Gaetan Nadon
053405f711 Replace deprecated Automake INCLUDES variable with AM_CPPFLAGS
Excerpt https://lists.gnu.org/archive/html/automake/2012-12/msg00038.html

  - Support for the long-deprecated INCLUDES variable will be removed
    altogether in Automake 1.14.  The AM_CPPFLAGS variable should be
    used instead.

This variable was deprecated in Automake releases prior to 1.10, which is the
current minimum level required to build X.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-14 08:44:05 +10:00
Sascha Hlusiak
acd398ac71 silence compiler warnings 2012-09-25 10:57:46 +02:00
Sascha Hlusiak
b217fabdef Copy pInfo->driver to option list to fix hotplugging of keyboard device
udev does copy the Driver line to the list of options, but when manually
specifying the driver in xorg.conf, the option "Driver" is unset. Because we
do hotplug a sub-device from within the core device, we need the "Driver"
option to be present in the list.

This should fix archlinux bug #23577:
  https://bugs.archlinux.org/task/23577

Thanks to Malek for coming up with a fix.

Signed-off-by: Sascha Hlusiak <contact@saschahlusiak.de>
2011-11-13 20:36:07 +01:00
Sascha Hlusiak
9bbb5775be Merge branch 'master' of ssh://git.freedesktop.org/git/xorg/driver/xf86-input-joystick 2011-11-13 17:10:09 +01:00
Peter Hutterer
7ccf3a7529 Deal with opaque input option types.
ABI 14 made the InputOption type opaque, move the existing code to ifdefs
and use the new function calls otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-02 08:41:19 +10:00
Peter Hutterer
e0193debf8 Fix option type for option duplication
xf86OptionListDuplicate() duplicates an XF86Option list, not an InputOption
list.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-31 14:27:22 +10:00
Sascha Hlusiak
b607c4ebee label buttons and axes
Buttons are labeled "Button %d", starting with 0 and representing the button in X _after_ mapping.
Mapping can be changed while running so the labels will be constant.

Axes are labeled "Axis %d", starting with 1, representing the _physical_ axis that reports the valuator
data. The raw valuators can't be dynamically mapped, the first two valuators always are labeled "Rel X"
and "Rel Y", representing the aggregated post-calculation data from all axes.

Signed-off-by: Sascha Hlusiak <saschahlusiak@arcor.de>
2011-10-16 00:47:52 +02:00
Terry Lambert
204dcb8636 Return proper default for unknown values in pInfo->device_control.
Signed-off-by: Terry Lambert <tlambert@chromium.org>
Reviewed-by: Stephane Marchesin <marcheu@chromium.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-18 11:51:40 +10:00
Sascha Hlusiak
4358209e7e Free pInfo->private only once to fix server crash on unplug (bug #35391)
The hotplugged keyboard device and the main device share the same pInfo->private data
and the same jstkCoreUnInit, so the data is freed twice. Furthermore, since the keyboard
device will delete itself, we must not delete it from within the deletion of the main device.

Freeing pInfo->private is done by the main device, hopefully done independently of the order
in which the two devices will be removed by the server.

Should fix bug #35391
2011-04-20 19:33:10 +02:00
Peter Hutterer
8c7ad54d6d Support input ABI 12
This commit adds support for input ABI 12, consisting of a number of
changes:
- requires an X server with an ABI of 12
- valuators have a per-mode setting
- new PreInit prototype.

Because of the new PreInit prototype, the hotplug system has been switched
around too (should have probably been done in a separate commit before,
but...).

The old hotplug mechanism added a separate ModuleInfoRec for the keyboard
part of the driver. This isn't feasable for InputClass configurations, the
driver part may get overwritten.

On entering the driver, after checking a few default values, hotplug the
keyboard device (wacom-style) and let it initialize. Because NIDR calls
DEVICE_INIT and DEVICE_ON the keyboard must initialise the private pointer
and pass it back to the original device.

Call order is:
NewInputDeviceRequest
 - jstkCorePreInit
   - jstkKeyboardHotplug
     - NewInputDeviceRequest
       - jstkCorePreInit
         immediately return jstkKeyboardPreInit()
       - keyboard DEVICE_INIT
       - keyboard DEVICE_ON
     return keyboard device
   - copy keyboard->priv to joystick->priv
   - finish jstkCorePreInit as normal
   - joystick DEVICE_INIT
   - joystick DEVICE_ON

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Trevor Woerner <twoerner@gmail.com>
2010-12-16 12:43:07 +10:00
Peter Hutterer
f2050e6be5 Get the option values from pInfo instead of from the IDevRec.
Doesn't matter which one we take, but ABI 12 dropped the IDevRec.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Trevor Woerner <twoerner@gmail.com>
2010-12-16 12:43:07 +10:00
Peter Hutterer
df0567d2fa Don't call xf86OptionListReport()
All options used by the driver will show up in the log anyway.
And new xserver versions will call this for debugging purposes for us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Trevor Woerner <twoerner@gmail.com>
2010-12-16 12:43:07 +10:00
Peter Hutterer
135aaf612b Purge use of XI_PRIVATE macro.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Trevor Woerner <twoerner@gmail.com>
2010-12-16 12:43:06 +10:00
Peter Hutterer
29a486ba56 Drop close_proc, conversion_proc, reverse_conversion_proc
All three aren't called by the server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Trevor Woerner <twoerner@gmail.com>
2010-12-16 12:41:39 +10:00
Peter Hutterer
0674bdfdb6 Don't handle history_size in the driver.
This has been handled in the server for quite a while now, just initialize
with the defaults and ignore it otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Trevor Woerner <twoerner@gmail.com>
2010-12-16 11:45:23 +10:00
Peter Hutterer
39205d76cb Require server 1.9, drop pre-ABI 11 support.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Trevor Woerner <twoerner@gmail.com>
2010-12-16 11:45:23 +10:00
Peter Hutterer
074dc4a2a0 Remove usage of XI86_POINTER_CAPABLE flag.
Flag was write-only for a number of server generations already.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Trevor Woerner <twoerner@gmail.com>
2010-12-16 11:45:23 +10:00
Peter Hutterer
107e4b14d9 Replace LocalDevicePtr with InputInfoPtr
Both typedefs describe the same struct, LocalDevicePtr has been removed with
input ABI 12.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Trevor Woerner <twoerner@gmail.com>
2010-12-16 11:45:18 +10:00
Trevor Woerner
cd6b81d377 Code cleanup, bad structure initialization.
The InputDriverRec data structure in xserver/hw/xfree86/common/xf86Xinput.h
no longer contains an integer refCount member; as per commit
d568221710959cf7d783e6ff0fb80fb43a231124.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-18 12:00:07 +10:00
Trevor Woerner
38363bde5d Deprecated code cleanup.
Replace calls to deprecated functions (Xfree(), Xcalloc(), Xmalloc(), etc)
with calls to standard dynamic memory functions (free(), calloc(), malloc(),
etc) in driver code.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-18 12:00:06 +10:00
Gaetan Nadon
25722aa12b config: remove AH_TOP autoheader statement
The generated config.h does not need to include xorg-server.h
for the content it provides.
Add #include <xorg-server.h> in .[hc] files as needed.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-06-11 15:44:26 -04:00
Gaetan Nadon
3de065d682 config: move CWARNFLAGS from configure.ac to Makefile.am
Compiler warning flags should be explicitly set in the makefile
rather than being merged with other packages compiler flags.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-02-11 10:08:07 -05:00
Sascha Hlusiak
5fdab9ca49 Fix NULL pointers in rmlvo 2009-09-11 18:23:26 +02:00
Sascha Hlusiak
462aae4db1 Merge branch 'scancodes' of ssh://deepthought/home/sascha/develop/xorg/xf86-input-joystick into scancodes 2009-09-11 17:54:13 +02:00
Sascha Hlusiak
b2de71f436 Support for axis labels; fix build on master
The first two axes are always REL_X and REL_Y. All other axes and buttons
are set to 'None', proper labeling will follow.

Thanks to Peter for the heads up.

Signed-off-by: Sascha Hlusiak <saschahlusiak@arcor.de>
2009-06-23 23:51:32 +02:00
Sascha Hlusiak
bf86269672 Property support for scancodes
Allows setting scancodes for keys using input-properties
2009-04-14 23:25:44 +02:00
Sascha Hlusiak
7f6e390fb1 Use preset keyboard layout instead of custom generated keymap.
Restored compatibility with recent xkb changes and xorg-server-1.7.
Keys are configured now using scancodes instead of keysyms. Depends on
set keymap; people could write custom layouts.
2009-04-11 14:19:58 +02:00
Sascha Hlusiak
4fbfcb17d6 Remove parsing of keysyms.
Key options are expected to be scancodes/plain numbers now.
2009-04-11 13:13:16 +02:00
Sascha Hlusiak
7c677b3d26 Remove ks_tables.h
No more keysym parsing
2009-04-11 13:12:17 +02:00
Sascha Hlusiak
8075ee4808 Remove parsing of keysyms
Change of configuration semantics again. Keys are specified in scancodes instead of keysyms.
2009-04-11 13:11:24 +02:00
Sascha Hlusiak
e171007239 Fix compiler warning about stray INT8-CARD8 conversion 2009-03-19 21:14:22 +01:00
Sascha Hlusiak
7af61c78fd Merge branch 'pwm' 2009-03-19 21:13:13 +01:00
Sascha Hlusiak
bc430cc2aa Missing initialization of button amplify
Always initialize button[]->amplify with 1.0
2009-03-19 21:08:30 +01:00
Sascha Hlusiak
dca19bde2b Merge branch 'master' of sascha:develop/xorg/xf86-input-joystick 2009-03-19 08:36:10 +01:00
Sascha Hlusiak
6f2a211b7c Fix build on FreeBSD with USB2
Including dev/usb/usb_ioctl.h fixes missing declaration
of USB_GET_REPORT_ID on FreeBSD-Current.
2009-03-18 17:39:07 +01:00