Problem with USB DAC playback

on the Xperia10V create symlink (like it is on 10ii by default):
as root: ln -s /etc/pulse/xpolicy.conf.d/usbaudio.conf.disabled /etc/pulse/xpolicy.conf.d/usbaudio.conf

as defaultuser systemctl --user restart pulseaudio.service

Apple dac silent volume fix after plug:

/usr/local/bin/set-usb-dac-volume.sh (make it executable)

#!/bin/sh
# !!! update sink name to yours - it contains unique serial number !!! `pactl list sinks|grep Name`
# someone could improve this to autotdetec script
sleep 2
pactl set-sink-volume alsa_output.usb-Apple__Inc._USB-C_to_3.5mm_Headphone_Jack_Adapter_DWH504202DRL1MQAF-00.analog-stereo 100%

/usr/local/bin/udev-create-flag (make it executable)

#!/bin/sh
# called by udev (runs as root)
# write a flag in the user's runtime dir so the user service notices it
USER="defaultuser"
FLAG="/run/user/$(id -u "$USER")/usb-dac-connected.flag"
mkdir -p "$(dirname "$FLAG")"
touch "$FLAG"

/etc/udev/rules.d/99-usb-dac-volume.rules

ACTION=="add", SUBSYSTEM=="sound", RUN+="/usr/local/bin/udev-create-flag"
ACTION=="change", SUBSYSTEM=="sound", RUN+="/usr/local/bin/udev-create-flag"

/home/defaultuser/.config/systemd/user/usb-dac-volume.path

[Unit]
Description=Watch for USB DAC flag

[Path]
PathExists=/run/user/%U/usb-dac-connected.flag
Unit=usb-dac-volume.service

[Install]
WantedBy=default.target

/home/defaultuser/.config/systemd/user/usb-dac-volume.service

[Unit]
Description=Run USB DAC volume script when flag present
After=default.target

[Service]
Type=oneshot
Environment=XDG_RUNTIME_DIR=%t
ExecStart=/usr/local/bin/set-usb-dac-volume.sh
ExecStartPost=/bin/rm -f /run/user/%U/usb-dac-connected.flag
TimeoutStartSec=60

[Install]
WantedBy=default.target

as root:
udevadm control --reload
now run as the defaultuser:
Reload user units:
systemctl --user daemon-reload
Enable and start the path unit so it watches for the flag:
systemctl --user enable --now usb-dac-volume.path

now it works perfectly, i just plug Apple USB-C to 3.5"Jack (Part number: MW2Q3ZM/A)
music is instantly routed to headphones and in two seconds the volume is without limit and then could be adjusted in UI/buttons 0% <=> true 100% like it is expected.

Interesting. You do not need

pactl load-module module-udev-detect

?

no it looks like it is loaded by default

pactl list modules |grep udev
	Name: module-udev-detect
	Argument: device_id="1" name="usb-Apple__Inc._USB-C_to_3.5mm_Headphone_Jack_Adapter_DWH504202DRL1MQAF-00" card_name="alsa_card.usb-Apple__Inc._USB-C_to_3.5mm_Headphone_Jack_Adapter_DWH504202DRL1MQAF-00" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1"

from /etc/pulse/default.pa

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif

yeah, I know it’s there. It just doesn’t work on the volla phones. But, I’ve adapted your approach to use pactl so that it works to pactl load instead of volume since the adapter I’m using does not require setting the volume. Thanks :slight_smile:

EDIT: on the xperia 10iii I also have to force

pactl load-module module-udev-detect

Ooof. Sadly, I can no longer use the telephone, freezes. :frowning: Need to roll back and start again.

EDIT: @koza technique worked on the volla22 / rephone, BUT caused the phone app to freeze. Manually loading the module is fine. When a call comes in the usb-audio stop (and media player, for instance) and calls work normaly. On the experia 10iii The same technique doesn’t work for me, but manually starting (using the same script systemd is supposed to run) works. Hmmmm.

for the Apple dac the volume fix works perfectly, no issues with anything.
i think that module-udev-detect should be loaded before you plug dac to usb port otherwise perhaps loading after plug may confuse/hang pulseaudio and then phone app or maybe even media player will freeze too

i dont have 10iii but 10ii loading module-udev-detect automaticlaly without tweaking system, there is /etc/pulse/xpolicy.conf.d/usbaudio.conf

all on SFOS 5.0.0.72

1 Like

Oh by the way if you guys want better sound quality for music, because Jolla is all about legacy and still uses garbage tier resampler because jolla phone 1 couldn’t handle better one (we got much better cpus since then) then i recommend my blog post Audiophile ways on SailfishOS

2 Likes

At user defaultuser the command returns an error.

Running pactl list shows the module loaded already (on my fp4 with SailfishOS)

defaultuser@fp4-1:~ $ pactl list
…
Module #2Name: module-udev-detect
Argument:
Usage counter: n/a
Properties:
module.author = “Lennart Poettering”
module.description = “Detect available audio hardware and load matching drivers”
module.version = “14.2+git9”
…

But i don’t get the Fairphone USB DAC working …:thinking: