hothd-usb: Fix template expansion and start rate limits 70-hothd-usb.rules sets SYSTEMD_WANTS to "hothd-usb@" without the .service suffix. When systemd parses SYSTEMD_WANTS on uevents while the device unit is already plugged (such as the "bind" event after "add"), it only expands template instances when the unit name includes its type suffix, and otherwise tries to start the literal uninstantiated "hothd-usb@.service" and fails with Invalid argument. In addition, rapid USB controller re-binds during boot and HPM S5 transitions can hit gBMC's default 2-starts-per-30s rate limit and leave the instance failed. Spell out "hothd-usb@.service" in SYSTEMD_WANTS so systemd expands the device sysfs instance on both add and bind events, disable the start rate limit on hothd-usb@.service, and step restart delays from 5s up to 30s across 3 steps. Tested: Verified syntax with systemd-analyze and udevadm verify Google-Bug-Id: 585587833 Change-Id: Ib697ce8f237111a1a887279d216f83fd14f1dac5 Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/70-hothd-usb.rules b/70-hothd-usb.rules index fc3cb98..4089772 100644 --- a/70-hothd-usb.rules +++ b/70-hothd-usb.rules
@@ -1,3 +1,3 @@ -ACTION!="remove|unbind",SUBSYSTEMS=="usb",ATTR{idVendor}=="18d1",ATTR{idProduct}=="5014",TAG+="systemd",ENV{SYSTEMD_WANTS}="hothd-usb@",MODE="0660",OWNER="hothd",GROUP="hothd" -ACTION!="remove|unbind",SUBSYSTEMS=="usb",ATTR{idVendor}=="18d1",ATTR{idProduct}=="022a",TAG+="systemd",ENV{SYSTEMD_WANTS}="hothd-usb@",MODE="0660",OWNER="hothd",GROUP="hothd" -ACTION!="remove|unbind",SUBSYSTEMS=="usb",ATTR{idVendor}=="18d1",ATTR{idProduct}=="023b",TAG+="systemd",ENV{SYSTEMD_WANTS}="hothd-usb@",MODE="0660",OWNER="hothd",GROUP="hothd" +ACTION!="remove|unbind",SUBSYSTEMS=="usb",ATTR{idVendor}=="18d1",ATTR{idProduct}=="5014",TAG+="systemd",ENV{SYSTEMD_WANTS}="hothd-usb@.service",MODE="0660",OWNER="hothd",GROUP="hothd" +ACTION!="remove|unbind",SUBSYSTEMS=="usb",ATTR{idVendor}=="18d1",ATTR{idProduct}=="022a",TAG+="systemd",ENV{SYSTEMD_WANTS}="hothd-usb@.service",MODE="0660",OWNER="hothd",GROUP="hothd" +ACTION!="remove|unbind",SUBSYSTEMS=="usb",ATTR{idVendor}=="18d1",ATTR{idProduct}=="023b",TAG+="systemd",ENV{SYSTEMD_WANTS}="hothd-usb@.service",MODE="0660",OWNER="hothd",GROUP="hothd"
diff --git a/hothd-usb@.service.in b/hothd-usb@.service.in index 599259f..ff63689 100644 --- a/hothd-usb@.service.in +++ b/hothd-usb@.service.in
@@ -4,11 +4,14 @@ # restarting into the gap and hitting the exit-10 "Missing mapping" path. BindsTo=%i.device After=%i.device +StartLimitIntervalSec=0 [Service] Type=notify Restart=always RestartSec=5 +RestartSteps=3 +RestartMaxDelaySec=30s RestartPreventExitStatus=10 ExecStart=@libexecdir@/hothd_usb.sh /%I User=hothd