RSS: Blog | Wiki | Forum

USB audio headset

From Easyneufenglish

Jump to: navigation, search

Contents

[edit] USB audio headset

Test have been made with the following USB headset: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter

[edit] Alsa configuration

The headset can't work on a USB hub (you have to activate the following option in the kernel : Cannot submit datapipe for urb 0, error -38 : enable CONFIG_USB_EHCI_SPLIT_ISO to play through a hub). The headset is not a real soundcard, so it can't play all files at all frequencies. The headset will support this mode: frequency: 44100Hz, 2 channels

Here is the configuration {{{~/asoundrc}}} used so that alsa configures it automatically:

ctl.myplugdev {
    type hw
    card 1
}

pcm.myplugdev {
    type plug
    slave { 
        pcm hw:1 
        rate 44100
        channels 2
    }
}

Remarks:

  • The card number has been hardcoded in the 1 file. The index varies according to the order of audio devices detection. (See `{{{cat /proc/asound/cards}}}')
  • The new virtual card has been associated (myplugdev). The name can be changed.
  • The headset also support 48Khz, there should be a change to avoid having to convert all sounds to this frequency.
  • Don't forget to do unmute on the headset configuration

[edit] Audio flow redirection to the headset

You just have to add these lines to the previous configuration

pcm.!default pcm.myplugdev
ctl.!default ctl.myplugdev

/!\ Note /!\

The redirection only works for the news programs launched after devices turnout. So restart the application is necessary.


From the Alsa documentation:

Specifying the !default name supercedes the one defined in the ALSA lib api.

[edit] Keys configuration

The headset is also detected as a USB-HID device (Human Interface Device). It then send these keys:

#define KEY_MUTE                113
#define KEY_VOLUMEDOWN          114
#define KEY_VOLUMEUP            115

These keys are normalized and can be found in the /usr/include/linux/input.h file

[edit] External links