[pulseaudio-discuss] Pulseaudio, how to change between two connected microphones from command line?
inssrich at gmail.com
inssrich at gmail.com
Sat Nov 4 11:32:23 UTC 2017
Looking to accomplish the following:
* Change default microphone from analog mic to logitech 920C Webcam
Mic (or back the other way) from the command line.
* would like to be able to do this using either/or/both the vendor
ID, product id rather than the ugly long complicated device name. My
scripting skills are rudimentary so this is lost on me.
* If that does not work, reset the USB connection to the camera so
that it is rediscovered.
Background
I have a linux kiosk system that boots fresh every time and is configured
from a config file on a web server. Currently I have two microphones
connected to the kiosk; an analog mic into the microphone port and a
logitech 920C with internal mic. Generally the internal mic comes up as the
default. I can pass in commands from the config file and I would like the
ability to choose which microphone is active after boot using this method.
the system recognizes both microphones but the logitech does not seem to
pass any sound into the system even after manipulating it in pavucontrol.
The only way I've been able to make it work after a fresh boot is to
disconnect it physically and reconnect it, at which point it functions as
expected.
What I've tried
I've tried a number of methods to try and change the default microphone from
analog to the logitech. The below code has worked in changing the default
device but it made no change in the function of the microphone. Is this
possibly because the Logitech shows up with it's own sound card?
$ pacmd "set-default-source device-name-of-logitech"
I can mute and unmute and change volume of the source with the below code
but it has no effect on function
$ pactl set-source-mute 0 1
$ pactl set-source-volume 0 50%
I've also tried to reset the usb device using the below code. When doing so
the logitech will dissapear from pavucontrol and then reappear but still
without any functional results to make the microphone send audio
sudo sh -c "echo 0 > /sys/bus/usb/devices/1-4.6/authorized"
sudo sh -c "echo 1 > /sys/bus/usb/devices/1-4.6/authorized"
It seems like the only thing that works successfully and repeatedly is to
physically disconnect/reconnect the camera from the computer. It's a bit of
a hack but if I could reproduce that action from the command line I may be
able to get it to work, though not very elegantly.
Also, it would be great to be able to send these commands by referencing the
vendorID and productID as I'm not always certain of what index the devices
will have if the physical connections are slightly different from system to
system. As mentioned before my command line scripting skills are pitiful so
any help in doing this would be appreciated.
Any help frankly is appreciated...thanks in advance.
Rich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20171104/100fbb77/attachment.html>
More information about the pulseaudio-discuss
mailing list