From a9e97b33b9b81790e5b969f75bda3dddfd22e139 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 26 May 2021 16:39:03 +0100 Subject: [PATCH] Add constant offset to the field in the HID descriptor that provides the length of the HID Report descriptor --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 4 ++++ lib_xua/src/hid/xua_hid_descriptor.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 47991bf9..5c154b08 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2373,6 +2373,10 @@ const unsigned num_freqs_a1 = MAX(3, (0 #endif +#if( 0 < HID_CONTROLS ) + #define USB_HID_DESCRIPTOR_OFFSET (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + INTERFACE_DESCRIPTOR_BYTES) +#endif + #define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16) #if (MIN_FREQ_FS < 12000) && (MAX_FREQ_FS > 48000) diff --git a/lib_xua/src/hid/xua_hid_descriptor.h b/lib_xua/src/hid/xua_hid_descriptor.h index 4fed07a2..4dd44007 100644 --- a/lib_xua/src/hid/xua_hid_descriptor.h +++ b/lib_xua/src/hid/xua_hid_descriptor.h @@ -11,6 +11,8 @@ #ifndef _HID_DESCRIPTOR_ #define _HID_DESCRIPTOR_ +#define HID_DESCRIPTOR_LENGTH_FIELD_OFFSET ( 7 ) + /* USB HID Descriptor (section 6.2.1) */ typedef struct {