Commit Graph

40 Commits

Author SHA1 Message Date
Peter Hutterer d13cb97442 ddx: add new call to purge input devices that weren't added
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-10-26 15:35:07 +10:00
Julien Cristau e4153c1d91 Xi: make stub DeleteInputDeviceRequest call RemoveDevice
DeleteInputDeviceRequest is called from CloseDownDevices on reset, so
call RemoveDevice to avoid leaking devices in Xvfb/Xnest/Xwin.

Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-24 14:57:11 +10: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
Simon Thum 2103d61909 simplify ChangeDeviceControl in stubs
Signed-off-by: Simon Thum <simon.thum@gmx.de>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-24 09:52:48 +10:00
Peter Hutterer 4ac3be29bc input: Purge AddOtherInputDevices DDX hook.
This hook wasn't used by any DDX. Device addition and removal is handled by
the config backend, so we don't need to do anything special that during the
ListInputDevices request processing.

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:52 +10:00
Peter Hutterer cb672a461c input: remove OpenInputDevice and CloseInputDevice DDX hooks.
In theory, these hooks were to be used for DDX-specific device enablement.
None of the DDXs however did anything here. Now we call DEVICE_INIT on all
devices when they are added, so the xfree86 DDX as the only one with real
code didn't do anything here.

kdrive checked for device validity but that's already handled in
ProcXOpenDevice.

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:51 +10:00
Peter Hutterer 0fb7a5c261 input: Purge Register*Device() functions.
RegisterPointerDevice() and RegisterKeyboardDevice() were already mapped to
RegisterOtherDevice() and obsolete.

RegisterOtherDevice() was called for all devices and the two assignments can
simply be moved into AddInputDevice(). Purge RegisterOtherDevice() and
pretend it never happened.

*lalalalala*

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:47 +10:00
Mikhail Gusarov 7287ef9e6c Remove unnecessary parentheses around return values in functions
This patch was generated by the following Perl code:

perl -i -pe 's/([^_])return\s*\(\s*([^(]+?)\s*\)s*;(\s+(\n))?/$1return $2;$4/g;'

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-06-10 06:42:42 -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
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
Eamon Walsh 119b966677 Xi: fix up access modes for calls to dixLookupDevice().
New access modes are being passed to the device access hook for XI2:
DixCreateAccess for creating a new master device;
DixAdd/RemoveAccess for attaching/removing slave devices to a master; and
DixListProp/GetProp/SetPropAccess for device properties.

Refer to the XACE-Spec document in xorg-docs, section "Device Access."

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-06-23 20:50:29 -04:00
Peter Hutterer cb95642dc8 Remove #define NEED_EVENTS and NEED_REPLIES
A grep on xorg/* revealed there's no consumer of this define.

Quote Alan Coopersmith:
"The consumer was in past versions of the headers now located
in proto/x11proto - for instance, in X11R6.0's xc/include/Xproto.h,
all the event definitions were only available if NEED_EVENTS were
defined, and all the reply definitions required NEED_REPLIES.

Looks like Xproto.h dropped them by X11R6.3, which didn't have
the #ifdef's anymore, so these are truly ancient now."

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2008-12-12 11:43:32 +10: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
Peter Hutterer 8da83836b6 Merge branch 'master' into mpx
Conflicts:

	XTrap/xtrapddmi.c
	Xext/security.c
	Xext/xprint.c
	Xext/xtest.c
	Xext/xvdisp.c
	Xi/exevents.c
	Xi/grabdevb.c
	Xi/grabdevk.c
	Xi/opendev.c
	Xi/ungrdev.c
	Xi/ungrdevb.c
	Xi/ungrdevk.c
	dix/cursor.c
	dix/devices.c
	dix/dixutils.c
	dix/events.c
	dix/getevents.c
	dix/main.c
	dix/window.c
	hw/xfree86/ramdac/xf86Cursor.c
	include/dix.h
	include/input.h
	include/inputstr.h
	mi/midispcur.c
	mi/miinitext.c
	mi/misprite.c
	render/animcur.c
	xfixes/cursor.c
	xkb/xkbAccessX.c
2008-01-03 17:04:54 +10:30
Peter Hutterer e96d926d64 Xi: remove trailing whitespaces. 2007-11-13 17:14:35 +10:30
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
Remigiusz Marcinkiewicz aecbc71214 Input: Allow a pointer to a device to be returned in NIDR
Allow a pointer to the first device added to be returned, so we know which
device(s) were added by the NIDR call.
2007-04-11 00:38:16 +03:00
Magnus Vigerlöf 82962bbae2 Input: Add DeleteInputDeviceRequest
Add DIDR, which asks the DDX to remove a device, analogous to
NewInputDeviceRequest.  Only implemented for XFree86 at the moment.
2007-04-10 23:58:20 +03:00
Peter Hutterer 307d2b57bb Xi: remove 'register' keywords. 2007-03-29 15:23:41 +09:30
Daniel Stone 96e32805d1 Xi: disallow changing core keyboard and pointer
Just short-circuit the change core keyboard/pointer requests.
2006-10-29 03:43:34 +03:00
Daniel Stone b03e2f7029 xi: fix NIDR return yet again
For a one-line function, it was pretty broken.
2006-10-22 19:56:49 +03:00
Daniel Stone 90de7ce25a xi: fix return type for NIDR 2006-10-22 19:54:36 +03:00
Daniel Stone f46dc27291 xi: add NewInputDeviceRequest to stubs 2006-10-22 19:51:35 +03:00
Daniel Stone 31a6307b7b xi: change DEVICE_TOUCHSCREEN to ABS_{AREA_CALIB} for stubs 2006-10-22 19:49:31 +03:00
Daniel Stone b308dbf273 add DEVICE_TOUCHSCREEN and DEVICE_CORE Xi controls (DeviceIntRec ABI break)
Add DEVICE_TOUCHSCREEN and DEVICE_CORE controls to the Xi code, and the
TouchscreenClassRec and a coreEvents flag, to toggle propagation of core
events.
2006-07-21 15:19:50 -04:00
Daniel Stone 710bb2e6c8 Reindent with -cbi0. 2006-03-31 14:52:57 +00:00
Adam Jackson 6d7083bd69 indent fixes (OMG SO UGLY), and nuke old RCS keywords. 2006-02-20 22:16:49 +00:00
Adam Jackson 5480c537ce ANSIfy Xi/. Mostly automated via protoize(1). 2006-02-20 21:50:49 +00:00
Daniel Stone e03198972c Add Xtrans definitions (FONT_t, TRANS_CLIENT) to clean up warnings.
Add XSERV_t, TRANS_SERVER, TRANS_REOPEN to quash warnings.
Add #include <dix-config.h> or <xorg-config.h>, as appropriate, to all
    source files in the xserver/xorg tree, predicated on defines of
    HAVE_{DIX,XORG}_CONFIG_H. Change all Xfont includes to
    <X11/fonts/foo.h>.
2005-07-03 07:02:09 +00:00
Daniel Stone 292c4cff26 Fix includes right throughout the Xserver tree:
change "foo.h" to <X11/foo.h> for core headers, e.g. X.h, Xpoll.h;
change "foo.h", "extensions/foo.h" and "X11/foo.h" to
    <X11/extensions/foo.h> for extension headers, e.g. Xv.h;
change "foo.[ch]" to <X11/Xtrans/foo.[ch]> for Xtrans files.
2005-04-20 12:25:48 +00:00
Egbert Eich 0664db19bf Merging XORG-CURRENT into trunk 2004-04-23 18:54:16 +00:00
Egbert Eich dae90c3af9 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 2004-03-14 08:34:49 +00:00
Egbert Eich 867451f1ab Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 2004-03-03 12:12:50 +00:00
Egbert Eich df0313d35b readding XFree86's cvs IDs 2004-02-26 13:36:15 +00:00
Egbert Eich 147aae87fd Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 2004-02-26 09:23:53 +00:00
Kaleb Keithley adc7f9a4eb XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks 2003-11-25 19:29:01 +00:00
Kaleb Keithley d568221710 XFree86 4.3.0.1 2003-11-14 16:49:22 +00:00
Kaleb Keithley ded6147bfb R6.6 is the Xorg base-line 2003-11-14 15:54:54 +00:00