Udev and Pulse
To use a USB DAC (digital-analog audio converter) in Sailfish OS it is necessary to set up udev to respond to the device being plugged in and turn off the internal sound card.
Some devices like the Fairphone 4/5 (possibly the xperia 10iii) may already be working without issue.
On an xperia 10iii in january 2026, you need to become root:
devel-su
On an xperia 10iii or a volla22 (gs5)
the file /etc/pulse/arm_droid_card_custom.pa needs to contain
load-module module-droid-card rate=48000 hw_volume=false unload_call_exit=true output_voip_rx=false record_voice_16k=true
load-module module-udev-detect
the file
/etc/pulse/xpolicy.conf.d/usbaudio.conf should be symlinked as follows:
devel-su
cd /etc/pulse/xpolicy.conf.d/
ln -s usbaudio.conf.disabled usbaudio.conf
OtherwisIf your device does not have a udev rule at:
/lib/udev/rules.d/99-pulseaudio-ignore-builtin-card.rules
create a udev rule to deal with the usb dac and activate the pulse usbaudio config.
Find the device id for the internal audio card:
cat /sys/class/sound/card0/id
mt6768mt6358 # volla22
Then create a udev rule
echo 'KERNEL=="card0", SUBSYSTEM=="sound", ATTR{id}=="mt6768mt6358", ENV{PULSE_IGNORE}="1"' > /etc/udev/rules.d/89-pulseaudio-usb.rules
And finally
cd /etc/pulse/xpolicy.conf.d
ln -s usbaudio.conf.disabled usbaudio.confRules for other cases (ie. xperia 10ii).
as root:
devel-su
modify the udev rules file
vi /etc/udev/rules.d/89-pulseaudio-usb.rules
with the following
ACTION=="add", SUBSYSTEM=="sound", RUN+="/usr/local/bin/udev-create-flag"
ACTION=="change", SUBSYSTEM=="sound", RUN+="/usr/local/bin/udev-create-flag"
Create a flag file
vi /usr/local/bin/udev-create-flag
with contents
#!/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"
make it executable and create the script to trigger the dac (or set volume, for instance)
chmod 755 /usr/local/bin/udev-create-flag
vi /usr/local/bin/set-usb-dac-volume.sh
with content this version is NOT setting volume, just making sure the dac is seen
#!/bin/sh
sleep 2
/usr/bin/pactl load-module module-udev-detect
or for also setting volume (apple dongle for instance) add
# !!! update sink name to yours - it contains unique serial number !!! `pacmd list-sinks|grep alsa_output.usb`
# someone could improve this to autotdetec script
sleep 2
/usr/bin/pactl load-module module-udev-detect
pactl set-sink-volume alsa_output.usb-Apple__Inc._USB-C_to_3.5mm_Headphone_Jack_Adapter_DWH504202DRL1MQAF-00.analog-stereo 100%
make it executable
chmod 755 /usr/local/bin/set-usb-dac-volume.sh
Now create the systemd triggers (these are prompted by the udev create flag script)
you may need to make the directories first:
mkdir /home/defaultuser/.config/systemd/user
vi /home/defaultuser/.config/systemd/user/usb-dac-volume.path
with contents
[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
vi /home/defaultuser/.config/systemd/user/usb-dac-volume.service
with contents
[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
and enable
systemctl --user daemon-reload
systemctl --user enable --now usb-dac-volume.path
You should now have automatic switching between internal and usb dacs.
Article discussion: USB DAC playback on Sailfish OS Forum