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

Commit 118c2610 authored by jiabin's avatar jiabin
Browse files

AHAL: fix USB HAL issues with reporting device capabilities.

1. The card and device must be specified before reading device info.
2. Map PcmType::FIXED_Q_8_24 to PCM_FORMAT_S24_LE.
   Map PcmType::INT_24_BIT to PCM_FORMAT_S24_3LE.

Bug: 266216550
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ib48538d01bc980524e2c4c5b221f6d7e479beba6
parent 960c33c5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -139,7 +139,11 @@ ndk::ScopedAStatus ModuleUsb::populateConnectedDevicePort(AudioPort* audioPort)
    const bool isInput = isUsbInputDeviceType(devicePort.device.type.type);
    alsa_device_profile profile;
    profile_init(&profile, isInput ? PCM_IN : PCM_OUT);
    profile.card = alsaAddress[0];
    profile.device = alsaAddress[1];
    if (!profile_read_device_info(&profile)) {
        LOG(ERROR) << __func__ << ": failed to read device info, card=" << profile.card
                   << ", device=" << profile.device;
        return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
    }

+3 −3
Original line number Diff line number Diff line
@@ -114,8 +114,8 @@ const AudioFormatDescToPcmFormatMap& getAudioFormatDescriptorToPcmFormatMap() {
    static const AudioFormatDescToPcmFormatMap formatDescToPcmFormatMap = {
            {make_AudioFormatDescription(PcmType::UINT_8_BIT), PCM_FORMAT_S8},
            {make_AudioFormatDescription(PcmType::INT_16_BIT), PCM_FORMAT_S16_LE},
            {make_AudioFormatDescription(PcmType::INT_24_BIT), PCM_FORMAT_S24_LE},
            {make_AudioFormatDescription(PcmType::FIXED_Q_8_24), PCM_FORMAT_S24_3LE},
            {make_AudioFormatDescription(PcmType::FIXED_Q_8_24), PCM_FORMAT_S24_LE},
            {make_AudioFormatDescription(PcmType::INT_24_BIT), PCM_FORMAT_S24_3LE},
            {make_AudioFormatDescription(PcmType::INT_32_BIT), PCM_FORMAT_S32_LE},
            {make_AudioFormatDescription(PcmType::FLOAT_32_BIT), PCM_FORMAT_FLOAT_LE},
    };