For information about USB audio support in specific Solaris releases, see Solaris Support for USB Devices.
This Solaris release provides USB audio support that is implemented by a pair of cooperating drivers, usb_ac and usb_as. The audio control driver, usb_ac, is a Solaris USB Architecture compliant client driver that provides the controlling interface to user applications. The 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. Both drivers comply with the USB audio class 1.0 specification.
Some audio devices can set volume under software control. A STREAMS module, usb_ah, is pushed on top of the HID driver for managing this function.
Solaris supports USB audio devices that are play-only, record-only, or record and play. Hot-plugging of USB audio devices is supported.
USB audio devices are supported on SPARC UltraTM and x86 platforms that have USB connectors.
USB audio devices that are supported in the Solaris 8 10/01, Solaris 8 2/02, or Solaris 9 releases must support a fixed 44100 or 48000 Hz sampling frequency to play or record. The 44100 Hz or 48000 Hz sampling frequency is no longer required in the Solaris 10 release.
For fully supported audio data format information, see usb_ac(7D).
The primary audio device is /dev/audio. You can verify that /dev/audio is pointing to USB audio by using the following command:
% mixerctl Device /dev/audioctl: Name = USB Audio Version = 1.0 Config = external Audio mixer for /dev/audioctl is enabled |
After you connect your USB audio devices, you access them 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 Sun 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.
When you plug in a USB audio device, it automatically becomes the primary audio device, /dev/audio, unless /dev/audio is in use. For instructions on changing /dev/audio from on-board audio to USB audio and vice versa, refer to How to Change the Primary USB Audio Device, and usb_ac(7D).
If a USB audio device is plugged into a system, it becomes the primary audio device, /dev/audio. 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 additional information on troubleshooting USB audio device problems, see usb_ac(7D).
The primary audio device, /dev/audio, points to the USB speaker.
% ls -l /dev/audio lrwxrwxrwx 1 root root 10 Feb 13 08:46 /dev/audio -> usb/audio0 |
(Optional) Remove the speaker. Then, plug it back in.
If you remove the speaker, the /dev/audio device reverts back to on-board audio.
% ls -l /dev/audio lrwxrwxrwx 1 root root 7 Feb 13 08:47 /dev/audio -> sound/0 |
Add a USB microphone.
% ls -l /dev/audio lrwxrwxrwx 1 root root 10 Feb 13 08:54 /dev/audio -> usb/audio1 |
This procedure assumes that you have already connected the USB audio devices.
Examine your system's new audio links.
Display your system's new audio links with the ls command.
For example:
% 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 % |
Notice that the primary audio device, /dev/audio, is pointing to the newly plugged in USB audio device, /dev/usb/audio0.
You can also examine your system's USB audio devices with the prtconf command and look for the 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 . . . |
Select one of the following to change the primary USB audio device.
If you want the on-board audio device to become the primary audio device, remove the USB audio devices. The /dev/audio link then points to the /dev/sound/0 entry. If the /dev/sound/0 entry is not the primary audio device, then either shut down the system and use the boot -r command, or run the devfsadm -i command as root.
If you want the USB audio device to become primary audio device, just plug it in and check the device links.
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.
The workaround is to power cycle the USB speakers.
Keep the following key points of audio device ownership in mind when working with audio devices:
When you plug in a USB audio device and you are logged in on the console, the console is the owner of the /dev/* entries. This situation means you can use the audio device as long as you are logged in to the console.
If you are not logged in to the console when you plug in a USB audio device, root becomes the owner of the device. However, if you log in to the console and attempt to access the USB audio device, device ownership changes to the console. For more information, see logindevperm(4).
When you remotely log in with the rlogin command and attempt to access the USB audio device, the ownership does not change. This means that, for example, unauthorized users cannot listen to conversations over a microphone owned by someone else.