This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.kioskEdid;
|
||||
|
||||
overrideModule = types.submodule {
|
||||
options = {
|
||||
connector = mkOption {
|
||||
type = types.str;
|
||||
example = "HDMI-A-1";
|
||||
description = ''
|
||||
DRM connector name to apply the EDID override to.
|
||||
Check `ls /sys/class/drm/` on target hardware to confirm the
|
||||
exact name (e.g. HDMI-A-1, HDMI-A-2).
|
||||
'';
|
||||
};
|
||||
|
||||
edidFile = mkOption {
|
||||
type = types.path;
|
||||
description = ''
|
||||
Path to the binary EDID file to force for this connector.
|
||||
'';
|
||||
};
|
||||
|
||||
forceConnected = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Also force this connector to be treated as connected
|
||||
(video=<connector>:e), in case the real link reports
|
||||
disconnected/garbled state through a splitter or wireless kit.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.services.kioskEdid = {
|
||||
enable = mkEnableOption "forcing custom EDIDs on one or more display connectors";
|
||||
|
||||
overrides = mkOption {
|
||||
type = types.listOf overrideModule;
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of per-connector EDID overrides to apply. Each entry gets its
|
||||
own firmware file and its own drm.edid_firmware kernel param.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
[
|
||||
{ connector = "HDMI-A-1"; edidFile = ./android-4k30-edid.bin; }
|
||||
{ connector = "HDMI-A-2"; edidFile = ./android-4k30-edid.bin; }
|
||||
]
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
hardware.firmware = map
|
||||
(o: pkgs.runCommand "kiosk-edid-firmware-${o.connector}" { } ''
|
||||
mkdir -p $out/lib/firmware/edid
|
||||
cp ${o.edidFile} $out/lib/firmware/edid/${o.connector}.bin
|
||||
'')
|
||||
cfg.overrides;
|
||||
|
||||
boot.kernelParams = flatten (map
|
||||
(o:
|
||||
[ "drm.edid_firmware=${o.connector}:edid/${o.connector}.bin" ]
|
||||
++ optional o.forceConnected "video=${o.connector}:e"
|
||||
)
|
||||
cfg.overrides);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user