linux pactl card list in headless devices for puls

2019-09-21 06:16发布

问题:

in a headless device where only root user is available, pulse audio server starts automatically in startup using pulseaudio -D --disallow-exit. It runs fine so far. When the system starts the bluetooth headspeaker connects automatically. upon giving hcitool con I see the device

hcitool con connections:

ACL 00:0B:D5:F5:xx:xx:xx handle 11 state 1 im Master auth encrypt

upon giving pactl list cards I get empty output

Note that i start dbus with following command before i run pulseaudio eval "export $(dbus-launch)"

回答1:

i could solve it as follows:

1- add a new user to the system and to group audio adduser pi usermod -a -G audio pi

2- before running pulseaudio i ran eval "export $(dbus-launch --sh-syntax)"

3- DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS}

4- su -c 'pulseaudio --start' - pi

sudo reboot -> if it does not connect automatically, do pactl list follwed by bluetoothctl and connect to the speaker.

hcitool con -> connection xx:xx:xx:xx:xx:xx

pactl list cards short i get the output