sailfishos-sony-tama / main

Documentation, releases, and issues
MIT License
36 stars 7 forks source link

USB audio support is disabled in PulseAudio #94

Closed vaskas closed 2 years ago

vaskas commented 3 years ago

Hi guys,

At the moment (at least in a fresh 3.4.0.24 on h8216) PulseAudio doesn't pick up external USB devices from ALSA. You can see them with aplay -l but not in pactl list short cards.

The following enables USB audio support with automatic switching:

  1. Add the following module to /etc/pulse/arm_droid_default.pa

    ### Automatically load driver modules depending on the hardware available¬
    .ifexists module-udev-detect.so¬
    load-module module-udev-detect¬
    .else
  2. Enable the policy:

    ln -s /etc/pulse/xpolicy.conf.d/usbaudio.conf{.disabled,}
  3. Reboot or kill PulseAudio

P.S. I can see that /etc/pulse/arm_droid_default.pa is a part of the droid-config-h8216-pulseaudio-settings package but couldn't find it in the port infrastructure - happy to send a pull request if you point me to it!

rinigus commented 3 years ago

Nice work!

To add the link, you would need to make PR to https://github.com/sailfishos-sony-tama/droid-config-sony-tama-pie and make it as in https://github.com/mer-hybris/droid-config-sony-ganges-pie/tree/master/sparse/etc/pulse/xpolicy.conf.d

As for .pa adjustments, I don't know why it is not needed for ganges. Can we add it as a separate config file? If we can, then add it to -configs package as well (under sparse)

vaskas commented 3 years ago

Actually ganges includes the pa adjustment in a separate file - https://github.com/mer-hybris/droid-config-sony-ganges-pie/blob/master/sparse/etc/pulse/arm_droid_card_custom.pa, which is in fact included by arm_droid_default.pa. So we can follow the same pattern.

That said, I am starting to suspect that the fix is draining the battery. I've had noticeably worse battery life with collectd / SystemDataScope showing around 70% CPU load, and the pulseaudio process sitting around 2.2%-5% CPU usage according to Crest. I have now switched the udev module off to monitor the consumption and the initial testing confirms the theory.

ApostolosB commented 3 years ago

This is a nice feature (plug DACs). Is the power consumption issue fixable easily or its not worth it since we move to aosp 10 at some point?

lal883 commented 2 years ago

It appears this feature is enabled by default in the AOSP 10 based 64 bit build 4.2.0.21 at least. Without any specific configuration changes mentioned here, a USB DAC seems to work on my device (XZ2c).

Following reports that this feature is somehow hard on the battery, wonder if disabling this would make the Tama devices more power efficient Power Consumption While Idling. I will try disabling this referring to the above instructions and monitor as time permits.

rinigus commented 2 years ago

Is this still the case or we can close it?

lal883 commented 2 years ago

Works by default in the 4.2 build. Also I didn't notice any difference in power consumption while daily driving with this feature disabled.

rinigus commented 2 years ago

Thanks, closing