#
# udev rules, in general
#
# vim: et:ts=2:sw=2:
#
{ deprekages, pkgs, waveforms, ... }:
{
  services.udev = {

    packages = [
      deprekages.ykush-udev-rules
      deprekages.hantek-udev-rules
      deprekages.dsview
      deprekages.humanfx
      pkgs.numworks-udev-rules
      pkgs.android-udev-rules
    ];

    extraRules = ''
      # Brother p-touch cube
      SUBSYSTEM == "usb", ATTRS{idVendor} == "04f9", ATTRS{idProduct} == "20af", MODE = "0666"

      # If we have a Apple T2 VHCI, force it to re-start once things are more up.
      # This forces a re-enumeration of the connected devices, and thus makes things like the touch bar work reliably.
      ACTION=="add", SUBSYSTEM=="usb", ATTR{serial}=="bce-vhci", ATTR{authorized}=="1", ATTR{authorized}="0", ATTR{authorized}="1"

      # Digilent waveforms
      ACTION=="add", ATTR{idVendor}=="1443", GROUP="plugdev", TAG+="uaccess"
      ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Digilent", GROUP="plugdev", TAG+="uaccess", RUN+="${waveforms.adept2-runtime}/sbin/dftdrvdtch %s{busnum} %s{devnum}"
    '';

  };
}
