USB Administration Guide

Chapter 2 USB Devices (Tasks)

This chapter provides step-by-step instructions for managing USB devices in the Solaris environment.

This is a list of the step-by-step instructions in this chapter.

Managing USB Devices

Removable mass storage devices such as USB Zip, Jaz, Clik!, SmartMedia, CompactFlash, and ORB are supported, starting with the Solaris 8 10/00 release. See scsa2usb(7D) for a complete list of devices that are supported in the Solaris environment.

These devices can be managed with or without volume management. See vold(1M) for information on managing devices with volume management.

The following sections describes the tasks for managing USB devices in the Solaris environment.

Managing USB Mass Storage Devices With vold Running

If you are running Solaris Common Desktop Environment (CDE), the USB removable mass storage devices are managed by the Removable Media Manager component of the CDE File Manager. See dtfile(1) for more information on the CDE File Manager.


Note –

You must include the /usr/dt/man in your MANPATH variable to display the man pages listed in this section. You must also have /usr/dt/bin in your path and have CDE running to use these commands, or have a DISPLAY variable set to use these commands remotely.


The following table identifies the commands Removable Media Manager uses to manage storage devices from the CDE environment.

Command  

Task 

sdtmedia_format(1)

Format and label USB devices 

sdtmedia_prop(1)

Display properties of the device  

sdtmedia_prot(1)

Change device protection 

sdtmedia_slice(1)

Create or modify slices on the device  

After the USB device is formatted, it is usually mounted under the /rmdisk/label directory. See rmmount.conf(4) for details on how to configure removable storage devices.

The following procedures describe how to manage USB mass storage devices with volume management. The device nodes are created under the /vol/dev directory. See scsa2usb(7D) for more information. The following procedures also describe how to add or remove hot-pluggable USB mass storage devices. Hot-plugging a device means the device is added or removed without shutting down the operating system or powering off the system.

How to Mount or Unmount a USB Mass Storage Device With vold Running

  1. Display device aliases for all removable mass storage devices, including USB mass storage devices.


    $ eject -n
    .
    .
    .
    rmdisk0 -> /vol/dev/rdsk/c4t0d0/clik40    (Generic USB storage)
    cdrom0 -> /vol/dev/rdsk/c0t6d0/audio_cd   (Generic CD device)
    zip1 -> /vol/dev/rdsk/c2t0d0/fat32        (USB Zip device)
    zip0 -> /vol/dev/rdsk/c1t0d0/zip100       (USB Zip device)
    jaz0 -> /vol/dev/rdsk/c3t0d0/jaz1gb       (USB Jaz device)
  2. Mount a USB mass storage device by using the device aliases listed previously.


    $ volrmmount -i device-alias
    

    This example mounts a USB Jaz drive under /rmdisk/jaz0.


    $ volrmmount -i jaz0 
    

  3. Unmount a USB mass storage device.


    $ volrmmount -e device-alias
    

    This example unmounts a USB Zip drive from /rmdisk/zip0.


    $ volrmmount -e zip0
    
  4. Eject a USB device from a generic USB drive.


    $ eject device-alias
    

    For example:


    $ eject rmdisk0
    

    Note –

    The eject command also unmounts the device if it is not unmounted already. The command also terminates any active applications that access the device.


How to Remove a Hot-Pluggable USB Mass Storage Device With vold Running

The following procedure uses a Zip drive as an example of removing a hot-pluggable USB device with vold running.

  1. Unmount the device.


    $ volrmmount -e zip0
    
  2. (Optional) Stop any active applications that are using the device.

  3. Eject the device.


    $ eject zip0
    
  4. Become superuser and stop vold.


    # /etc/init.d/volmgt stop
    
  5. Remove the USB mass storage device.

  6. Start vold.


    # /etc/init.d/volmgt start
    

How to Add a Hot-Pluggable USB Mass Storage Device With vold Running

This procedure describes how to add a hot-pluggable USB device with vold running.

  1. Insert the USB mass storage device.

  2. Restart vold.


    # pkill -HUP vold
    
  3. Verify the device has been added.


    $ ls device-alias
    

Managing USB Mass Storage Devices Without vold Running

You can use USB mass storage devices without the volume manager (vold) running. Here are two ways to avoid using the volume manager.

The following procedures describe how to manage USB mass storage devices without vold(1M) running. The device nodes are created under the /dev/rdsk directory for character devices and under the /dev/dsk directory for block devices. See scsa2usb(7D) for details.

How to Mount or Unmount a USB Mass Storage Device Without vold Running

  1. Become superuser.

  2. Mount a USB mass storage device.


    # mount -F fs-type /dev/dsk/cntndnsn /mount-point
    

    This command might fail it the device is read only. Use the following command for CD-ROM devices.


    # mount -F fs-type -o ro /dev/dsk/cntndnsn /mount-point
    

    For example:


    # mount -F hsfs -o ro /dev/dsk/c0t6d0s2 /mnt
    
  3. Unmount a USB mass storage device.


    # umount /mount-point
    
  4. Eject the device.


    # eject /dev/[r]dsk/cntndnsn
    

How to Remove a Hot-Pluggable USB Mass Storage Device Without vold Running

This procedure describes how to remove a hot-pluggable USB device without vold running.

  1. Become superuser.

  2. Remove the hot-pluggable USB device.

    1. Unmount the device.


      # umount /mount-point
      
    2. (Optional) Stop any active applications that are using the device.

    3. Remove the device.

How to Add a Hot-Pluggable USB Mass Storage Device Without vold Running

This procedure describes how to add a hot-pluggable USB device without vold running.

  1. Add a hot-pluggable USB device into the USB port.

  2. Verify the USB device has been added.


    $ ls /dev/rdsk/cntndnsn
    

Creating Data on or Extracting Data From a USB CD

You can use the cdrw command to create and extract data from audio CDs. The cdrw command is available on the Software Supplement for the Solaris 8 Operating Environment 1/01 CD.

See the cdrw man page in the Solaris on Sun Hardware Reference Manual Supplement for information on using this command.

How to Prepare for Creating Data on or Extracting Data From a USB CD

The cdrw command works with or without vold running. See the cdrw(1) and mkisofs(1M) man pages for more information.

  1. Insert a CD into the CD-RW device.

    The CD can be any CD that the device can read.

  2. Check that the CD-RW drive is connected properly by listing the device.


    # cdrw -l
        Node              |    Connected Device            |  Device type
    ----------------------+--------------------------------+-----------------
     /dev/rdsk/c0t0d0s2   | SONY     CD-RW  CRX120E   1.0k | CD Reader/Writer
  3. (Optional) If you do not see the drive in the list, you might have to do a reconfiguration boot so that the system recognizes the device.


    # touch /reconfigure
    # init 6
    

How to Add a Hot-Pluggable USB Camera

Use this procedure to add a hot-pluggable USB camera.

  1. Plug in and turn on the USB camera.

    The USB subsystem and the SCSA subsystem create a logical device for the camera. After the camera is plugged in, output is written to the console window and the /var/adm/messages file.

  2. Examine the output written to the console window.

    Examining this output enables you to determine what logical device was created so that you can then use that device to access your images. The output will look similar to the following:


    Jul 15 09:53:35 buffy usba: [ID 349649 kern.info]       OLYMPUS, C-3040ZOOM,
     000153719068
    Jul 15 09:53:35 buffy genunix: [ID 936769 kern.info] scsa2usb1 is 
    /pci@0,0/pci925,1234@7,2/storage@2
    Jul 15 09:53:36 buffy scsi: [ID 193665 kern.info] sd3 at scsa2usb1: 
    target 0 lun 0
  3. Mount the USB camera file system.

    The camera's file system is most likely a PCFS file system. In order to mount the file system on the device created, the slice that represents the disk must be specified. The slice is normally s0 for a SPARC system, and p0 for an Intel system.

    For example, to mount the file system on an Intel system, execute the following command:


    % mount -F pcfs /dev/dsk/c3t0d0p0:c /mnt
    

    To mount the file system on a SPARC system, execute the following command:


    % mount -F pcfs /dev/dsk/c3t0d0s0:c /mnt
    

    For information on mounting file systems, see “Mounting and Unmounting File Systems (Tasks)” in System Administration Guide, Volume 1.

  4. Verify that the image files are available.

    For example:


    % ls /mnt/DCIM/100OLYMP/
    P7220001.JPG*  P7220003.JPG*  P7220005.JPG*
    P7220002.JPG*  P7220004.JPG*  P7220006.JPG*
  5. View and manipulate the image files created by the USB camera.


    % /usr/dt/bin/sdtimage &
    
  6. Unmount the file system before disconnecting the camera.

    Unmount the file system by executing the following command:


    % umount /mnt
    
  7. Turn off and disconnect the camera.

USB Audio Overview

This Solaris release provides USB audio support which is implemented by a pair of cooperating drivers, usb_ac and usb_as. The audio control driver, usb_ac, a USBA (Solaris USB Architecture) compliant client driver provides the controlling interface to user applications. The audio streaming driver, usb_as, is provided to process audio data messages during play and record and set sample frequency, precision, and encoding requests from the usb_ac drive.

Both drivers comply to the USB audio class 1.0 specification.

Solaris supports external USB audio devices that are play-only or record-only. Onboard USB audio devices are not supported. See the usb_ac man page for supported audio data formats.

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 following files:


/dev/sound/N

You can select a specific audio device by setting the AUDIODEV environment variable or by specifying the -d option to the audioplay and audiorecord commands. However, setting AUDIODEV does not work for 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. Refer to How to Change the Primary USB Audio Device and usb_ac(7D) for instructions on changing /dev/audio from onboard audio to USB audio and vice versa.

Hot-Plugging Multiple USB Audio Devices

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.

See usb_ac(7D) for additional information on troubleshooting USB audio device problems.

How to Add Hot-Pluggable USB Audio Devices

Use this procedure to add hot-pluggable USB audio devices.

  1. 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.

  2. Verify that the audio device files have been created.


    % ls /dev/sound
    0     0ctl  1     1ctl  2     2ctl
  3. Test the left and right USB speakers.


    % cd /usr/demo/SOUND/sounds
    % audioplay -d /dev/sound/1 -b 100 spacemusic.au
    % audioplay -d /dev/sound/1 -b -100 spacemusic.au
    
  4. Test the USB microphone.


    % cd $HOME/au
    % audiorecord -d /dev/sound/2 -p mic -t 30 test.au
    

Troubleshooting USB Audio Device Problems

This section describes how to troubleshoot USB audio device problems.

Audio Device Ownership Key Points

Keep the following audio device ownership key points in mind when working with audio devices.

How to Identify Your System's Primary Audio Device

This procedure assumes that you have already connected USB audio devices.

  1. 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.

  2. (Optional) Add a new USB audio device.

  3. 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,audio
    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,aud...
    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 procedure below 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 (driver not attached).
    .
    .
    .

How to Change the Primary USB Audio Device

Follow the steps below 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.

  1. Become superuser.

  2. Close all audio applications.

  3. Determine whether 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)
    # 
  4. Load and attach the onboard audio driver.


    # devfsadm -i audiocs
    
  5. Verify 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
    #
  6. 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.

  7. (Optional) Unload all the audio drivers that can be unloaded before plugging in another USB audio device.

    1. Close all the audio applications.

    2. Display the audio driver information to verify 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)
      # 
    3. 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.

  8. (Optional) Plug in a USB audio device.

  9. (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,aud...
    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,aud...
    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...
    % 

How to Remove Unused USB Audio Device Links

Use the procedure below if a USB audio device is removed while the system is powered off. It is possible that removing the USB audio device while the system is powered off will leave the /dev/audio device still pointing to a /dev/sound/* device that doesn't exist.

  1. Become superuser.

  2. Close all audio applications.

  3. Remove the unused audio links.


    # devfsadm -C -c audio