Commit Graph

182 Commits

Author SHA1 Message Date
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
Dave Airlie
8d3731a811 hal: free tmp_val in one missing case
Pointed out by coverity scan.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-12-06 16:01:50 +00:00
Keith Packard
6378d0233d Merge remote-tracking branch 'herrb/master' 2011-10-03 13:56:06 -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
Matthieu Herrb
f54852edc3 Add a 'wscons' autoconf mechanism to configure input devices on BSD.
This does not really handle hotplug (it's handled inside the kernel,
by the 'mux' devices), but uses the wscons console driver
configuration to figure out the keyboard layout and the list of
pointing devices found by the kernel.

Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-30 10:10:32 +02: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
d33652dad8 config: return the new InputOption from add_option.
Change add_option to return the new InputOption on success, or NULL
failure. This way we can at least check for errors in callers.

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
3a9bb93dd1 Convert alloc+sprintf pairs into asprintf() & XNFasprintf() calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2010-12-07 11:10:35 -08: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
Dan Horák
ecdbe817fd XF86CONFIGDIR is undefined when built with --disable-xorg (#28672)
The 10-evdev.conf file gets installed as /usr/share/X11/10-evdev.conf on
platforms that built the server with --disable-xorg like s390/s390x. The
definition/installation should be guarded with "if XORG" because it makes
sense only when built with xorg.

X.Org Bug 28672 <http://bugs.freedesktop.org/show_bug.cgi?id=28672>

Signed-off-by: Dan Horák <dan@danny.cz>
Acked-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-19 11:11:04 +10:00
Peter Hutterer
88cb61e1e5 Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-api
Conflicts:
	dix/getevents.c
	hw/xfree86/common/xf86Xinput.h

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-11 12:54:46 +10:00
Peter Hutterer
cbaa6a66e0 config: remove mention of AllowEmptyInput
"You will probably want to add the following option to the ServerFlags of
your xorg.conf:
         Option "AllowEmptyInput" "True""

I can't imagine why you would want to do that. My life is painful enough
already.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-11-11 10:26:44 +10: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
6e7417c342 config: Replace xstrdup with strdup in add_option()
All callers of add_option pass string literal as "key" argument
except one, where non-NULL condition is guarded by if().

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2010-06-11 19:05:46 +07: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
Peter Hutterer
7805e45284 config: remove redundant DBUS API define, require dbus-1 >= 1.0
It's still being pulled in by the HAL CFLAGS but the requirement to define
this was dropped from DBus pre 1.0 (November 2006).
This means we require dbus 1.0 now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-06-11 09:47:25 +10:00
Dan Nicholson
8426259286 config: Script to convert HAL fdi settings to InputClass sections
In the new world of udev and InputClass, x11_* settings from HAL fdi
files will not be honored. This script converts those settings into
valid InputClass sections that can be dropped into xorg.conf.d.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-11 09:31:38 +10:00
Dan Nicholson
87a1507da7 xfree86: Match devices based on USB ID
Sometimes the vendor and product names aren't specific enough to target
a USB device, so expose the numeric codes in the ID. A MatchUSBID entry
has been added that supports shell pattern matching when fnmatch(3) is
available. For example:

	MatchUSBID "046d:*"

The IDs are stored in lowercase hex separated by a ':' like "lsusb" or
"lspci -n".

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-11 09:30:33 +10:00
Dan Nicholson
645679c152 xfree86: Match devices based on PnP ID
Serial input devices lack properties such as product or vendor name. This
makes matching InputClass sections difficult. Add a MatchPnPID entry to
test against the PnP ID of the device. The entry supports a shell pattern
match on platforms that support fnmatch(3). For example:

	MatchPnPID "WACf*"

A match type for non-path pattern matching, match_pattern, has been added.
The difference between this and match_path_pattern is the FNM_PATHNAME
flag in fnmatch(3).

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-11 09:30:07 +10:00
Dan Nicholson
61c35d8ac4 config/hal: Missing newline in log message
Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-10 14:33:08 +10:00
Dan Nicholson
697c5b010d config/udev: Add verbose info when fetching udev properties
Give the user a chance to see why their input devices are being ignored,
even if they have to start the server with -logverbose.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-10 14:33:02 +10:00
Dan Nicholson
94547b2d14 config/hal: don't leak the input.tags property
Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-10 14:32:57 +10:00
Mikhail Gusarov
0a4d8cbdcd Remove more superfluous if(p) checks around free(p)
This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@

-if(E) { free(E); }
+free(E);

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-06-06 20:27:18 +07:00
Keith Packard
4e9d3e4132 Revert "Add a "flags" field to DeleteInputDeviceRequest."
Peter wants to get a larger patch sequence put together and I didn't
read past the commit message to see the 'don't take this patch
please'.

This reverts commit 531ff40301.
2010-05-26 07:54:35 -07:00
Peter Hutterer
531ff40301 Add a "flags" field to DeleteInputDeviceRequest.
Some input drivers need to implement an internal hotplugging scheme for
dependent devices to provide multiple X devices off one kernel device file.
Such dependent devices can be added with NewInputDeviceRequest() but they are
not removed when the config backend calls DeleteInputDeviceRequest(),
leaving the original device to clean up.

Example of the wacom driver:

config/udev calls NewInputDeviceRequest("stylus")

wacom PreInit calls
        NewInputDeviceRequest("eraser")
        NewInputDeviceRequest("pad")
        NewInputDeviceRequest("cursor")
        PreInit finishes.

When the device is removed, the config backend only calls
DeleteInputDeviceRequest for "stylus". The driver needs to call
DeleteInputDeviceRequest for the dependent devices eraser, pad and cursor to
clean up properly.
However, when the server terminates, DeleteInputDeviceRequest is called for
all devices - the driver must not remove the dependent devices to avoid
double-frees. There is no method for the driver to detect why a device is
being removed, leading to elaborate guesswork and some amount of wishful
thinking.

Though the input driver's UnInit already supports flags, they are unused.
This patch uses the flags to supply information where the
DeleteInputDeviceRequest request originates from, allowing a driver to
selectively call DeleteInputDeviceRequest when necessary.

Also bumps XINPUT ABI.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-05-25 17:47:32 -07:00
Mikhail Gusarov
3f3ff971ec Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.

X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-13 00:22:37 +07:00
Dan Nicholson
d4dd3d0085 Move 10-evdev.conf to system config dir $datadir/X11/xorg.conf.d
Since the server searches in a vendor specific path now, we can install
the evdev catchall there without disturbing local administration files.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-08 15:21:01 +10:00
Peter Hutterer
c8a608cb6c config: only match sane devices in 10-evdev.conf
Having a generic catchall also adds devices like accelerometers. These
devices make X unusable, hence restrict matching to "known sane" devices
like pointers, touchpads, keyboards, tablets and touchscreens.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Julien Cristau <jcristau@debian.org>
Acked-by: Dan Nicholson <dbn.lists@gmail.com>
Acked-by: James Cloos <cloos@jhcloos.com>
2010-04-08 15:21:00 +10:00
Keith Packard
24952b7866 Install 10-evdev.conf in $(prefix)/etc/X11/xorg.conf.d under udev
udev needs some xorg.conf file to tell it to load a suitable input
driver, 10-evdev.conf is as simple as they come, mapping all evdev
devices to the evdev driver.

Signed-off-by: Keith Packard <keithp@keithp.com>
2010-04-01 23:59:36 -07:00
Dan Nicholson
aa91508356 config/udev: Prefer product name from attribute rather than uevent
The input device product name for evdev devices in the kernel uevent has
embedded quotes that aren't expected here. Use the sysfs name attribute
instead, which does not suffer this problem. The uevent name will be
used as a fallback if no name attribute is found.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-03-26 15:30:57 +10:00
Thomas Jaeger
8490500770 udev: Don't filter subsystem "input"
This allows serial wacom devices to work, whose subsystem is "tty".

Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-02-15 15:27:42 +10:00
Peter Hutterer
c6d9bc092c Add tag matching to input attributes.
Tags may be a list of comma-separated strings that match against a MatchTag
InputClass section. If any of the tags specified for a device match against
the MatchTag of the section, this match is evaluated true and passed on to
the next match condition.

Tags are specified as "input.tags" (hal) or "ID_INPUT.tags" (udev), the
value of the tags is case-sensitive and require an exact match (not a
substring match).

i.e. "quirk" will not match "QUIRK", "need_quirk" or "quirk_needed".

Example configuration:
udev:
    ENV{ID_INPUT.tags}="foo,bar"

hal:
    <merge key="input.tags" type="string">foo,bar</merge>

xorg.conf:
    Section "InputClass"
            Identifier "foobar quirks"
            MatchTag "foo|foobar"
            Option "Foobar" "on"
    EndSection

Where the xorg.conf section matches against any device with the tag "foo"
or tag "foobar" set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-02-11 19:25:49 +10:00
Julien Cristau
435f27667f config: add libudev input-hotplug backend
Add a backend using libudev for input hotplug, and disable the hal and
dbus backends if this one is enabled.

XKB configuration happens using xkb{rules,model,layout,variant,options}
properties (case-insensitive) on the device.  We fill in InputAttributes
to allow configuration through InputClass in Xorg.

Requires udev 148 for the input_id helper and ID_INPUT* properties.

Signed-off-by: Julien Cristau <jcristau@debian.org>
Acked-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-30 19:05:44 +00:00
Dan Nicholson
0711598dd3 config: Introduce InputAttributes in NewInputDeviceRequest
In order to give NewInputDeviceRequest more information, a new
InputAttributes type is introduced. Currently, this collects the product
and vendor name, device path, and sets booleans for attributes such as
having keys and/or a pointer. Only the HAL backend fills in the
attributes, though.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
2009-12-22 23:24:13 -08:00
Peter Hutterer
49046088f1 config: don't shutdown the libhal ctx if it failed to initialize (#23213)
Regression introduced by b1c3dc6ae2.
Shutting down the libhal_ctx if the init failed may cause an abort.
This can happen if hald is not yet running at server startup.

X.Org Bug 23213 <http://bugs.freedesktop.org/show_bug.cgi?id=23213>

Tested-by: Stefan Dirsch
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-14 11:01:20 +10:00
Rémi Cardona
b1c3dc6ae2 config: add HAL error checks
This patch simplifies error handling in the HAL code and fixes a
segfault if libhal_find_device_by_capability() failed.

Fixes http://bugs.gentoo.org/278760

Based on a patch by Martin von Gagern <Martin.vGagern@gmx.net>

Signed-off-by: Rémi Cardona <remi@gentoo.org>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-28 11:58:45 +02:00
Simon Thum
21ee53060b config: fix build after XI2 API changes to RemoveDevice.
This patch fixes the build with --enable-config-dbus is enabled
(default disabled).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-07 20:35:14 +10:00
Alan Coopersmith
1e816065e5 Don't printf NULL pointers on HAL connection error
Fixes Solaris bug 6801386 Xorg core dumps on startup if hald not running
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6801386

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-05-08 21:31:01 -07:00
Peter Hutterer
4844bff58f config: if we can't connect to HAL, listen for a startup notification.
If HAL isn't available when we try to connect, the registered NameOwnerChanged
signal handler waits until HAL is available. Once we connected to HAL, we
unregister the signal handler again.
This allows HAL to be started in parallel or after the server has started.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-10 15:01:44 +10:00
Tomas Carnecky
e04d9ab999 DBUS_API_SUBJECT_TO_CHANGE is already defined on the command line
dbus-core.c:30:1: warning: "DBUS_API_SUBJECT_TO_CHANGE" redefined
<command-line>: warning: this is the location of the previous definition

Signed-off-by: Tomas Carnecky <tom@dbservice.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-04 09:49:54 +10:00
Alan Coopersmith
60bcdd6870 x11-input.fdi: Add options needed to handle adding USB devices on Solaris 2009-01-30 21:45:12 -08:00
Julien Cristau
ef9902652b config: ANSI cleanups 2009-01-11 08:54:10 +01:00
Paulo Cesar Pereira de Andrade
b1dac41fb3 Use libtool convenience libraries and better "symbol" table.
All .a libraries were converted to .la, and instead of linking the
Xorg binary with a mix of .a and .la, and adding some libraries more
then once in the command line, etc, now it generates a single libxorg.la
from all the required convenience libraries, and links with a dummy
xorg.c (that should usually be the file with the main function...).
This removes the requirement of some things like libosandcommon and
libinit, that existed to circumvent problems when linking multiple
.a and .la in the final Xorg binary.

  The "symbol table" is now generated dynamically, by a shell script,
with an embedded gawk parser that parses cpp output. The new file
sdksyms.sh is generated by hand by analyzing all Makefile.am's and
making it create a sdksyms.c file, that includes all sdk headers that
will add symbols for the Xorg binary. Module headers aren't read, and
a in 2 files it was required to add a "<hash>ifndef XorgLoader" around
declarations shared between the Xorg binary and libextmod. A few
other changes were added to other sdk headers, like preventing
multiple inclusion, or including other headers to satisfy dependencies.

  This should be a lot more portable, and better (hopefully properly)
using libtool to generate convenience libraries.
2008-12-07 02:22:19 -02:00
Paulo Cesar Pereira de Andrade
49f77fff14 Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.

  This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)

  LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.

  xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 05:43:34 -02:00
Paulo Cesar Pereira de Andrade
d6cbd4511e Export symbols defined in the sdk.
This is the biggest "visibility" patch. Instead of doing a "export"
symbol on demand, export everything in the sdk, so that if some module
fails due to an unresolved symbol, it is because it is using a symbol
not in the sdk.

  Most exported symbols shouldn't really be made visible, neither
advertised in the sdk, as they are only used by a single shared object.

  Symbols in the sdk (or referenced in sdk macros), but not defined
anywhere include:
XkbBuildCoreState()
XkbInitialMap
XkbXIUnsupported
XkbCheckActionVMods()
XkbSendCompatNotify()
XkbDDXFakePointerButton()
XkbDDXApplyConfig()
_XkbStrCaseCmp()
_XkbErrMessages[]
_XkbErrCode
_XkbErrLocation
_XkbErrData
XkbAccessXDetailText()
XkbNKNDetailMaskText()
XkbLookupGroupAndLevel()
XkbInitAtoms()
XkbGetOrderedDrawables()
XkbFreeOrderedDrawables()
XkbConvertXkbComponents()
XkbWriteXKBSemantics()
XkbWriteXKBLayout()
XkbWriteXKBKeymap()
XkbWriteXKBFile()
XkbWriteCFile()
XkbWriteXKMFile()
XkbWriteToServer()
XkbMergeFile()
XkmFindTOCEntry()
XkmReadFileSection()
XkmReadFileSectionName()
InitExtInput()
xf86CheckButton()
xf86SwitchCoreDevice()
RamDacSetGamma()
RamDacRestoreDACValues()
xf86Bpp
xf86ConfigPix24
xf86MouseCflags[]
xf86SupportedMouseTypes[]
xf86NumMouseTypes
xf86ChangeBusIndex()
xf86EntityEnter()
xf86EntityLeave()
xf86WrapperInit()
xf86RingBell()
xf86findOptionBoolean()
xf86debugListOptions()
LoadSubModuleLocal()
LoaderSymbolLocal()
getInt10Rec()
xf86CurrentScreen
xf86ReallocatePciResources()
xf86NewSerialNumber()
xf86RandRSetInitialMode()
fbCompositeSolidMask_nx1xn
fbCompositeSolidMask_nx8888x0565C
fbCompositeSolidMask_nx8888x8888C
fbCompositeSolidMask_nx8x0565
fbCompositeSolidMask_nx8x0888
fbCompositeSolidMask_nx8x8888
fbCompositeSrc_0565x0565
fbCompositeSrc_8888x0565
fbCompositeSrc_8888x0888
fbCompositeSrc_8888x8888
fbCompositeSrcAdd_1000x1000
fbCompositeSrcAdd_8000x8000
fbCompositeSrcAdd_8888x8888
fbGeneration
fbIn
fbOver
fbOver24
fbOverlayGeneration
fbRasterizeEdges
fbRestoreAreas
fbSaveAreas
composeFunctions
VBEBuildVbeModeList()
VBECalcVbeModeIndex()
TIramdac3030CalculateMNPForClock()
shadowBufPtr
shadowFindBuf()
miRRGetScreenInfo()
RRSetScreenConfig()
RRModePruneUnused()
PixmanImageFromPicture()
extern int miPointerGetMotionEvents()
miClipPicture()
miRasterizeTriangle()
fbPush1toN()
fbInitializeBackingStore()
ddxBeforeReset()
SetupSprite()
InitSprite()
DGADeliverEvent()

  SPECIAL CASES
o defined as _X_INTERNAL
	xf86NewInputDevice()
o defined as static
	fbGCPrivateKey
	fbOverlayScreenPrivateKey
	fbScreenPrivateKey
	fbWinPrivateKey
o defined in libXfont.so, but declared in xorg/dixfont.h
	GetGlyphs()
	QueryGlyphExtents()
	QueryTextExtents()
	ParseGlyphCachingMode()
	InitGlyphCaching()
	SetGlyphCachingMode()
2008-11-29 23:56:06 -02:00
Alan Coopersmith
b4ca9dc239 When HAL returns a NULL property, print "(null)" instead of a NULL pointer
They've promised to fix Solaris printf soon to check for NULL pointers
instead of segfaulting, but that won't help people on existing releases.
2008-11-05 21:58:30 -08:00
Alan Coopersmith
d63ea51013 Non-Linux OS'es should default to kbd driver, not now-dead keyboard driver 2008-11-05 14:52:39 -08:00
Peter Hutterer
6c45185955 config: don't add duplicate devices through HAL.
If HAL is restarted, the device list is sent to the server again, leading
first to duplicate devices (and thus duplicate events), and later to a
FatalError "Too many input devices."

dev->config_info contains the UDI for the device. If the UDI of a new devices
is equal to one we already have in the device list, just ignore it.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-10-29 11:55:44 +10:30
Peter Hutterer
e58be0f342 config: print error code if NIDR fails. 2008-09-26 09:33:39 +09:30
Peter Hutterer
3c6a9c531f config: protect against potential out-of-bounds indexing. 2008-08-04 15:15:16 +09:30
Peter Hutterer
92c51b183c config: support type strlist for XkbOptions property.
For backwards compatibility with server 1.4.
2008-08-04 15:15:09 +09:30
Peter Hutterer
35b14519b4 config: add parsing for input.x11_options.XkbOptions. #16874
X.Org Bug 16874 <http://bugs.freedesktop.org/show_bug.cgi?id=16784>
2008-08-04 15:14:05 +09:30
Peter Hutterer
3575d9584e config: note that HAL options must be strings.
Only strings are parsed by the server, all others are ignored. Doesn't matter,
specifying int options as strings works fine anyway.
2008-07-28 09:06:02 +09:30
Daniel Stone
b8dd07f855 HAL: Remove grotesque open-coded strcasestr
Not only was this pretty ugly, but it didn't even work on systems
without strcasestr anyway, due to the define not being in dix-config.h.
Lack of strcasestr is handled transparently with the version from
FreeBSD now anyway, so, huzzah.
2008-07-16 03:02:20 +03:00
Daniel Stone
441f084bfe config: Don't attempt to use D-Bus when not strictly necessary
If we have D-Bus but have explicitly disabled it, don't build it.
2008-07-16 03:02:04 +03:00
Peter Hutterer
5ebe76f13f config: init dev to NULL to shut up a valgrind warning. 2008-06-02 10:26:03 +09:30
Adam Jackson
f52f6c5c7e Fix hal shutdown crash.
Removing the device invalidates its ->next pointer.  Copy it aside before
destroying the device.
2008-05-16 09:49:20 -04:00
Alan Coopersmith
ed65e8b4f0 Check for strcasestr and workaround it on systems without it 2008-05-12 18:50:04 -07:00
Peter Hutterer
ff013b0da4 config: override xkb_{r,m,l,v} with Xkb{r,m,l,v} if the latter is set.
The HAL spec says that input.xkb.{rmlv}* can be sent, but if the user
specifies a X-specific {rmlv}, then this is overridden through the use of
input.x11_options.Xkb{RMLV}.
However, the way how the server parses options--by ignoring capitalisation,
underscores and spaces--the HAL and the x11_options would override each other.

So we simply filter the options, letting Xkb{RMLV} override xkb_{rmlv} and
only actually add them to the device after parsing _all_ options.

* rmlv ... rules, model, layout, variant

See Bug 13037 <http://bugs.freedesktop.org/show_bug.cgi?id=13037>
(cherry picked from commit fc35d1e3be)
2008-05-09 10:09:35 +09:30
Peter Hutterer
901978ebe0 config: remove trailing whitespaces.
It makes my vim look ugly. Put "let c_space_errors=1" into your .vimrc.
(cherry picked from commit 1f54c05cf8)
2008-05-09 10:09:25 +09:30
Sascha Hlusiak
47eb658e80 Support to pass arbitrary options via HAL hotplugging
Parse "input.x11_options" and pass every key/name pair to the driver.
Remove check for input.capabilities, because that's part of the fdi files.

Thanks to Dustin Spicuzza <dustin@virtualroadside.com> for the patch.
2008-03-25 17:37:25 +01:00
Eamon Walsh
27bcf40cda XACE: Fix instances of DixUnknownAccess at hook callsites. 2008-02-28 16:43:43 -05:00
Peter Hutterer
975ab11799 config: don't reset connection info on disconnect.
If dbus is restarted, we try to connect again and this is difficult if the
busname and/or busobject is not set.
(cherry picked from commit 210eeef495)
2008-01-29 09:13:25 +10:30
Peter Hutterer
7dde5a694a config: check connection != NULL before getting dbus' dispatch status.
(cherry picked from commit d232665223)
2008-01-29 09:13:25 +10:30
Peter Hutterer
f0ba770716 config: only shutdown libhal if the connection is valid.
Thanks to libdbus' extensive use of assert we won't just get an error, it'll
bring the whole server down for us.
(cherry picked from commit fb07fab2c0)
2008-01-29 09:13:25 +10:30
Peter Hutterer
2cb0ebec2b config: add a debug message, fix a whitespace error.
(cherry picked from commit 7732898aaa)
2008-01-29 09:13:25 +10:30
Daniel Stone
190a050624 Config: HAL: Don't leak options on failure to add device
This showed up in Xephyr in particular, which denies new device requests.
2007-12-28 15:51:36 +02:00
Daniel Stone
f44fd3f9e4 Config: D-Bus: Don't leak timers
TimerCancel doesn't free the timer: you need TimerFree for that.
2007-12-28 15:51:36 +02:00
Fatih Aşıcı
009f1e4e55 Config: Don't forget to add xkb_rules option 2007-12-26 02:08:12 +01:00
Fatih Aşıcı
389e8917f6 Config: Fix a memory leak 2007-12-26 02:07:52 +01:00
Eamon Walsh
c8feb73f58 Merge branch 'master' into XACE-SELINUX
Conflicts:

	Xext/EVI.c
	Xext/bigreq.c
	Xext/cup.c
	Xext/dpms.c
	Xext/fontcache.c
	Xext/mitmisc.c
	Xext/xcmisc.c
	Xext/xf86bigfont.c
	Xext/xtest.c
	configure.ac
	dbe/dbe.c
	hw/darwin/darwin.h
	hw/darwin/darwinEvents.c
	hw/darwin/iokit/xfIOKit.h
	hw/darwin/iokit/xfIOKitCursor.c
	hw/darwin/quartz/fullscreen/fullscreen.c
	hw/darwin/quartz/fullscreen/quartzCursor.c
	hw/darwin/quartz/quartz.c
	hw/darwin/quartz/quartzCommon.h
	hw/darwin/quartz/quartzCursor.c
	hw/darwin/quartz/xpr/dri.c
	hw/darwin/quartz/xpr/dristruct.h
	hw/darwin/quartz/xpr/xprCursor.c
	hw/darwin/quartz/xpr/xprFrame.c
	hw/xfree86/modes/xf86RandR12.c
	include/cursor.h
	miext/rootless/rootlessCommon.h
	miext/rootless/rootlessScreen.c
	miext/rootless/rootlessWindow.c
	render/picturestr.h

Trying to pick up the pieces from the darwin churn here...
2007-12-13 18:38:25 -05:00
Kanru Chen
a8e27a108a Config: HAL: Fix XKB option parsing
Actually combine the XKB options into a string, rather than just repeatedly
writing a comma.
2007-12-05 18:29:54 +00:00
Eamon Walsh
1603130236 Merge branch 'master' into XACE-SELINUX
Conflicts:

	Xext/xace.c
	Xext/xace.h
2007-11-14 13:35:50 -05:00
Elvis Pranskevichus
ddce48ede0 Config: D-Bus: Fix dbus_bus_request_name failure check
The code in connect_hook incorrectly checks for dbus_bus_request_name failure.
The dbus_bus_request_name error indicator is -1, not 0. This leads
to subsequent assertion failure in libdbus.
2007-11-06 09:40:36 +00:00
Eamon Walsh
a52c9b2a59 Merge branch 'master' into XACE-SELINUX
Conflicts:

	dix/dispatch.c
	dix/property.c
	hw/xfree86/common/xf86VidMode.c
	include/xkbsrv.h
	render/glyph.c
	xkb/xkbActions.c
2007-11-05 19:08:36 -05:00
Markku Vire
3f1b6765aa Config: HAL: Touchpads are pointers too
Treat touchpads -- not just mice -- as pointer devices.
2007-11-04 16:46:21 +00:00
Eamon Walsh
5c03d13181 xace: add new hooks + access controls: XInput extension.
Introduces new dix API to lookup a device, dixLookupDevice(), which
replaces LookupDeviceIntRec and LookupDevice.
2007-09-28 08:02:00 -04:00
Aaron Plattner
3a965fdadc Don't segfault on shutdown if we never managed to connect to dbus. 2007-09-20 16:22:24 -07:00
Peter Hutterer
3f42af8c0e config: Use [config/dbus] consistently for error messages. 2007-08-31 15:03:02 +09:30
Peter Hutterer
0fcde83d94 config: return BadValue to caller if add/remove doesn't have parameters.
If message iterator cannot be created, the caller didn't supply any
parameters. Return BadValue, instead of dying a horrible death while being
stuck in an endless loop.
2007-08-31 15:03:02 +09:30
Julien Cristau
6ef4ecd826 config: fix default xkb model (pc105, not keyboard) 2007-08-21 18:17:35 +02:00
Daniel Stone
30259d5a4e Hotplug: HAL: Fix error handling
Don't use our DBusError for property getting, because we simply don't care:
this fixes D-Bus error spew to stderr.  Thanks Michel Dänzer for debugging
and testing.
2007-08-08 01:34:59 +03:00
Daniel Stone
aef255425a Config: HAL: Use input.xkb namespace
Use an explicit input.xkb.foo namespace, not input.xkb_foo.
2007-08-08 01:34:59 +03:00
Daniel Stone
6d6bc93b0a Build system: Add missing files
A couple of headers weren't added to the build.
2007-08-01 08:11:22 +03:00
Daniel Stone
0bd6fe7401 Config: Add missing include 2007-08-01 07:27:30 +03:00