Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27152a16 authored by Kuirong Wang's avatar Kuirong Wang Committed by Gerrit - the friendly Code Review server
Browse files

hal: update the sequence for adding USB RX and TX device

Update to scan both USB RX and TX device capability if either USB
RX and TX device is connectioned.

Change-Id: Ifb1baea427d63a1a71545073742bd3dcce4bbaa8
CRs-Fixed: 1088414
parent 7e78496e
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -854,8 +854,8 @@ bool audio_extn_usb_is_config_supported(unsigned int *bit_width,
    struct usb_card_config *card_info;
    bool is_usb_supported = false;

    ALOGV("%s: from stream: bit-width(%d) sample_rate(%d) ch(%d)",
           __func__, *bit_width, *sample_rate, *ch);
    ALOGV("%s: from stream: bit-width(%d) sample_rate(%d) ch(%d) is_playback(%d)",
           __func__, *bit_width, *sample_rate, *ch, is_playback);
    list_for_each(node_i, &usbmod->usb_card_conf_list) {
        card_info = node_to_item(node_i, struct usb_card_config, list);
        ALOGI_IF(usb_audio_debug_enable,
@@ -882,6 +882,7 @@ void audio_extn_usb_add_device(audio_devices_t device, int card)
{
    struct usb_card_config *usb_card_info;
    char check_debug_enable[PROPERTY_VALUE_MAX];
    struct listnode *node_i;

    property_get("audio.usb.enable.debug", check_debug_enable, NULL);
    if (atoi(check_debug_enable)) {
@@ -902,6 +903,18 @@ void audio_extn_usb_add_device(audio_devices_t device, int card)
        goto exit;
    }

    list_for_each(node_i, &usbmod->usb_card_conf_list) {
        usb_card_info = node_to_item(node_i, struct usb_card_config, list);
        ALOGI_IF(usb_audio_debug_enable,
                 "%s: list has capability for card_dev_type (0x%x), card_no(%d)",
                 __func__,  usb_card_info->usb_device_type, usb_card_info->usb_card);
        /* If we have cached the capability */
        if ((usb_card_info->usb_device_type == device) && (usb_card_info->usb_card == card)) {
            ALOGV("%s: capability for device(0x%x), card(%d) is cached, no need to update",
                  __func__, device, card);
            goto exit;
        }
    }
    usb_card_info = calloc(1, sizeof(struct usb_card_config));
    if (usb_card_info == NULL) {
        ALOGE("%s: error unable to allocate memory",
+2 −1
Original line number Diff line number Diff line
@@ -4404,7 +4404,8 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
             */
            ret = str_parms_get_str(parms, "card", value, sizeof(value));
            if (ret >= 0) {
                audio_extn_usb_add_device(val, atoi(value));
                audio_extn_usb_add_device(AUDIO_DEVICE_OUT_USB_DEVICE, atoi(value));
                audio_extn_usb_add_device(AUDIO_DEVICE_IN_USB_DEVICE, atoi(value));
            }
            ALOGV("detected USB connect .. disable proxy");
            adev->allow_afe_proxy_usage = false;