humblegnome

joined 1 year ago
[–] humblegnome@lemmy.world 2 points 1 year ago (1 children)

Cheers for this guide!

i have been having difficulty trying to understand the naming conventions for the sofa files as posted in the ari databases, such that i could somehow choose one that i think would best suit. The documentation doesn’t really help, and i haven’t found a write up on it that addresses this in a mere human readable way, i am anything but a coder and don’t use matlab for anything. Any suggestions?

The following should work to automate turning on 7.1 when headphones plugged in. I would def suggest using at least two terminal instances to help with the copy/pasta goodness.

Use systemd to automate:

sudo nano /etc/systemd/system/pipewire-headphones.service

in said file use the following:

######################################

[Unit] Description=Run Pipewire with filter-chain when headphones are plugged in Wants=sys-devices-pci0000:40-0000:40:01.1-0000:41:00.0-0000:42:08.0-0000:45:00.3-usb9-9\x2d2-9\x2d2:1.0-sound-card1-controlC1.device BindsTo=sys-devices-pci0000:40-0000:40:01.1-0000:41:00.0-0000:42:08.0-0000:45:00.3-usb9-9\x2d2-9\x2d2:1.0-sound-card1-controlC1.device

[Service] ExecStart=/bin/pipewire -c /home/USER/.config/pipewire/filter-chain.conf.d/filter-chain.conf User=your_username Group=your_groupname [Install] WantedBy=default.target

######################################

Replace /path/to/pipewire with the actual path to the pipewire binary and /path/to/filter-chain.conf with the path to your filter-chain.conf configuration file. Also, replace your_username and your_groupname with your actual username and group name.

To obtain Wants, and BindsTo= path

Plug in desired device

ls /dev/input/by-id/

copy name of your device

eg: usb-Logitech_PRO_X_000000000000-event-if03

then:

sudo udevadm info --attribute-walk --path=$(udevadm info --query=path --name=/dev/input/by-id/usb-Logitech_PRO_X_000000000000-event-if03)

locate “looking at parent device” that matches to your device, add to service file.

save file.

the udevadm command will also allow you to obtain info needed for the udev rule.

Now Create udev rule.

sudo nano /etc/udev/rules.d/99-headphones.rules

enter text:

################################################

ACTION=="add", SUBSYSTEM=="input", ENV{ID_INPUT}=="1", ENV{ID_VENDOR_ID}=="046d", ENV{ID_PRODUCT}=="0aaa", ENV{PHYS}=="usb-0000:45:00.3-2/input3", ENV{SYSTEMD_WANTS}="pipewire-headphones.service"

################################################

ID_VENDOR_ID =ATTRS{id/vendor}=="046d" etc

save file.

sudo udevadm control --reload sudo systemctl daemon-reload

for manual start/stop:

sudo systemctl start pipewire-headphones.service sudo systemctl stop pipewire-headphones.service

To have service started and enabled at boot:

sudo systemctl enable - -now pipewire-headphones.service

why sudo systemctl daemon-reload

Have tested with logi headphones using the usb dac, and then the standard jack seems to work ok, in ubuntu appears as virtual-surround-sink,though I did have to choose this as my device manually. this should also stop the service if the device is unplugged.

To automate that you could edit the service Execstart entry :

ExecStart=/bin/sh -c 'pipewire -c /path/to/filter-chain.conf && pactl set-default-sink your_virtual_surround_sink_name'

Hope this is useful :)