Solve the USB stall pid problem (mute problem)

Click the mute button and the USTS c0000004 stall pid problem occurs. 

It is because the data is not collected, which leads to the overflow of data.


int usbd_ep0_recv(uint16_t length, usbd_ep_xfer_callback_t callback)

static int uac_interface_class_request_out_handler(const usbd_interface_req_t *req)
{
    // only support SetCur()
    if (req->request != UAC_CLASS_REQ_SET_CUR) {
        return -1;
    }


    const uint8_t interface = req->index & 0xff;
    const uint8_t unit = req->index >> 8;
    switch (get_uac_interface(interface)) {
    case UAC_INTERFACE_HP_CONTROL:
        if (unit != UAC_FEATURE_UNIT_ID) {
            return -2;
        }

        m_hp_mute = req->value;

        int usbd_ep0_recv(uint16_t length, usbd_ep_xfer_callback_t callback); //Add this function to receive data

        return 0;
    case UAC_INTERFACE_MIC_CONTROL:
        if (unit != UAC_FEATURE_UNIT_ID) {
            return -2;
        }
        m_mic_mute = req->value;
        return 0;
    case UAC_INTERFACE_HP_DATA:
    case UAC_INTERFACE_MIC_DATA:
    case UAC_INTERFACE_UNKNOWN:
    default:
        return -1;
    }
}

Summary: When encountering such problems, learn analogy. The same is control, the truth is the same.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325905413&siteId=291194637