From 4aff1a4985faac187e0691a86dfc00f654006499 Mon Sep 17 00:00:00 2001
From: lassulus <git@lassul.us>
Date: Sat, 8 Jul 2023 14:59:15 +0200
Subject: [PATCH] l aergia.r: reinit usb after docking

---
 lass/1systems/aergia/physical.nix | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lass/1systems/aergia/physical.nix b/lass/1systems/aergia/physical.nix
index f24c6aa11..ef62478b4 100644
--- a/lass/1systems/aergia/physical.nix
+++ b/lass/1systems/aergia/physical.nix
@@ -99,4 +99,8 @@
 
   # firefox touchscreen support
   environment.sessionVariables.MOZ_USE_XINPUT2 = "1";
+  # reinit usb after docking station connect
+  services.udev.extraRules = ''
+    SUBSYSTEM=="drm", ACTION=="change", RUN+="${pkgs.dash}/bin/dash -c 'echo 0 > /sys/bus/usb/devices/usb9/authorized; echo 1 > /sys/bus/usb/devices/usb9/authorized'"
+  '';
 }