[pulseaudio-discuss] Using "expect" to feed pacmd

Colin Guthrie gmane at colin.guthr.ie
Fri Sep 10 05:44:31 PDT 2010


'Twas brillig, and Whit Blauvelt at 10/09/10 12:26 did gyre and gimble:
> On Fri, Sep 10, 2010 at 10:07:25AM +0100, Colin Guthrie wrote:
> 
>> Contrary to the comment that pacmd takes no command line options, you
>> can just give it commands, so there is no need for this complicated
>> expect script:
>>
>> pacmd set-default-source alsa_input.usb-Generic_FREETALK_Everyman_0000000001-00-Everyman.analog-stereo
>>
>> Should work fine.
> 
> You're right. It produces this visual noise, which doesn't look promising:
> 
>   Welcome to PulseAudio! Use "help" for usage information.
>   >>> >>> 
> 
> But it does turn out to have done the job. The man page for pacmd does say:
> 
>   This program takes no command line options.
> 
> Evidently we're not supposed to RTFM on this one.

Yeah I suspect the capabilities were added after the man page was
written and no one has noticed until you've pointed it out.
Documentation patches are as welcome as any other :)

> Here's an example of fragility: the pacmd "exit" command doesn't follow the
> standard *nix convention of "exit" exiting a shell. Instead it means what in
> a *nix context shoudl be called "kill." So you use it. You discover you've
> killed the daemon. Well, guess what. The daemon won't start again easily.
> Trying /etc/init.d/pulseaudio start or just pulseaudio& - neither gets it
> started. Neither gives a decent error message as to why it fails, either to
> console or logs. You end up rebooting the system. Okay that works. 

The /etc/inid.d script should ONLY be used for system wide PA. We do not
even provide such a script in our upstream tarballs and generally
discourage using PA in system wide mode. In the default, per-user setup
that we ship, PA auto-spawns, so exiting the daemon is generally not
overly problematic (clients which support reconnect will do so
automatically).

I take your point re the "exit" command tho'. I am tempted to agree with
you. I just never, ever type exit on any terminal out of habit (ctrl+D
is much quicker) and thus I've never really noticed this.

Patches most likely welcome for this change too.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]




More information about the pulseaudio-discuss mailing list