Quantcast
Channel: Active questions tagged 22.04 - Ask Ubuntu
Viewing all articles
Browse latest Browse all 4530

Switching microphone input device fails in udev script

$
0
0

I have a Sony WH-1000XM3 blue tooth headset. Every time I turn it on the microphone is set to "Internal". This is my laptop microphone which is awful. Now I manually go and change the the input device to "Headset WH-1000XM3", and everything works, but this manual process is tedious.

Audio settings:

Audio settings picture

Now I have a command which does the switching correctly:

pactl set-card-profile bluez_card.94_DB_56_19_07_F9 handsfree_head_unit

I have plugged this command into a script triggered by udev when the headset connects:

#!/bin/bashsleep 10 # wait for the headset to fully connect                                 pactl set-card-profile bluez_card.94_DB_56_19_07_F9 handsfree_head_unit &>> /tmp/pactl-log

but I get the following error:

$ cat /tmp/pactl-logConnection failure: Connection refusedpa_context_connect() failed: Connection refused

I tried switching the user in the script with sudo -u myuserid pactl... but I get the same error.


Viewing all articles
Browse latest Browse all 4530

Trending Articles