From 7021e0b096a5c7eac41eb6c324d443664f09d307 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Sun, 25 Sep 2022 17:32:27 +0800 Subject: [PATCH] fix hid duration --- class/hid/usbd_hid.c | 2 +- class/hid/usbh_hid.c | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/class/hid/usbd_hid.c b/class/hid/usbd_hid.c index 12a69cf1..1f47bb3f 100644 --- a/class/hid/usbd_hid.c +++ b/class/hid/usbd_hid.c @@ -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 */ diff --git a/class/hid/usbh_hid.c b/class/hid/usbh_hid.c index 99909e90..6794a307 100644 --- a/class/hid/usbh_hid.c +++ b/class/hid/usbh_hid.c @@ -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;