How to detect when the USB host is suspended?


I’m working with an USB keyboard that has a bunch of LEDs, which I’d like to turn off when the host is suspended, but isn’t powered off. On AVR, I can do this with reasonable ease: (_usbSuspendState & (1 << SUSPI)). If this is non-zero, the host is suspended. I can check it in loop() and act on it if it changes.

I’d like to be able to do the same on SAMD, but I couldn’t yet figure out how. The closest clue I found is USB->DEVICE.INTFLAG.bit.SUSPEND, but that always seems to be set, even when the host isn’t suspended.

What am I doing wrong? Is there something obvious I’m missing?