summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-09-20 09:48:22 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-09-20 11:46:49 +0200
commita3eabec96b872bbf581c9bfa81ecc9c2819b8de8 (patch)
tree344869ffd0d9afc4399b5567153b8f9f3a0d49ed
parent46c9a12780ea24ef311682897077423f1825c519 (diff)
terminal: grdev: treat udev-devices without devnum as hotplug
If we get udev-device events via sysview, but they lack devnum annotations, we know it cannot be a DRM card. Look through it's parents and treat it as hotplug event in case we find such a card. This will treat any new/removed connectors as sub-devices of the real card, instead of as devices on its own.
-rw-r--r--src/libsystemd-terminal/grdev.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/libsystemd-terminal/grdev.c b/src/libsystemd-terminal/grdev.c
index 1e02a6799c..bb89ee7170 100644
--- a/src/libsystemd-terminal/grdev.c
+++ b/src/libsystemd-terminal/grdev.c
@@ -1095,7 +1095,7 @@ void grdev_session_add_drm(grdev_session *session, struct udev_device *ud) {
devnum = udev_device_get_devnum(ud);
if (devnum == 0)
- return;
+ return grdev_session_hotplug_drm(session, ud);
card = grdev_find_drm_card(session, devnum);
if (card)
@@ -1120,7 +1120,7 @@ void grdev_session_remove_drm(grdev_session *session, struct udev_device *ud) {
devnum = udev_device_get_devnum(ud);
if (devnum == 0)
- return;
+ return grdev_session_hotplug_drm(session, ud);
card = grdev_find_drm_card(session, devnum);
if (!card)
@@ -1130,17 +1130,23 @@ void grdev_session_remove_drm(grdev_session *session, struct udev_device *ud) {
}
void grdev_session_hotplug_drm(grdev_session *session, struct udev_device *ud) {
- grdev_card *card;
+ grdev_card *card = NULL;
+ struct udev_device *p;
dev_t devnum;
assert(session);
assert(ud);
- devnum = udev_device_get_devnum(ud);
- if (devnum == 0)
- return;
+ for (p = ud; p; p = udev_device_get_parent_with_subsystem_devtype(p, "drm", NULL)) {
+ devnum = udev_device_get_devnum(ud);
+ if (devnum == 0)
+ continue;
+
+ card = grdev_find_drm_card(session, devnum);
+ if (card)
+ break;
+ }
- card = grdev_find_drm_card(session, devnum);
if (!card)
return;