[pulseaudio-discuss] Using "expect" to feed pacmd
Whit Blauvelt
whit.pulse at transpect.com
Fri Sep 10 05:01:34 PDT 2010
On Fri, Sep 10, 2010 at 10:07:25AM +0100, Colin Guthrie wrote:
> The default.pa is processed on PA startup, so if you were to put such
> commands at the end of the default.pa (or better create your own
> default.pa in ~/.pulse/default.pa with the following contents:
>
> .include /etc/pulse/default.pa
> .nofail
> set-default-source
> alsa_input.usb-Generic_FREETALK_Everyman_0000000001-00-Everyman.analog-stereo
> .fail
>
> You'll notice the use of .nofail and .fail there. This starts a generic
> block where any errors are ignored. This will mean that if you do not
> have the USB plugged in when pulse starts, it will not care that it did
> not manage to set the default.
Here's the problem with that attempt at a solution: As I wrote before,
having a ~/.pulse/default.pa with the one line causes pulseaudio to refuse
to start _even with the usb headset plugged in_, so if I add the .nofail
conditional to it, it still will be the case that setting the default source
at this point will fail - it will just be ignored rather than blocking the
whole startup (which is unnecessarily fragile - a failure should be logged
and sent to console, but not kill the startup). If we're to trust the error
message pulseaudio throws without the .nofail conditional, it's trying to
run default.pa commands before the system has loaded a necessary module. So
there's no way it could set the default even if it wanted to. If I compiled
a monolithic kernel it would fix that; but most everyone runs distro kernels
with modules these days. Perhaps Canonical/Ubuntu needs to improve the
init.d/pulseaudio script to insure the modules are all loaded before
pulseaudio is invoked. Haven't studied how they've handled that. Shouldn't
need to. This isn't supposed to be for users to correct.
Even if default.pa could set the default then, the default goes away as soon
as the usb device is unplugged. But it can't even set it to begin with.
Probably I could actually get the default initially set through System >
Preferences > Startup Applications and then including my expect script
there, or the like.
> You mentioned earlier that it's "fragile", but this is entirely expected
> behaviour, so I'm not sure that that description is really appropriate.
Col, you're responsiveness on this list is a great asset to the project.
Good luck getting the main players to agree to your plans to make the
central design better. It's to further your efforts that I'm giving you this
critique. I know it's mostly not your own work that's so full of design
flaws.
Best,
Whit
More information about the pulseaudio-discuss
mailing list