Closed HiFiPhile closed 2 months ago
@Marcus2060 @kf6gpe @rhysmorgan134
A quirk is come out which (hopefully) resolve UAC feedback format issue, test welcomed.
Now it's possible to use different Config descriptors:
uint8_t const desc_configuration_default[] =
{
// Config number, interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 500),
// Interface number, Alternate count, starting string index, attributes, detach timeout, transfer size
TUD_DFU_DESCRIPTOR(ITF_NUM_DFU, 1, 4, DFU_ATTR_CAN_UPLOAD | DFU_ATTR_CAN_DOWNLOAD | DFU_ATTR_MANIFESTATION_TOLERANT, 100, CFG_TUD_DFU_XFER_BUFSIZE),
};
uint8_t const desc_configuration_osx[] =
{
// Config number, interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL_OSX, 0, CONFIG_TOTAL_LEN_OSX, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 500),
// 1st CDC: Interface number, string index, EP notification address and size, EP data address (out, in) and size.
TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_0, 4, EPNUM_CDC_0_NOTIF, 8, EPNUM_CDC_0_OUT, EPNUM_CDC_0_IN, 64),
};
// Invoked when received GET CONFIGURATION DESCRIPTOR
// Application return pointer to descriptor
// Descriptor contents must exist long enough for transfer to complete
uint8_t const * tud_descriptor_configuration_cb(uint8_t index)
{
(void) index; // for multiple configurations
return (tud_quirk_host_os_hint() == TUD_QUIRK_OS_HINT_OSX) ? desc_configuration_osx: desc_configuration_default;
}
I'll have a go at building into my current project, may take a while as I few bits I think I need to get my head around to get it in there working. Thanks for looking into it!
I agree it's not stable and could break in the future.
But facing the UAC OS compatibility issue I can't come up a better way, at least it will calm down the issue for a moment.
I can move the quirk to application space of uac2_speaker_fb example in #2328 , but since callbacks are separated functions the quirk will become clustered and harder to understand.
@HiFiPhile that is OK, I still prefer not puttin this in the stack.. the commennt will help to illustrate the point of guess work. just use bool flag for each descriptor callback.
Already implemented in #2328
Describe the PR Due to the nature of quirk I'm not sure where to put...
This 1st OS detection quirk mainly resolve UAC class issue. Windows and OSX demand different feedback endpoint size for FS as Windows doesn't implement UAC spec correctly (Linux is compatible with both). So there needs a way to adjust Configuration Descriptor on the fly.
Tested on: