fix hid duration

This commit is contained in:
sakumisu
2022-09-25 17:32:27 +08:00
parent 34a1d171ce
commit 7021e0b096
2 changed files with 1 additions and 7 deletions

View File

@@ -90,7 +90,7 @@ static int hid_class_interface_request_handler(struct usb_setup_packet *setup, u
break;
case HID_REQUEST_SET_IDLE:
/* report id, duration */
usbh_hid_set_idle(intf_num, LO_BYTE(setup->wValue), HI_BYTE(setup->wIndex));
usbh_hid_set_idle(intf_num, LO_BYTE(setup->wValue), HI_BYTE(setup->wValue));
break;
case HID_REQUEST_SET_PROTOCOL:
/* protocol */

View File

@@ -84,13 +84,7 @@ int usbh_hid_set_idle(struct usbh_hid *hid_class, uint8_t report_id, uint8_t dur
setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE;
setup->bRequest = HID_REQUEST_SET_IDLE;
//setup->wValue = report_id;
//setup->wIndex = (duration << 8) | hid_class->intf;
/* wValue, high-bytes sets the duration, or the max amount of time between reports
0x00 = hid will send a report only when report data has changed or duration time elapsed
low-bytes indicate the report id that the requeset applies to */
setup->wValue = (duration << 8) | report_id;
/* wIndex, num of interface that supports the request */
setup->wIndex = hid_class->intf;
setup->wLength = 0;