Go to main content

Managing Devices in Oracle® Solaris 11.3

Exit Print View

Updated: April 2018
 
 

Using USB Audio Devices

For audio devices in Oracle Solaris, only USB 2.0, 1.1, and 1.0 are supported, not USB 3.0. Additionally, the support is for those devices that are play-only, record-only, or record and play.

Oracle Solaris USB audio support is implemented by a pair of drivers:

  • Audio control driver (usb_ac) - provides the controlling interface to user applications. For more information, see the usb_ac(7D) man page.

  • Audio streaming driver (usb_as) - processes audio data messages during play and record. It sets sample frequency and precision, and encodes requests from the usb_ac driver. For more information, see the usb_as(7D) man page.

Some audio devices can set volume under software control. A STREAMS module, usb_ah, is pushed on top of the human interface device (HID) driver for managing this function. For more information, see the usb_ah(7M) man page.

The primary audio device is /dev/audio. To verify that /dev/audio is pointing to USB audio, use the mixerctl command. For example:

%$ mixerctl
Device /dev/audioctl:
Name    = USB Audio
Version = 1.0
Config  = external

Audio mixer for /dev/audioctl is enabled

You access connected USB audio devices with the audioplay and audiorecord command through the /dev/sound/N device links.

Note that the /dev/audio and /dev/sound/N devices can refer to speakers, microphones, or combination devices. If you refer to the incorrect device type, the command fails. For example, the audioplay command fails if you try to use it with a microphone.

You can select a specific default audio device for most Oracle Solaris audio applications, such as audioplay and audiorecord, by setting the AUDIODEV shell variable or by specifying the –d option for these commands. However, setting AUDIODEV does not work for third-party applications that have /dev/audio hardcoded as the audio file.

A USB plugged-in audio device automatically becomes the primary audio device, /dev/audio, provided that /dev/audio is not in use. It remains the primary audio device even after the system is rebooted. If additional USB audio devices are plugged in, the last one becomes the primary audio device.

For instructions on switching /dev/audio between on-board audio and USB, refer to Problem With Reverting to On-Board Audio Device, and usb_ac(7D).

Displaying Information About USB Audio Devices

To list the primary audio device on the system, use the ls -l command on the /dev/audio device link. As you plug in additional USB devices, the command output identifies the device to which /dev/audio connects. This device automatically becomes the primary audio device.

For example, by default, the system's audio is the on-board audio.

$ ls -l /dev/audio
lrwxrwxrwx 1 root root 7 Feb 13 08:47 /dev/audio -> sound/0

Suppose you connect a USB speaker to the system. The command output would then be as follows:

$ ls-l /dev/audio
lrwxrwxrwx 1 root root 10 Feb 13 08:46 /dev/audio -> usb/audio0

If you add another audio device, such as a USB microphone, the command output would also change.

$ ls -l /dev/audio
lrwxrwxrwx 1 root root 10 Feb 13 08:54 /dev/audio -> usb/audio1

To list all the USB audio devices that are connected to the system, use the same ls command on all the audio device links.

$ ls -lt /dev/audio*
lrwxrwxrwx   1 root  root      7 Jul 23 15:46 /dev/audio -> usb/audio0
lrwxrwxrwx   1 root  root     10 Jul 23 15:46 /dev/audioctl ->
usb/audioctl0/

% ls -lt /dev/sound/*
lrwxrwxrwx   1 root  root     74 Jul 23 15:46 /dev/sound/1 ->
../../devices/pci@1f,4000/usb@5/hub@1/device@3/sound-control@0:...
lrwxrwxrwx   1 root  root     77 Jul 23 15:46 /dev/sound/1ctl ->
../../devices/pci@1f,4000/usb@5/hub@1/device@3/sound-control@0:...
lrwxrwxrwx   1 root  other    66 Jul 23 14:21 /dev/sound/0 ->
../../devices/pci@1f,4000/ebus@1/SUNW,CS4231@14,200000:sound,audio
lrwxrwxrwx   1 root  other    69 Jul 23 14:21 /dev/sound/0ctl ->
../../devices/pci@1f,4000/ebus@1/SUNW,CS4231@14,200000:sound,audioctl

Note that despite the multiple audio devices, the /dev/usb/audio0 is the primary audio device.

You can also use the prtconf command to display USB device information.

$ prtconf
.
usb, instance #0
hub, instance #0
mouse, instance #0
keyboard, instance #1
device, instance #0
sound-control, instance #0
sound, instance #0
input, instance #0
.

To change the primary audio device to a USB audio device, plug the USB device to the system. The /dev/audio link automatically points to this device. To revert to using the on-board audio device, simply remove the USB device.

Troubleshooting USB Audio Device Problems

Sometimes, USB speakers do not produce any sound, even though the driver is attached and the volume is set to high. Hot-plugging the device might not change this behavior.

To restore sound, power cycle the USB speakers.

About Audio Device Ownership

When you plug in a USB audio device while logged in to the console, the console is the owner of the /dev/* entries. Therefore, you can use the audio device provided you remain logged in. If you were not logged in, then root is the owner of the device. However, if you log in to the console and attempt to access the USB audio device, then device ownership changes to the console. For more information, see the logindevperm(4) man page.

The behavior is different with remote logins. If you attempt to access the device remotely, the ownership does not change and therefore the device is secure. For example, unauthorized users cannot remotely listen to conversations over a microphone that is owned by someone else.

Problem With Reverting to On-Board Audio Device

You might observe that after removing the USB device, the /dev/audio does not point back to /dev/sound/0. This error indicates that the system did not revert to using the on-board audio device as the primary audio device. Do one of the following workarounds:

  • Shut down the system, and use the boot -r command.

  • As root, issue the devfsadm –i command.