summaryrefslogtreecommitdiff
path: root/config
AgeCommit message (Collapse)AuthorFilesLines
2018-01-22config: fix NULL value detection for ID_INPUT being unsetPeter Hutterer1-1/+1
Erroneous condition caused us to keep going with all devices that didn't have ID_INPUT set. Fixes: 5aad81445c8c3d6 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104382 Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit a309323328d9d6e0bf5d9ea1d75920e53b9beef3)
2017-12-13config/udev: consider ID_INPUT_FOO=0 as 'unset'Peter Hutterer1-33/+32
Historically we didn't need to care about this case but more devices are having invalid types set and they cannot be unset with a hwdb entry (which doesn't handle the empty string). Allow for "0" to mean "unset" because anything else would be crazy anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 5aad81445c8c3d6b7b30d503cfe26027fa482870)
2016-10-26ddx: add new call to purge input devices that weren't addedPeter Hutterer1-0/+2
Special case for the systemd-logind case in xfree86: when we're vt-switched away and a device is plugged in, we get a paused fd from logind. Since we can't probe the device or do anything with it, we store that device in the xfree86 and handle it later when we vt-switch back. The device is not added to inputInfo.devices until that time. When the device is removed while still vt-switched away, the the config system never notifies the DDX. It only runs through inputInfo.devices and our device was never added to that. When a device is plugged in, removed, and plugged in again while vt-switched away, we have two entries in the xfree86-specific list that refer to the same device node, both pending for addition later. On VT switch back, the first one (the already removed one) will be added successfully, the second one (the still plugged-in one) fails. Since the fd is correct, the device works until it is removed again. The removed devices' config_info (i.e. the syspath) doesn't match the actual device we addded tough (the input number increases with each plug), it doesn't get removed, the fd remains open and we lose track of the fd count. Plugging the device in again leads to a dead device. Fix this by adding a call to notify the DDX to purge any remainders of devices with the given config_info, that's the only identifiable bit we have at this point. https://bugs.freedesktop.org/show_bug.cgi?id=97928 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-09-15config/dbus: Initialize dbus fd to -1 so teardown doesn't use fd 0Keith Packard1-1/+1
The dbus teardown code is called when the server fatal errors even if that is before dbus has ever been initialized. By statically initializing the value of bus_info.fd, we avoid calling RemoveNotifyFd on stdin. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-16config: Hold input lock across udev socket handlingKeith Packard1-1/+5
This avoids having the server running inside libudev from two threads at once, which it appears to not like. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-26Remove SIGIO support for input [v5]Keith Packard1-2/+2
This removes all of the SIGIO handling support used for input throughout the X server, preparing the way for using threads for input handling instead. Places calling OsBlockSIGIO and OsReleaseSIGIO are marked with calls to stub functions input_lock/input_unlock so that we don't lose this information. xfree86 SIGIO support is reworked to use internal versions of OsBlockSIGIO and OsReleaseSIGIO. v2: Don't change locking order (Peter Hutterer) v3: Comment weird && FALSE in xf86Helper.c Leave errno save/restore in xf86ReadInput Squash with stub adding patch (Peter Hutterer) v4: Leave UseSIGIO config parameter so that existing config files don't break (Peter Hutterer) v5: Split a couple of independent patch bits out of kinput.c (Peter Hutterer) Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-03xfree86: add support for MatchIsTabletPadPeter Hutterer2-0/+6
The tablet pads have been separate kernel devices for a while now and libwacom has labelled them with the udev ID_INPUT_TABLET_PAD for over a year now. Add a new MatchIsTabletPad directive to apply configuration options specifically to the Pad part of a tablet. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-03-01config/udev: distinguish between real keyboards and other key devicesLaércio de Sousa3-2/+6
This patch introduces a new flag ATTR_KEY for hotplugged input devices, so we can better distinguish between real keyboards (i.e. devices with udev property ID_INPUT_KEYBOARD="1") and other key input devices like lid switches, power buttons, etc. All supported hotplug backends (udev, hal, and wscons) will set both flags ATTR_KEY and ATTR_KEYBOARD for real keyboards, but udev backend will set ATTR_KEY, but not ATTR_KEYBOARD, for non-keyboard key input devices (hal and wscons will set both flags in any case). With this distinction, kdrive input hotplugging mechanism will be allowed to only grab real keyboards, as other key input devices are currently not supported. In order to don't break current behaviour, this patch will replace all ATTR_KEYBOARD occurrences with ATTR_KEY in hw/xfree86/common/xf86Xinput.c. [ajax: Just add ATTR_KEY, don't re-number the other attributes] Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
2015-12-01config: Use NotifyFd interface for udevKeith Packard1-29/+16
This uses the NotifyFd interface to monitor the udev file descriptor rather than adding another block/wakeup handler Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2015-12-01config: Use NotifyFd for dbus interfaceKeith Packard1-12/+4
This uses the NotifyFd interface to monitor the dbus socket rather than a block/wakeup handler. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2015-05-18config: remove 10-evdev.conf, let the evdev driver install that filePeter Hutterer2-42/+2
Now that we have two likely drivers that fight for control over the input devices (evdev and libinput) let's move the respective driver assignment to each package. So you get what you install. https://bugs.freedesktop.org/show_bug.cgi?id=89023 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-21Add XNFcallocarray() to allow xnfcalloc() to check for overflowAlan Coopersmith1-1/+2
The xnfcalloc() macro took two arguments but simply multiplied them together without checking for overflow and defeating any overflow checking that calloc() might have done. Let's not do that. The original XNFcalloc() function is left for now to preserve driver ABI, but is marked as deprecated so it can be removed in a future round of ABI break/cleanup. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-01-30config/udev: Respect seat assignments when assigned devicesDave Airlie1-9/+21
Jonathan Dieter posted a few patches to do this inside the Xorg server but it makes no sense to do it there, just have the code we use to probe the device list at startup check seat assignments using the same code we check at hotplug time. Bugilla: https://bugzilla.redhat.com/show_bug.cgi?id=1183654 Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Jonathan Dieter <jdieter@lesbg.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-08config/udev: Prefix and shift "removing GPU" messageDaniel Martin1-4/+3
The message "removing GPU device ..." appeared even if the removal was skipped (when path == NULL). Move it below the path check and make it a LogMessage with config/udev prefix. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-07-17config: Replace OdevAttributes linked list with structKeith Packard2-155/+16
OdevAttributes are a fixed set of values with known types; instead of storing them in a linked list and requiring accessor/settor functions, replace the list header, struct OdevAttributes, with a struct that directly contains the values. This provides for compile-time typechecking of the values, eliminates a significant amount of code and generally simplifies using this datatype. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-14config_odev_add_attribute*: Check for right attribute typeHans de Goede1-0/+32
Don't allow setting string attributes to integers and vice versa. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-05-15config: revert quirk for the Evoluent Vertical MousePeter Hutterer1-16/+0
This quick makes the mouse behaviour more obvious (LMR buttons generate LMR events) but goes against the manufacturer's intended defaults: Top button - left click. Wheel button - .middle click (e.g., for pan and rotate in CAD programs). Middle button - right click. Bottom button - back. Thumb button - forward. from http://www.evoluent.com/vm3.html Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-05-08Merge commit 'who/for-keith'Keith Packard1-4/+2
Skipping two unreviewed patches; will mark them reviewed and cherry pick
2014-05-05systemd-logind: let the logind code decided whether to close an fdPeter Hutterer1-4/+2
We can only request one fd per device from systemd-logind. If a fd is re-used by the same device, releasing the fd from one device doesn't mean we can close it. The systemd code knows when it's really released, so let it close the fd. Test case: xorg.conf section for an input device with hotplugging enabled. evdev detects the duplicate and closes the hotplugged device, which closes the fd. The other instance of evdev thinks the fd is still valid so now you're playing a double lottery. First, which client(s) will get the evdev fd? Second, which requests will be picked up by evdev and which ones will be picked up by the client? You'll never know, but the fun is in finding out. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-30dbus: don't dispatch dbus events on select() EINTRRay Strode1-2/+2
wakeup handlers are called even when select() returns EINTR, and when they're called the passed fd set is undefined. This commit fixes the dbus wakeup handler to avoid dispatching into dbus spuriously. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Ray Strode <rstrode@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-03-12Remove config_odev_add_*attribute checks in various placesHans de Goede1-26/+6
Note that there are more callers but those were already not doing any error checking. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-12config_odev*: Use XNF alloc functionsHans de Goede1-15/+3
config_odev* functions are called in code-paths were we already use XNF* functions in other places, so which are not oom safe already. Besides that oom is something which should simply never happen, so aborting when it does is as good a response as any other. While switching to XNF functions also fixup an unchecked strdup case. Note the function prototypes are kept unchanged, as they are part of the server ABI. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-11Merge remote-tracking branch 'whot/for-keith'Keith Packard3-8/+26
2014-03-12config: search for PnPID on all parents (#75513)Peter Hutterer2-7/+24
The PnPID for a device may not be on the immediate parent, so search up the device tree until we find one. X.Org Bug 75513 <http://bugs.freedesktop.org/show_bug.cgi?id=75513> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2014-03-11config: only free odev->attrib_name for string typesPeter Hutterer1-1/+2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-03-10config_odev_add*_attribute: Don't add the attribute to the list twiceHans de Goede1-10/+21
Don't do the xorg_list_append a 2nd time when updating existing attributes, while at it add a helper function for this to avoid code duplication. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-03config-udev: Don't try to add drm devices twiceHans de Goede1-0/+4
Before this commit we were trying to add most drm devices twice, once from xf86platformProbe() and once from config_udev_init(). This results in somewhat confusing messages in Xorg.log, ie: (II) xfree86: Adding drm device (/dev/dri/card0) Later followed by: (II) config/udev: Adding drm device (/dev/dri/card0) By filtering out duplicate drm devices we avoid these confusing messages. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-03systemd-logind: Hookup systemd-logind integrationHans de Goede2-4/+48
This commits makes the changes necessary outside of the systemd-logind core to make the server use systemd-logind managed fds for input devices and drm nodes. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-03OdevAttribute: Add support for integer attributesHans de Goede1-0/+43
Add a couple of new functions for dealing with storing integer values into OdevAttributes. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-03OdevAttribute: config_odev_add_attribute: replace existing valuesHans de Goede1-1/+4
If an attribute already exists replace its value rather than adding a duplicate attribute with the new value to the list. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-03OdevAttribute: Add config_odev_get_attribute helperHans de Goede1-0/+24
Add a config_odev_get_attribute helper, and replace the diy looping over all the attributes done in various places with calls to this helper. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-17Get rid of config/non-seat0.conf.multi-seatLaércio de Sousa2-19/+1
This file is deprecated by commits c73c36b53 and 46cf2a6093. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-13config: fails to create tarball as xorg-server.conf file removedGaetan Nadon1-1/+1
Just need to update EXTRA_DIST Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-04input: un-constify InputAttributesPeter Hutterer1-7/+7
Introduced in fecc7eb1cf66db64728ee2d68cd9443df7e70879 and reverts most of that but it's helpfully mixed with other stuff. InputAttributes are not const, they're strdup'd everywhere but the test code and freed properly. Revert the const char changes and fix the test up instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-01-29dbus-core: Attempt to connect to dbus ASAPHans de Goede1-2/+2
For systemd-logind integration we need the dbus connection to be available before enumerating input and gfx devices. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-01-29dbus-core: Make dbus-core no longer mutually exclusive with udevHans de Goede5-67/+33
With systemd-logind the dbus-core will be used for more then just config, so it should be possible to build it even when using a non dbus dependent config backend. This patch also removes the config_ prefix from the dbus-core symbols. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-01-29config: drop the dbus APIPeter Hutterer5-439/+0
This API has been disabled by default since 1.4, the first release it came in. There a no known users of it and even its direct replacement (HAL) has been superseeded by udev on supported platforms since 1.8. This code is untested, probably hasn't been compiled in years and should not be shipped. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2014-01-12Replace 'pointer' type with 'void *'Keith Packard2-6/+6
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer' is used throughout the X server for other things, and having duplicate names generates compiler warnings. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12config/udev: handle const stringsKeith Packard1-9/+11
Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-09-25xserver: enable InputClass option "GrabDevice" by default for non-seat0 ↵Laércio de Sousa1-0/+4
seats (#69478) This patch contributes to fill the remaining gaps which make systemd-multi-seat-x wrapper still necessary in some multiseat setups. This also replaces previous evdev patch that does the same thing for that particular driver. When option "-seat" is passed with an argument different from "seat0", option "GrabDevice" for input devices is enabled by default (no need of enabling it in xorg.conf's "InputClass" section). Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=69478 Signed-off-by: Laércio de Sousa <lbsousajr@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-07-17config: provide example configuration for multi-seat setupsPeter Hutterer2-1/+19
Seats other than seat0 need custom configuration. Provide that with a default configuration file so we can share it across distros. This file intentionally does not end in .conf so it won't get picked up by the server after a normal installation. gdm, or whatever starts up the servers will have to explicitly specifiy this config file. This file replaces the one currently written by systemd's multi-seat-x binary: http://cgit.freedesktop.org/systemd/systemd/tree/src/login/multi-seat-x.c CC: Lennart Poettering <lennart@poettering.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2013-06-06config: add a quirks file for devices needing special configurationPeter Hutterer2-2/+56
This is the fedora quirks file configuring the special handling some devices need. Rather than keeping this distro-specific add it to the tree so we can share these quirks. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2013-01-21config/udev: fix "removing GPU device" format string mistakeAaron Plattner1-1/+1
udev.c: In function 'device_removed': udev.c:270:9: warning: format '%d' expects argument of type 'int', but argument 3 has type 'const char *' [-Wformat] Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-09-19config/udev: ignore change on drm devicesDave Airlie1-1/+7
for input devices we handle change like remove/add, but for drm devices we get change events when we hotplug outputs, so lets just ignore change at this level, and let the drivers handle it. We may in the future want to route driver udev from here instead. Reported-by: Timo Aaltonen <timo.aaltonen@canonical.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-04config/udev: respect seat for hotplugged video devices.Dave Airlie1-0/+4
This respects the seat tag for hotplugged video devices at X start. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-04config/udev: add wrapper around check if server is not seat 0Dave Airlie1-2/+2
this is a simple clean-up that is useful to stop further propogation of this construct. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-08-06Fix up formatting of initializers for arrays of structsAlan Coopersmith1-2/+4
The indenter seems to have gotten confused by initializing arrays of structs with the struct defined inline - for predefined structs it did a better job, so match that. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-07-09Fix more poorly indented/wrapped comments & codeAlan Coopersmith1-2/+4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
2012-07-06xserver/config: add udev/drm hotplug callbacks. (v2)Dave Airlie1-0/+42
This adds callbacks into the ddx for udev gpu hotplug. v2: fix some strncmp returns. Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-06xfree86: use udev to provide device enumeration for kms devices (v10)Dave Airlie3-0/+126
On Linux in order for future hotplug work, we are required to interface to udev to detect device creation/removal. In order to try and get some earlier testing on this, this patch adds the ability to use udev for device enumeration on Linux. At startup the list of drm/kms devices is probed and this info is used to load drivers. A new driver probing method is introduced that passes the udev device info to the driver for probing. The probing integrates with the pci probing code and will fallback to the pci probe and old school probe functions in turn. The flags parameter to the probe function will be used later to provide hotplug and gpu screen flags for the driver to behave in a different way. This patch changes the driver ABI, all drivers should at least be set with a NULL udev probe function after this commit. v2: rename to platform bus, now with 100% less udev specific, this version passes config_odev_attribs around which are an array of id/string pairs, then the udev code can attach the set of attribs it understands, the OS specific code can attach its attrib, and then the core/drivers can lookup the required attribs. also add MATCH_PCI_DEVICES macro. This version is mainly to address concerns raised by ajax. v3: Address comments from Peter. fix whitespace that snuck in. rework to use a linked list with some core functions that xf86 wraps. v4: add free list, fix struct whitespace. ajax this address most of your issues? v5: drop probe ifdef, fix logic issue v6: some overhaul after more testing. Implement primaryBus for platform devices. document hotplug.h dev attribs - drop sysname attrib fix build with udev kms disabled make probing work like the PCI probe code, match against bus id if one exists, or primary device. RFC: add new bus id support "PLAT:syspath". we probably want to match on this a bit different, or use a different property maybe. I was mainly wanting this for use with specifying usb devices in xorg.conf directly, but PLAT:path could also work I suppose. v6.1: add missing noop platform function v7: fix two interactions with pci probing and slot claiming, prevents pci and platform trying to load two drivers for same slot. v8: test with zaphod mode on -ati driver, fixup resulting issue clean up common probe code into another function, change busid matching to allow dropping end of strings. v9: fix platform probing logic so it actually works. v9.1: fix pdev init to NULL properly. v10: address most of Keith's concerns. v4 was thanks to Reviewed-by: Adam Jackson <ajax@redhat.com> v5 was Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com>