Skip to content

Commit eacdbec

Browse files
committed
Harden cog and kodi display device handling
Address the SPI panel by its stable by-path name and bind it to a fixed /dev/dri/card0 inside cog's namespace, so DRM card renumbering across kernel builds no longer breaks seat1. Make the kodi display-gate match the main connector on any card rather than a hardcoded cardN.
1 parent c1fabae commit eacdbec

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

overlays/configs/systemd/system/cog-seat1.service

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ ProtectHome=read-only
3535
ReadWritePaths=/var/lib/flipctl
3636
ReadWritePaths=/run/user/999
3737

38-
# Device cgroup allowlist
3938
DevicePolicy=closed
40-
DeviceAllow=/dev/dri/card0 rw
39+
DeviceAllow=/dev/dri/by-path/platform-2acf0000.spi-cs-0-card rw
4140
DeviceAllow=/dev/dri/renderD128 rw
42-
DeviceAllow=/dev/dri/card1 rw
4341
DeviceAllow=/dev/input/event0 rw
4442
DeviceAllow=/dev/input/event1 rw
45-
InaccessiblePaths=/dev/dri/card2
43+
44+
TemporaryFileSystem=/dev/dri
45+
BindPaths=/dev/dri/by-path/platform-2acf0000.spi-cs-0-card:/dev/dri/card0
46+
BindPaths=/dev/dri/by-path/platform-27800000.gpu-card:/dev/dri/card1
47+
BindPaths=/dev/dri/by-path/platform-27800000.gpu-render:/dev/dri/renderD128
4648

4749
ExecStartPre=/bin/sh -lc 'test -e /dev/dri/card0 && test -e /dev/input/event0'
4850
ExecStart=/usr/bin/cog -P drm -O renderer=gles http://localhost:8899
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/sh
2-
# Block until at least one card2 connector is connected, then exit 0.
2+
# Block until a DP/HDMI connector (the main display) reports connected, then exit 0.
3+
# Match the connector on ANY card -- DRM card numbers renumber across kernel builds
4+
# (the main display is not always card2), so never hardcode cardN.
35
while :; do
4-
for c in DP-1 HDMI-A-1; do
5-
[ "$(cat /sys/class/drm/card2-$c/status 2>/dev/null)" = connected ] && exit 0
6+
for f in /sys/class/drm/card*-DP-1/status /sys/class/drm/card*-HDMI-A-1/status; do
7+
[ "$(cat "$f" 2>/dev/null)" = connected ] && exit 0
68
done
79
sleep 1
810
done

0 commit comments

Comments
 (0)