@@ -566,8 +566,8 @@ uint16_t hidh_open(uint8_t rhport, uint8_t daddr, const tusb_desc_interface_t *d
566566 // Use offsetof to avoid pointer to the odd/misaligned address
567567 p_hid -> report_desc_len = tu_unaligned_read16 ((uint8_t const * )desc_hid + offsetof(tusb_hid_descriptor_hid_t , wReportLength ));
568568
569- // Per HID Specs: default is Report protocol, though we will force Boot protocol when set_config
570- p_hid -> protocol_mode = _hidh_default_protocol ;
569+ // Per HID Specs: default is Report protocol
570+ p_hid -> protocol_mode = HID_PROTOCOL_REPORT ;
571571 if (HID_SUBCLASS_BOOT == desc_itf -> bInterfaceSubClass ) {
572572 p_hid -> itf_protocol = desc_itf -> bInterfaceProtocol ;
573573 }
@@ -632,14 +632,17 @@ static void process_set_config(tuh_xfer_t* xfer) {
632632 }
633633
634634 case CONFIG_SET_PROTOCOL :
635- #if CFG_TUH_HID_SET_PROTOCOL_ON_ENUM
635+ #if CFG_TUH_HID_SET_PROTOCOL_ON_ENUM
636636 hidh_set_protocol (daddr , p_hid -> itf_num , _hidh_default_protocol , process_set_config , CONFIG_GET_REPORT_DESC );
637637 break ;
638- #else
638+ #else
639639 TU_ATTR_FALLTHROUGH ;
640- #endif
640+ #endif
641641
642642 case CONFIG_GET_REPORT_DESC :
643+ if (xfer -> setup -> bRequest == HID_REQ_CONTROL_SET_PROTOCOL && xfer -> result == XFER_RESULT_SUCCESS ) {
644+ p_hid -> protocol_mode = (uint8_t ) tu_le16toh (xfer -> setup -> wValue );
645+ }
643646 // Get Report Descriptor if possible
644647 // using usbh enumeration buffer since the report descriptor can be very long
645648 if (p_hid -> report_desc_len > CFG_TUH_ENUMERATION_BUFSIZE ) {
0 commit comments