summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2025-10-01 09:42:33 +0200
committerHiFiPhile <[email protected]>2025-10-01 10:05:53 +0200
commit1ee113e0e7e12eb9d7969e58a9410feca6db3976 (patch)
tree644f19fc32ef654c66e6251622a046803d2e232c /src/class
parentd5108589b6f3bb1139523765c9cc625c56b08832 (diff)
better EP type detection
Signed-off-by: HiFiPhile <[email protected]>
Diffstat (limited to 'src/class')
-rw-r--r--src/class/audio/audio.h7
-rw-r--r--src/class/audio/audio_device.c12
2 files changed, 12 insertions, 7 deletions
diff --git a/src/class/audio/audio.h b/src/class/audio/audio.h
index 1ab0739b5..6042d7cf9 100644
--- a/src/class/audio/audio.h
+++ b/src/class/audio/audio.h
@@ -489,7 +489,12 @@ typedef struct TU_ATTR_PACKED {
uint8_t bLength; ///< Size of this descriptor in bytes: 9.
uint8_t bDescriptorType; ///< Descriptor Type. Value: TUSB_DESC_ENDPOINT.
uint8_t bEndpointAddress;///< The address of the endpoint on the USB device described by this descriptor.
- uint8_t bmAttributes; ///< Endpoint attributes when configured using the bEndpointAddress field.
+ struct TU_ATTR_PACKED {
+ uint8_t xfer : 2; // Control, ISO, Bulk, Interrupt
+ uint8_t sync : 2; // None, Asynchronous, Adaptive, Synchronous
+ uint8_t usage : 2; // Data, Feedback, Implicit feedback
+ uint8_t : 2;
+ } bmAttributes;
uint16_t wMaxPacketSize; ///< Maximum packet size this endpoint is capable of sending or receiving when this configuration is selected.
uint8_t bInterval; ///< Interval for polling endpoint for data transfers.
uint8_t bRefresh; ///< The rate at which the endpoint is refreshed.
diff --git a/src/class/audio/audio_device.c b/src/class/audio/audio_device.c
index 9fa55acc5..e0d25bfc8 100644
--- a/src/class/audio/audio_device.c
+++ b/src/class/audio/audio_device.c
@@ -948,12 +948,12 @@ uint16_t audiod_open(uint8_t rhport, tusb_desc_interface_t const *itf_desc, uint
if (tud_audio_n_version(i) == 1) {
// UAC1: Use bRefresh field to distinguish endpoint types
audio10_desc_as_iso_data_ep_t const *desc_ep_uac1 = (audio10_desc_as_iso_data_ep_t const *) p_desc;
- is_feedback_ep = (desc_ep_uac1->bRefresh > 0);
- is_data_ep = (desc_ep_uac1->bRefresh == 0);
+ is_data_ep = (desc_ep_uac1->bmAttributes.sync != TUSB_ISO_EP_ATT_NO_SYNC);
+ is_feedback_ep = (desc_ep_uac1->bmAttributes.sync == TUSB_ISO_EP_ATT_NO_SYNC);
} else {
// UAC2: Use bmAttributes.usage to distinguish endpoint types
- is_feedback_ep = (desc_ep->bmAttributes.usage == 1);
is_data_ep = (desc_ep->bmAttributes.usage == 0 || desc_ep->bmAttributes.usage == 2);
+ is_feedback_ep = (desc_ep->bmAttributes.usage == 1);
}
#if CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP
@@ -1204,12 +1204,12 @@ static bool audiod_set_interface(uint8_t rhport, tusb_control_request_t const *p
if (tud_audio_n_version(func_id) == 1) {
// UAC1: Use bRefresh field to distinguish endpoint types
audio10_desc_as_iso_data_ep_t const *desc_ep_uac1 = (audio10_desc_as_iso_data_ep_t const *) p_desc;
- is_feedback_ep = (desc_ep_uac1->bRefresh > 0);
- is_data_ep = (desc_ep_uac1->bRefresh == 0);
+ is_data_ep = (desc_ep_uac1->bmAttributes.sync != TUSB_ISO_EP_ATT_NO_SYNC);
+ is_feedback_ep = (desc_ep_uac1->bmAttributes.sync == TUSB_ISO_EP_ATT_NO_SYNC);
} else {
// UAC2: Use bmAttributes.usage to distinguish endpoint types
- is_feedback_ep = (desc_ep->bmAttributes.usage == 1);
is_data_ep = (desc_ep->bmAttributes.usage == 0 || desc_ep->bmAttributes.usage == 2);
+ is_feedback_ep = (desc_ep->bmAttributes.usage == 1);
}
//TODO: We need to set EP non busy since this is not taken care of right now in ep_close() - THIS IS A WORKAROUND!