[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kwin] /: udev: Only handle devices from the current seat
From: Martin_Flöser <null () kde ! org>
Date: 2018-04-05 17:48:00
Message-ID: E1f48zQ-00044F-Iz () code ! kde ! org
[Download RAW message or body]
Git commit 99376d38f69f6bcc13d7a8ebdb679b7c18e30586 by Martin Flöser, on behalf of \
Nerdopolis Turfwalker. Committed on 05/04/2018 at 17:47.
Pushed by graesslin into branch 'master'.
udev: Only handle devices from the current seat
Summary: This prevents the firstFound device, or any device detected by \
UdevEnumerate::find that is not from the same seat kwin is running under, from being \
handled
Test Plan:
made sure that kwin starts on a default udev (assuming a blank ID_SEAT attribute on a \
device means the device is on seat0)
added /dev/dri/card1 to seat1 and /dev/dri/card0 to seat0.
Start kwin with the drm-backend on seat0 and seat1, and make sure it starts on both \
instances
Reviewers: #kwin, graesslin
Reviewed By: #kwin, graesslin
Subscribers: rkflx, graesslin, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9553
M +9 -1 udev.cpp
https://commits.kde.org/kwin/99376d38f69f6bcc13d7a8ebdb679b7c18e30586
diff --git a/udev.cpp b/udev.cpp
index e3b2406c3..f064b089b 100644
--- a/udev.cpp
+++ b/udev.cpp
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "udev.h"
+#include "logind.h"
// Qt
#include <QByteArray>
#include <QScopedPointer>
@@ -106,6 +107,7 @@ UdevDevice::Ptr UdevEnumerate::find(std::function<bool(const \
UdevDevice::Ptr &de if (m_enumerate.isNull()) {
return UdevDevice::Ptr();
}
+ QString defaultSeat = QStringLiteral("seat0");
udev_list_entry *it = udev_enumerate_get_list_entry(m_enumerate.data());
UdevDevice::Ptr firstFound;
while (it) {
@@ -115,6 +117,13 @@ UdevDevice::Ptr UdevEnumerate::find(std::function<bool(const \
UdevDevice::Ptr &de if (!device) {
continue;
}
+ QString deviceSeat = device->property("ID_SEAT");
+ if (deviceSeat.isEmpty()) {
+ deviceSeat = defaultSeat;
+ }
+ if (deviceSeat != LogindIntegration::self()->seat()) {
+ continue;
+ }
if (test(device)) {
return device;
}
@@ -135,7 +144,6 @@ UdevDevice::Ptr Udev::primaryGpu()
enumerate.addMatch(UdevEnumerate::Match::SysName, "card[0-9]*");
enumerate.scan();
return enumerate.find([](const UdevDevice::Ptr &device) {
- // TODO: check seat
auto pci = device->getParentWithSubsystemDevType("pci");
if (!pci) {
return false;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic