pub async fn set_backlight_enabled(
backend: &dyn HidBackend,
route: &DeviceRoute,
enabled: bool,
) -> Result<BacklightState, WriteError>Expand description
Enable or disable the backlight on route, and return the read-back state.
Disabling sets the firmware’s own master switch: the LEDs stay dark
regardless of the ambient-light and proximity sensors, and the device
reports BacklightStatus::DisabledBySoftware. The write goes to
non-volatile memory, so it survives reconnects, host switches, and power
cycles — nothing needs to re-apply it.
The effect, brightness level, and fade-out durations are read first and
written back unchanged, so they return with a later enabled = true.
The mode survives too, except from BacklightMode::TemporaryManual — the
state the keyboard enters on its own when the user presses its backlight
keys. setBacklightConfig cannot write that mode, so it lands in
BacklightMode::Automatic and the level goes back under ambient-light
control. Promoting it to BacklightMode::PermanentManual would hold the
level but make a deliberately temporary adjustment permanent, so the
firmware’s own fallback wins instead. Read the mode first and tell the user
when this applies.
FeatureUnsupported when the device does not expose HID++ 0x1982.