Commit Graph

58 Commits

Author SHA1 Message Date
Povilas Kanapickas 2f53d1cf73 config: Fix platform busid parsing when there is no ID_PATH prop
On at least Lenovo Thinkpad E585 udev does not have ID_PATH property for
the drm node (see
https://gitlab.freedesktop.org/xorg/xserver/-/issues/993). While this is
likely udev bug, this causes the device to be not recognized as
attribs->busid is NULL, which causes platform_find_pci_info to be not
called and corresponding xf86_platform_devices[i]->pdev to be NULL.

At this moment pdev being NULL will cause a crash, but this is a
different bug.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/993
Fixes: 0816e8fc linux: Make platform device probe less fragile
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-06-25 13:24:51 +03:00
Reza Arbab c0dcadad6c linux: Fix udev ID_PATH parsing for udl devices
The ID_PATH for a udl device looks like this:

  $ udevadm info /dev/dri/card2 | grep -w ID_PATH
  E: ID_PATH=pci-0000:00:14.0-usb-0:9.1:1.0

The parsing added in 0816e8fca6 ("linux: Make platform device probe
less fragile"), sets OdevAttributes::busid to "pci:0000:00:14.0", where
drmGetBusid() would have returned "3-9.1:1.0".

Identifying this as a "pci:*" device eventually causes the vendor/device
id check in probeSingleDevice() to fail, because a USB controller isn't
a supported device:

  $ udevadm info --path=/devices/pci0000:00/0000:00:14.0 | grep -e VENDOR -e ID_PCI_CLASS
  E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
  E: ID_VENDOR_FROM_DATABASE=Intel Corporation

Instead of parsing out "pci:0000:00:14.0" in this case, use
"usb:0:9.1:1.0" so the device probe will succeed.

Fixes: 0816e8fca6 ("linux: Make platform device probe less fragile")
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
2020-11-25 04:39:14 +00:00
Huacai Chen 9fbd3e43dd linux: Fix platform device probe for DT-based PCI
On a DT-base PCI platform, the sysfs path of vga device is like this:
/sys/devices/platform/bus@10000000/1a000000.pci/pci0000:00/0000:00:11.0/0000:04:00.0.

Then the ID_PATH from udev is platform-1a000000.pci-pci-0000:04:00.0 and
the BusID will be pci-0000:04:00.0, which causes Xorg start fail. This
is because config_udev_odev_setup_attribs() use strstr() to search the
first "pci-" in ID_PATH. To fix this, we implement a strrstr() function
and use it to search the last "pci-" in ID_PATH, which can get a correct
BusID.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
2020-07-28 16:14:55 +08:00
Martin Weber 429ee86ab9 udev: Fixed NULL pointer argument of strcmp
Signed-off-by: Martin Weber <martin.weber@secunet.com>
2019-09-20 05:33:47 +00:00
Adam Jackson 9acff30943 linux: Fix platform device PCI detection for complex bus topologies
Suppose you're in a Hyper-V guest and are trying to use PCI passthrough.
The ID_PATH that udev will construct for that looks something like
"acpi-VMBUS:00-pci-b8c8:00:00.0", and obviously looking for "pci-" in
the first four characters of that is going to not work.

Instead, strstr. I suppose it's possible you could have _multiple_ PCI
buses in the path, in which case you'd want strrstr, if that were a
thing.
2019-06-20 14:18:07 +00:00
Manoj Gupta 82f8cf8990 config/udev: Include header <sys/sysmacros.h> to use major/minor
glibc 2.25 has dropped sys/sysmacros.h from sys/types.h, so add
it explicitly in config/udev.c.

This is similar to the commit 84e3b96b53

Signed-off-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-11-14 10:26:48 -05:00
Adam Jackson 0816e8fca6 linux: Make platform device probe less fragile
At the point where xf86BusProbe runs we haven't yet taken our own VT,
which means we can't perform drm "master" operations on the device. This
is tragic, because we need master to fish the bus id string out of the
kernel, which we can only do after drmSetInterfaceVersion, which for
some reason stores that string on the device not the file handle and
thus needs master access.

Fortunately we know the format of the busid string, and it happens to
almost be the same as the ID_PATH variable from udev. Use that instead
and stop calling drmSetInterfaceVersion.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-10-18 13:52:11 -04:00
Peter Hutterer a309323328 config: fix NULL value detection for ID_INPUT being unset
Erroneous condition caused us to keep going with all devices that didn't have
ID_INPUT set.

Fixes: 5aad81445c
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>
2018-01-08 14:48:04 -05:00
Peter Hutterer 5aad81445c config/udev: consider ID_INPUT_FOO=0 as 'unset'
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>
2017-11-01 09:54:08 +10:00
Keith Packard bf2ca502b9 config: Hold input lock across udev socket handling
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-08-16 17:33:59 +10:00
Peter Hutterer 2285fe78c0 xfree86: add support for MatchIsTabletPad
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-05-03 16:15:51 +10:00
Laércio de Sousa daa6d2d58f config/udev: distinguish between real keyboards and other key devices
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>
2016-03-01 10:46:48 -05:00
Keith Packard 8c8f3567fe config: Use NotifyFd interface for udev
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-01 13:55:15 -05:00
Dave Airlie 697b696e5e config/udev: Respect seat assignments when assigned devices
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>
2015-01-30 14:09:24 +01:00
Daniel Martin 62a4eeaa25 config/udev: Prefix and shift "removing GPU" message
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-12-08 15:49:22 -08:00
Keith Packard 60c05ce1ab config: Replace OdevAttributes linked list with struct
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-17 17:10:48 -07:00
Hans de Goede 40e3c79a59 Remove config_odev_add_*attribute checks in various places
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-12 08:50:05 +01:00
Peter Hutterer 795066477e config: search for PnPID on all parents (#75513)
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-12 07:43:16 +10:00
Hans de Goede d9a4059d40 config-udev: Don't try to add drm devices twice
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-03 08:13:55 +01:00
Hans de Goede cac3921989 systemd-logind: Hookup systemd-logind integration
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-03 08:13:55 +01:00
Peter Hutterer ce3df579e3 input: un-constify InputAttributes
Introduced in fecc7eb1cf 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-02-04 11:27:48 +10:00
Keith Packard 60014a4a98 Replace 'pointer' type with 'void *'
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-12 10:24:11 -08:00
Keith Packard 86647e7279 config/udev: handle const strings
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:50 -08:00
Laércio de Sousa c73c36b537 xserver: enable InputClass option "GrabDevice" by default for non-seat0 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-09-25 03:52:54 +10:00
Aaron Plattner 70b127c9f1 config/udev: fix "removing GPU device" format string mistake
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>
2013-01-21 19:41:09 -08:00
Dave Airlie e0b92f5f86 config/udev: ignore change on drm devices
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-19 10:47:04 +10:00
Dave Airlie 18deac48db config/udev: respect seat for hotplugged video devices.
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-04 16:16:02 +10:00
Dave Airlie ec740cffeb config/udev: add wrapper around check if server is not seat 0
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-09-04 16:15:52 +10:00
Alan Coopersmith 6be74a9080 Fix more poorly indented/wrapped comments & code
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-09 19:14:50 -07:00
Dave Airlie b27cf30995 xserver/config: add udev/drm hotplug callbacks. (v2)
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-06 10:35:20 +01:00
Dave Airlie cf66471353 xfree86: use udev to provide device enumeration for kms devices (v10)
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>
2012-07-06 10:20:19 +01:00
Dave Airlie 07dcc3f1a9 config/udev: add pre_init stage to config and udev.
In order to use udev for gpu enumeration, we need to init udev earlier
than input initialisations. This splits the config init stuff so that udev
pre init sets up before output initialisation.

this is just a prepatory patch, doesn't change anything major.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-21 12:58:32 +01:00
Keith Packard 9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Lennart Poettering fad04dd970 udev: make use of udev_enumerate_add_match_tag() only when it is available
udev_enumerate_add_match_tag() and udev_monitor_filter_add_match_tag()
are mostly optimizations, hence simply skip these calls if they are not
available in the installed version of libudev.

This should fix the build on older versions of udev.

[airlied: fixes tinderbox failures on RHEL6]

Signed-off-by: Lennart Poettering <lennart@poettering.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2011-10-03 11:55:36 -07:00
Peter Hutterer 05284a03f9 input: make InputOption opaque, provide interface functions.
InputOptions is not switched to use struct list for a future patch to unify
it with the XF86OptionRec.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2011-08-22 15:56:53 +10:00
Peter Hutterer 20a61845d3 config: use add_option for '_source' too
_source was being allocated manually, with all other options added to that
list through add_option. Skip the manual part, allocate the first option
_source with add_option too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-08-22 15:56:50 +10:00
Peter Hutterer e684e816ac config: fix a log message
PRODUCT was taken from the parent, hence ppath.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-08-22 15:56:49 +10:00
Lennart Poettering 159b03e137 config: add udev/systemd multi-seat support
Add support for multi-seat-aware input device hotplugging. This
implements the multi-seat scheme explained here:

http://www.freedesktop.org/wiki/Software/systemd/multiseat

This introduces a new X server switch "-seat" which allows configuration
of the seat to enumerate hotplugging devices on. If specified the value
of this parameter will also be exported as root window property
Xorg_Seat.

To properly support input hotplugging devices need to be tagged in udev
according to the seat they are on. Untagged devices are assumed to be on
the default seat "seat0". If no "-seat" parameter is passed only devices
on "seat0" are used. This means that the new scheme is perfectly
compatible with existing setups which have no tagged input devices.

Note that the -seat switch takes a completely generic identifier, and
that it has no effect on non-Linux systems. In fact, on other OSes a
completely different identifier scheme for seats could be used but still
be exposed with the Xorg_Seat and -seat.

I tried to follow the coding style of the surrounding code blocks if
there was any one could follow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-22 15:56:49 +10:00
Lennart Poettering 6cea28fe4b config: don't fail if a device vanished by the time we managed to look at it
The nature of hotplug is that a device we enumerated might already be
gone by the time we look at it, so don't assume otherwise.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-27 09:29:56 +10:00
Lennart Poettering f13de9ca1b config: limit the kernel subsystems we look for devices in
Don't enumerate/monitor all devices of the system (since that can be
quite a few), but limit our search to devices from the "input"
subsystem, as well as the "tty" subsystem (to cover Wacom tablets).

This should make X start up a bit faster and reduce the number of
unnecessary wake-ups of the X server.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-27 09:29:49 +10:00
Lennart Poettering 882e3c2680 config: process udev "changed" and "add" events in the same code paths
udev gives no guarantee that before each "changed" event for a device
there's an "add" event, or that before each "remove" is an "add", or
that before each "add" there was no "add" already and so on. Users can
trigger these events at any time with "udevadm trigger", and netlink is
a lossy transport, hence the events can come in unexpected ordering.

With other words: regardless which event is generated, the X server must
not choke on it and make the best of it, hence make sure that if we get
an "add" event for an existing device we don't add the device a second
time.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-27 09:29:39 +10:00
Erkki Seppälä 6243332782 config: handle device change event properly
wakeup_handler in udev.c wasn't dealing with udev change events.
There are situations when a device can gain its input capabilities
after it has been added to the system and therefore the change events
must be handled as well.

The change is handled as a consecutive device removal and addition.

Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Stefan Kost <Stefan.Kost@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-24 09:51:09 +10:00
Rami Ylimäki 4114533db6 config: Ensure that stolen option list elements are released.
NewInputDeviceRequest steals the contents of option list elements but
doesn't use the elements themselves for anything. Therefore the list
elements need to be released always.

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-09 07:59:41 +10:00
Pauli Nieminen 3e1455505a udev: Fix removing of the wake up handler
RemoveBlockAndWakeupHandlers requires caller to pass same block data
parameter as for RegisterBlockAndWakeupHandlers.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-12-31 12:52:51 +00:00
Daniel Stone 22796cfa48 udev: Add strdups to kill const warnings
InputAttributes wants non-const members, and while it appears safe to
cast it, just leave it be for the moment.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-12-31 12:36:44 +00:00
Alan Coopersmith 03e8bfa1d1 Convert existing Xprintf style calls to asprintf style
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-12-07 11:10:35 -08:00
Peter Hutterer eaf0b6a4d8 Merge branch 'master' into input-api
Conflicts:
	config/udev.c
	hw/xfree86/common/xf86Helper.c
	hw/xfree86/common/xf86Module.h
	hw/xfree86/common/xf86Xinput.h
	hw/xfree86/os-support/linux/lnx_init.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-15 13:46:59 +10:00
Peter Hutterer 31c71425ac config: expose config_info as an input option.
config_info is the only reliable indicator we have in the server for
duplicate devices (drivers can test for maj/min on fds as well). Don't set
this after the device has been initialized but assume it's important enough
to set during NIDR.

This makes the option "config_info" available to the drivers as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-09-01 15:26:46 +10:00
Chase Douglas 7925e89456 Fix udev population of Bluetooth input device product IDs
The udev device_added function takes the vendor and model IDs of added
devices and converts them into an attribute that can be matched for by
an InputClass configuration using MatchUSBID. Currently, the udev
mechanism works for USB devices, but fails to work properly for
Bluetooth devices. The product IDs of the event node are actually the
IDs of the Bluetooth receiver instead of the device.

This patch reads the product ID from the PRODUCT property of the parent
of the added device. This tag is set correctly for both USB and
Bluetooth input devices. The following devices have been tested by
specifying individual InputClass sections in xorg.conf:

* Apple Keyboard (Bluetooth)
* Apple Magic Trackpad (Bluetooth)
* Apple Magic Mouse (Bluetooth)
* Microsoft Bluetooth Notebook Mouse 5000 (Bluetooth)
* Microsoft IntelliMouse Optical (USB)
* N-Trig Touchscreen (USB)
* Wacom Bamboo Touch (USB)

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-09-01 15:04:37 +10:00
Mikhail Gusarov 6592db6bb5 Get rid of xstrdup when argument is definitely non-NULL
Replace xstrdup with strdup when either constant string is
being duplicated or argument is guarded by conditionals and
obviously can't be NULL

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-06-11 19:04:23 +07:00