led->buf[0] = 0;
led->buf[1] = br;
+ /*
+ * Request USB HID device to be in Full On mode, so that sending
+ * hardware output report and hardware raw request won't fail.
+ */
+ ret = hid_hw_power(led->hdev, PM_HINT_FULLON);
+ if (ret < 0) {
+ hid_err(led->hdev, "failed: device not resumed %d\n", ret);
+ return ret;
+ }
+
ret = hid_hw_output_report(led->hdev, led->buf, sizeof(led->buf));
if (ret == -ENOSYS)
ret = hid_hw_raw_request(led->hdev, 0, led->buf,
if (ret < 0)
hid_err(led->hdev, "failed to set keyboard backlight: %d\n",
ret);
+
+ /* Request USB HID device back to Normal Mode. */
+ hid_hw_power(led->hdev, PM_HINT_NORMAL);
+
return ret;
}