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 USBA (Solaris USB Architecture) compliant client driver that provides the controlling interface to user applications. The audio streaming driver, usb_as, is provided to process audio data messages during play and record. It sets sample frequency and precision, and encodes requests from the usb_ac driver. Both drivers comply to 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 Ultra 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 or 10 release must support a fixed 44100 or 48000 Hz sampling frequency to play or record.
USB audio devices that are supported in the Solaris 10 release must support a 48000 Hz sample rate to play or record.
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 combo devices. If you refer to the incorrect device type, the command will fail. For example, the audioplay command will fail 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 onboard 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).
Use the following procedure to add USB audio devices.
Plug in the USB speakers and microphone.
The primary audio device, /dev/audio, usually points to the onboard audio. After you connect USB audio devices, /dev/audio points to the USB audio devices that are identified in the /dev/sound directory.
Verify that the audio device files have been created.
% ls /dev/sound 0 0ctl 1 1ctl 2 2ctl |
Test the left and right USB speakers.
% cd /usr/share/audio/samples/au % audioplay -d /dev/sound/1 -b 100 spacemusic.au % audioplay -d /dev/sound/1 -b -100 spacemusic.au |
Test the USB microphone.
% cd $HOME/au % audiorecord -d /dev/sound/2 -p mic -t 30 test.au |
This procedure assumes that you have already connected USB audio devices.
Identify the state of your current audio device links.
For example:
% ls -lt /dev/audio* lrwxrwxrwx 1 root root 7 Jul 23 15:41 /dev/audio -> sound/0 lrwxrwxrwx 1 root root 10 Jul 23 15:41 /dev/audioctl -> sound/0ctl % ls -lt /dev/sound/* 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 % |
The primary audio device, /dev/audio, is currently pointing to the onboard audio, which is /dev/sound/0.
(Optional) Add a new USB audio device.
Examine your system's new audio links.
For example:
% ls -lt /dev/audio* lrwxrwxrwx 1 root root 7 Jul 23 15:46 /dev/audio -> sound/1 lrwxrwxrwx 1 root root 10 Jul 23 15:46 /dev/audioctl -> sound/1ctl % 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:sound,... 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:sound,... 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/sound/1.
If you remove the USB audio device now, the primary audio device, /dev/audio, does not revert back to the onboard audio. See the following procedure for instructions on changing the primary audio device back to the system's onboard audio.
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 . . . |
Follow these steps if you remove or change your USB audio devices and you want to make one particular audio device the primary audio device. The procedure changes the primary audio device to the onboard audio device as an example.
Become superuser.
Close all audio applications.
Verify that the audio and USB drivers are loaded.
# modinfo | grep -i audio 124 780e6a69 bb6e - 1 audiosup (Audio Device Support 1.12) # modinfo | grep -i usb 48 13dba67 18636 199 1 ohci (USB OpenHCI Driver 1.31) 49 78020000 1dece - 1 usba (USBA: USB Architecture 1.37) 50 12e5f1f 35f 195 1 hubd (USB Hub Driver 1.4) 51 13ef53d 5e26 194 1 hid (USB HID Client Driver 1.16) 54 13f67f2 1b42 10 1 usbms (USB mouse streams 1.6) 56 127bbf0 2c74 11 1 usbkbm (USB keyboard streams 1.17) # |
Load and attach the onboard audio driver.
# devfsadm -i audiocs |
The onboard audio driver is audiocs on a Sunblade 1000, and audiots on a Sunblade 100.
Verify that the primary audio device link is pointing to the onboard audio.
# ls -lt /dev/audio* lrwxrwxrwx 1 root other 7 Jul 23 15:49 /dev/audio -> sound/0 lrwxrwxrwx 1 root other 10 Jul 23 15:49 /dev/audioctl -> sound/0ctl # ls -lt /dev/sound/* 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 # |
Confirm the onboard audio is the primary audio device.
% audioplay /usr/demo/SOUND/sounds/bark.au |
The audioplay command defaults to the onboard audio device.
(Optional) Unload all the audio drivers that can be unloaded before plugging in another USB audio device.
Close all the audio applications.
Display the audio driver information to verify that no audio drivers are currently loaded.
# modinfo | grep -i audio 60 78048000 bb6e - 1 audiosup (Audio Device Support 1.12) 61 78152000 39a97 - 1 mixer (Audio Mixer 1.49) 62 78118000 bf9f - 1 amsrc1 (Audio Sample Rate Conv. #1 1.3) 128 7805e000 14968 54 1 audiocs (CS4231 mixer audio driver 1.21) # |
Unload the audio drivers.
# modunload -i 0 # modinfo | grep -i audio 60 78048000 bb6e - 1 audiosup (Audio Device Support 1.12) 61 78152000 39a97 - 1 mixer (Audio Mixer 1.49) # |
At this point, audiocs, the onboard audio driver, has been unloaded and guaranteed not to be open. However, the primary audio device, /dev/audio, does not change if it is held open by an application.
(Optional) Plug in a USB audio device.
(Optional) Examine the new audio links.
% ls -lt /dev/audio* lrwxrwxrwx 1 root root 7 Jul 23 16:12 /dev/audio -> sound/1 lrwxrwxrwx 1 root root 10 Jul 23 16:12 /dev/audioctl -> sound/1ctl % ls -lt /dev/sound/* lrwxrwxrwx 1 root root 77 Jul 23 16:12 /dev/sound/1ctl -> ../../devices/pci@1f,4000/usb@5/hub@1/device@3/sound-control@0:sound,... lrwxrwxrwx 1 root root 74 Jul 23 16:12 /dev/sound/1 -> ../../devices/pci@1f,4000/usb@5/hub@1/device@3/sound-control@0:sound,... lrwxrwxrwx 1 root root 66 Jul 23 15:59 /dev/sound/0 -> ../../devices/pci@1f,4000/ebus@1/SUNW,CS4231@14,200000:sound,audio lrwxrwxrwx 1 root root 69 Jul 23 15:59 /dev/sound/0ctl -> ../../devices/pci@1f,4000/ebus@1/SUNW,CS4231@14,200000:sound,aud... % |