diff --git a/module_usb_audio/endpoint0/descriptors.h b/module_usb_audio/endpoint0/descriptors.h index 719daabb..1b938cde 100644 --- a/module_usb_audio/endpoint0/descriptors.h +++ b/module_usb_audio/endpoint0/descriptors.h @@ -1882,6 +1882,22 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= }; #endif +#ifdef HID_CONTROLS +unsigned char hidDescriptor[] = +{ + 9, /* 0 bLength : Size of descriptor in Bytes */ + 0x21, /* 1 bDescriptorType (HID) */ + 0x10, /* 2 bcdHID */ + 0x01, /* 3 bcdHID */ + 0, /* 4 bCountryCode */ + 1, /* 5 bNumDescriptors */ + 0x22, /* 6 bDescriptorType[0] (Report) */ + sizeof(hidReportDescriptor) & 0xff,/* 7 wDescriptorLength[0] */ + sizeof(hidReportDescriptor) >> 8, /* 8 wDescriptorLength[0] */ +}; +#endif + + /* Configuration Descriptor for Null device */ unsigned char cfgDesc_Null[] = { diff --git a/module_usb_audio/endpoint0/endpoint0.c b/module_usb_audio/endpoint0/endpoint0.c index 0edf094c..55cee49b 100755 --- a/module_usb_audio/endpoint0/endpoint0.c +++ b/module_usb_audio/endpoint0/endpoint0.c @@ -372,7 +372,6 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, switch(sp.bRequest) { - #ifdef HID_CONTROLS case USB_GET_DESCRIPTOR: @@ -381,8 +380,14 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, { /* High byte of wValue is descriptor type */ unsigned descriptorType = sp.wValue & 0xff00; + switch (descriptorType) { + case HID_HID: + /* Return HID Descriptor */ + result = XUD_DoGetRequest(ep0_out, ep0_in, hidDescriptor, + sizeof(hidDescriptor), sp.wLength); + break; case HID_REPORT: /* Return HID report descriptor */ result = XUD_DoGetRequest(ep0_out, ep0_in, hidReportDescriptor,