Commit Graph

30 Commits

Author SHA1 Message Date
Chris Michael 382e1a8957 elput: Fix null pointer dereference
Coverity reports this as a null pointer dereference, so check for
'seat' existence before comparing with strcmp

Fixes CID1385369

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-01-23 07:00:19 -05:00
Chris Michael 4e2406ed3b ecore_drm2: Only use a virtual terminal on seat0
Summary: Only seat0 supports virtual terminals.

Test Plan: Make sure enlightenment does not error out on non-seat0 due to a virtual terminal error. Enlightenment will not start yet on seat1 with this alone

Reviewers: ManMower, devilhorns

Reviewed By: devilhorns

Subscribers: ManMower, devilhorns, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5710
2018-01-22 11:25:15 -05:00
Derek Foreman 69c6cbfdf1 elput: Close fds when asked to
Our close callback tells logind we're done with a device, but it should
also actually close the fd it's passed, or we end up leaking piles of
fds on VC switch.

see weston commit 8f5acc2f3a29c3831af4ddd6bed57f703c98dc77
and subsequent regression in commit 72dea06d7952e3ce8dd8057f7106186da4fa2678
and pending fix in https://patchwork.freedesktop.org/patch/168992/
2017-07-25 16:59:11 -05:00
Derek Foreman 27f88b534a elput: Fix multiple open/close of drm devices
When I added the code to probe drm devices to ensure they're
modeset capable (ref 414d406b3b)
I didn't realize elput didn't allow us to open and close more than
one drm device at startup without blowing up libinput.

This is a somewhat dirty hack to rough that in.

The problem is that open/close the device during startup will
result in an async "gone" callback from logind, which then kicks
off an input shutdown.  We need to try harder to only do that
shutdown when it makes sense.
2017-07-24 16:06:52 -05:00
Chris Michael c45da5c138 elput: Fix resource leak
Coverity CID1377539 says that we leak the eldbus reply here when we
error out, so be sure to cleanup 'reply'

Fixes CID1377539

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-07-12 11:02:16 -04:00
Derek Foreman b53d1e29f1 elput: Fix logind session object path
We're supposed to query the path for a session id instead of just
making up the string ourselves.

Fixes all input devices being dead after a vc switch for some users.
2017-05-31 14:16:36 -05:00
Mike Blumenkrantz e8fe0bcc47 elput/drm: redo xkb context/keymap setting
context and keymap need to be set at the same time in order to effectively
update keyboard state, and active group should be accessible through api
as well

preserve old function ABI to ensure old binaries don't crash
2017-05-26 16:27:42 -04:00
Chris Michael 358b4b9a9a elput: Fix resource leak
Coverity reports that we leak 'msg' here if we fail to append
arguments to the message.

Fixes CID1367499

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-01-25 09:09:38 -05:00
Chris Michael d0a6263519 elput: Fix resource leak
Coverty reports that we leak 'reply' here if we fall into the error
condition.

CID1367506

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-12-19 09:49:36 -05:00
Chris Michael fe27a8d440 elput: Fix resource leak
Coverity reports that 'reply' is leaked here if we fall into the error
condition.

CID1367507

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-12-19 09:48:30 -05:00
Bruno Dilly a3fba57b26 ecore_con,elput: fix warnings
Summary:
elput: fix warning for unused write result
         ecore_con: fix warning for unused asprintf result

Reviewers: iscaro, devilhorns, cedric

Reviewed By: cedric

Subscribers: cedric, seoz, jpeg

Differential Revision: https://phab.enlightenment.org/D4308

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-09-20 16:13:28 -07:00
Marcel Hollerbach 38554b652a elput: check for a special return value
sd_pid_get_session returns ENODATA or ENXIO if it was unable to fetch
the session data for the given pid, reason for that is mostly that the
pid is not running is a session. Adding this as the error value can help
the user debugging the problem without the need of gdb´ing into the
function and checking the return value.
2016-07-11 11:02:52 +02:00
Chris Michael b2a4f45790 elput: Support suspending and resuming inputs on vt switch
This patch fixes an issue where input would stop working when you
vt-switch away and back again in a running Enlightenment Wayland
session. Basically, when we vt-switch away, we need to tell libinput
to suspend input event processing, and when we return to re-enable it.

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-06-21 12:46:29 -04:00
Chris Michael 28f79d4585 elput: Fix issue of VT-Switching not working
This patch fixes an issue where you could not VT-switch away from a
running Enlightenment session by simplifying the vt switch code and
passing the proper arguments to the dbus message.

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-06-13 16:19:46 -04:00
Chris Michael 09fc4e7b68 Revert "elput: Missing pointer initialization."
Reverting this as the initialization of char *s was already set to
NULL in a previous patch, so the 'if (s)' check here is pointless
really as 'man 3 free' says passing NULL to free() is ok.

This reverts commit ad2e21b023.
2016-06-07 12:09:20 -04:00
Benjamin Jacobs ad2e21b023 elput: Missing pointer initialization.
Summary:
Calling free() on an uninitialized pointer leads to crash, that can occurs
when sd_session_get_seat fails.
Fixes T3785.

Reviewers: devilhorns

Subscribers: cedric, jpeg

Maniphest Tasks: T3785

Differential Revision: https://phab.enlightenment.org/D4015

@fix
2016-06-07 09:43:01 -04:00
Chris Michael 180e64653d elput: Fix crash whem sd_session_get_seat fails
If systemd fails to give us a valid session id, then any further calls
to get a seat from that session are going to fail. As such, check for
a valid seat return from systemd before calling any systemd functions
which require session id.

Fixes T3785

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-06-06 14:53:35 -04:00
Chris Michael 3c6cb6a02b elput: Minor formatting fixes
NB: No functional changes, just cleanup of formatting

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-26 08:42:38 -04:00
Chris Michael 03c42fd2cb elput: Fix formatting
NB: No functional changes, just making this readable

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-25 15:03:15 -04:00
Mike Blumenkrantz 7fdcf841f5 elput: change some functions and internal flags to enable async input setup
this sets attributes on the Elput_Manager struct so that devices created at
a later point can then have relevant attributes applied to them
2016-05-25 12:57:27 -04:00
Mike Blumenkrantz 5f088b026d elput: define and implement an async device opening interface for libinput
this adds an overly-complex method of removing blocking dbus calls from libinput's
synchronous device initialization architecture. libinput was clearly never meant
to be used in this way, but we're doing it anyway because we're efl.

 #SamsungFeatures
2016-05-25 12:57:27 -04:00
Mike Blumenkrantz 33a5d44dcf elput: remove 'sync' param from device management
unnecessarily complicates code
2016-05-25 12:57:26 -04:00
Chris Michael f9149c1699 elput: Add API function to switch to a given vt
This patch adds a new API function to Elput that can be used to switch
to a given VT. This allows drm2 or enlightenment to switch to a given
virtual terminal in response to keybindings.

@feature

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-09 11:35:48 -04:00
Chris Michael a96266c422 elput: Remove erroneous debug print out
NB: No functional changes, just cleanup of extra debug message and
commented out codeblock

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-09 11:05:21 -04:00
Chris Michael 3de066469a elput: Support sending of session activate/deactivate event
This patch adds support for notifying when a session gets activated or
deactivated. This will be used in drm2 to notify compositor when to
pause/restart rendering during a vt switch

@feature

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-09 11:01:30 -04:00
Chris Michael 9ed2f42c08 elput: Remove useless dbus argument fetching
As we do not need minor or fd from the dbus message during input
device resume, we can remove these variables

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-09 10:40:23 -04:00
Chris Michael b764978f29 elput: Create and raise event when seat capabilities change
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-04-13 14:16:17 -04:00
Chris Michael b5422700c0 elput: Remove vt activate/restore from input manager interface
As this library is just going to deal with libinput, we don't need to
have interface functions to activate or restore a virtual terminal.

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-04-13 14:16:17 -04:00
Chris Michael 1ce6cd4382 elput: Add API functions to open and close an input device
This adds new API functions which can be called to open or close an input
device and take control (or release control) of said device

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-04-13 14:16:17 -04:00
Chris Michael ed3a1f3958 elput: Add input manager interface and APIs to connect & disconnect
This commit adds the start of the Elput Manager & Interface code. This
will be used as an inteface to various backend methods of session &
device control (ie: systemd, direct interface, etc). This will provide
various abstractions for working with libinput when opening/closing
input devices.

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-04-13 14:16:17 -04:00