LinuxPowerUser.com

Tag: audio

Dealing with multiple USB sound devices

by on Jun.15, 2010, under General, Hardware/Disk Management, Multimedia

Ever been plagued by your linux system detecting your webcam as the first sound device instead of your USB headset?  This is a common problem with Linux, but can be easily remedied with editing your systems module configuration.  On Ubuntu, the important file is /etc/modprobe.d/alsa-base.conf.  This file controls the module settings and parameters for the alsa sound system.  First, we need to understand what to put in this file.

With both of your USB devices connected to the system, run the following command:

lsusb

Here is a sample output:

Bus 001 Device 008: ID 046d:09a2 Logitech, Inc. QuickCam Communicate Deluxe/S7500
Bus 001 Device 005: ID 03f0:2f24 Hewlett-Packard
Bus 001 Device 007: ID 058f:6362 Alcor Micro Corp. Hi-Speed 21-in-1 Flash Card Reader/Writer (Internal/External)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 002 Device 004: ID 10f5:0200 Turtle Beach Audio Advantage Roadie
Bus 002 Device 003: ID f617:0905
Bus 002 Device 002: ID 046d:c521 Logitech, Inc. MX620 Laser Cordless Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

This output shows all the USB devices connected to your system.  In our example, the two devices we are looking for are:

Bus 001 Device 008: ID 046d:09a2 Logitech, Inc. QuickCam Communicate Deluxe/S7500

Bus 002 Device 004: ID 10f5:0200 Turtle Beach Audio Advantage Roadie

Frequently, on this system, the webcam steals the default input device because of its internal mic.  I would like the default input/output to be assigned to the turtle beach roadie USB headset.  The key here is something that all alsa modules have support for which is an index parameter.  All also modules allow indexes to be assigned to a particular device.  This works pretty well when your cards use different alsa modules.  Simply specifiying module options setting the index # for your particular devices module resolves the issue.  So what happens with USB audio devices, since they use the same snd-usb-audio module?  It seems that linux simply assigns indexes in the order the devices are discovered.

The lsusb output above shows two important pieces of information for each of the sound devices in question.  The USB VID (Vendor ID) and PID (Product ID) can be used to control index assignment.  In our case these values are:

046d:09a2 for the Logitech, and 10f5:0200 for the Turtle Beach headset.  The set of hexadecimal numbers is the Vendor ID and Product ID for the device, in the format VID:PID.

The VID:PID combination can be used in conjuction with the Index value to control the way linux sees the devices.  The format for the module option is:

options snd-usb-audio index=<x>,<y> vid=0x<vid for index x>,0x<vid for index y> pid=0x<pid for index x>,0x<pid for index y>

So, with this in mind, all we have to add to the /etc/modprobe.d/alsa-default.conf file is this:

options snd-usb-audio index=0,1 vid=0x10f5,0x046d pid=0x0200,0x09a2

After rebooting the system, we should never see our Webcam grab the default input again (making us have to go to the Pulse Audio settings and reconfigure the sound system).

Leave a Comment :, , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...