<chapter id="devusbtasks-1"><title>Using USB Devices (Tasks)</title><highlights><para>This chapter provides step-by-step instructions for using USB devices
in the Solaris OS. This chapter specifically covers how to use
USB devices with HAL services in the Solaris Express release. For information
about using USB devices with <command>vold</command> features in the Solaris
10 release, see <olink targetdoc="817-5093" remap="external"><citetitle remap="book">System Administration Guide: Devices and File Systems</citetitle></olink>.</para><para>For information on the procedures associated with using USB devices,
see the following:</para><itemizedlist><listitem><para><olink targetptr="devusbtasks-73" remap="internal">Managing USB Devices in
the Solaris OS (Roadmap)</olink></para>
</listitem><listitem><para><olink targetptr="devusbtasks-34" remap="internal">Using USB Mass Storage Devices
(Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="devusbtasks-36" remap="internal">Using USB Audio Devices
(Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="devusbtasks-37" remap="internal">Hot-Plugging USB Devices
With the cfgadm Command (Task Map)</olink></para>
</listitem>
</itemizedlist><para>For recent information about USB devices, go to the following site:</para><para><ulink url="http://www.sun.com/io_technologies/usb/USB-Faq.html" type="url">http://www.sun.com/io_technologies/usb/USB-Faq.html</ulink></para><para>For overview information about using USB devices, see <olink targetptr="devusbover-24" remap="internal">Chapter&nbsp;7, Using USB Devices (Overview)</olink>.</para>
</highlights><sect1 id="devusbtasks-73"><title>Managing USB Devices in the Solaris OS (Roadmap)</title><para>Use this road map to identify all the tasks for managing USB devices
in the Solaris OS. Each task points to a series of additional tasks such
as using USB devices, hot-plugging USB devices, and adding USB audio devices.</para><para>For information about using USB components in the Solaris OS, see <olink targetptr="devusbover-9" remap="internal">About USB in the Solaris OS</olink>.</para><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="33*"/><colspec colname="colspec1" colwidth="33*"/><colspec colname="colspec2" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Use USB mass storage devices.</para>
</entry><entry><para>A USB mass storage device must contain a file system before you can
add data to it. In addition, a USB diskette must be formatted before file
systems can be created and mounted on them.</para><para>This section also describes how to physically add or remove USB devices
from your system.</para>
</entry><entry><para><olink targetptr="devusbtasks-34" remap="internal">Using USB Mass Storage Devices (Task
Map)</olink></para>
</entry>
</row><row><entry><para>Add USB audio devices.</para>
</entry><entry><para>Use this task map to identify tasks associated with adding USB audio
devices.</para>
</entry><entry><para><olink targetptr="devusbtasks-36" remap="internal">Using USB Audio Devices (Task Map)</olink></para>
</entry>
</row><row><entry><para>Add or remove USB devices to and from your system with the <command>cfgadm</command> command.</para>
</entry><entry><para>You can logically add or remove USB devices to and from your system
with the <command>cfgadm</command> command.</para>
</entry><entry><para><olink targetptr="devusbtasks-37" remap="internal">Hot-Plugging USB Devices With the
cfgadm Command (Task Map)</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="devusbtasks-34"><title>Using USB Mass Storage Devices (Task Map)</title><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="33*"/><colspec colname="colspec1" colwidth="33*"/><colspec colname="colspec2" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry rowsep="0"><para>Add or remove a USB mass storage device.</para>
</entry><entry rowsep="0"><para>Select one of the following to add a USB mass storage device:</para>
</entry><entry rowsep="0"><para></para>
</entry>
</row><row><entry rowsep="0">
</entry><entry rowsep="0"><para>Add a USB mass storage device.</para>
</entry><entry rowsep="0"><para><olink targetptr="fapbw" remap="internal">How to Add a USB Mass Storage Device</olink></para>
</entry>
</row><row><entry rowsep="0"><para></para>
</entry><entry rowsep="0"><para>Add a USB camera to access digital images.</para>
</entry><entry rowsep="0"><para><olink targetptr="faphl" remap="internal">How to Add a USB Camera</olink></para>
</entry>
</row><row><entry colsep="1" rowsep="1">
</entry><entry colsep="1" rowsep="1"><para>Remove a USB mass storage device.</para>
</entry><entry colsep="1" rowsep="1"><para><olink targetptr="fapic" remap="internal">How to Remove a USB Mass Storage Device</olink></para>
</entry>
</row><row><entry colsep="1" rowsep="1"><para>Add a non-compliant USB mass storage device.</para>
</entry><entry colsep="1" rowsep="1"><para>Add a non-compliant USB mass storage device by adding an entry to <filename>scsa2usb.conf</filename>.</para>
</entry><entry colsep="1" rowsep="1"><para><olink targetptr="gafha" remap="internal">How to Use a Non-Complaint USB Mass Storage
Device</olink></para>
</entry>
</row><row><entry rowsep="0"><para>Prepare to use a USB mass storage device.</para>
</entry><entry rowsep="0"><para>Prepare to use a USB mass storage device.</para>
</entry><entry rowsep="0"><para><olink targetptr="devusbtasks-3" remap="internal">Preparing to Use a USB Mass Storage
Device</olink></para>
</entry>
</row><row><entry><para>Display USB device information.</para>
</entry><entry><para>Display information about USB devices.</para>
</entry><entry><para><olink targetptr="eyhux" remap="internal">How to Display USB Device Information</olink></para>
</entry>
</row><row><entry><para>Create a file system on a USB mass storage device.</para>
</entry><entry><para>You must create a file system on a device before you can put data on
it.</para>
</entry><entry><para><olink targetptr="devusbtasks-50" remap="internal">How to Create a File System on a USB
Mass Storage Device </olink></para>
</entry>
</row><row><entry><para>Modify partitions and create a file system on a USB mass storage device.</para>
</entry><entry><para>You might need to modify existing partitions before creating file systems
on a USB mass storage device.</para>
</entry><entry><para><olink targetptr="gafmj" remap="internal">How to Modify Partitions and Create a PCFS
File System on a USB Mass Storage Device</olink></para>
</entry>
</row><row><entry><para>Create a Solaris partition and modify the slices on a USB mass storage
device.</para>
</entry><entry><para>You will need to create a file with slice information before using the <command>rmformat</command> to modify the slice information.</para>
</entry><entry><para><olink targetptr="gafnz" remap="internal">How to Create a Solaris Partition and Modify
the Slices on a USB Mass Storage Device</olink></para>
</entry>
</row><row><entry rowsep="1"><para>Mount a USB mass storage device.</para>
</entry><entry rowsep="1"><para>Mount a USB mass storage device.</para>
</entry><entry rowsep="1"><para><olink targetptr="devusbtasks-22" remap="internal">How to Mount or Unmount a USB Mass
Storage Device</olink></para>
</entry>
</row><row><entry><para>(Optional) Disable a USB device driver.</para>
</entry><entry><para>Disable a USB device driver if you do not want USB support on your system.</para>
</entry><entry><para><olink targetptr="devusbtasks-56" remap="internal">How to Disable Specific USB Drivers</olink></para>
</entry>
</row><row><entry><para>(Optional) Remove unused USB device links.</para>
</entry><entry><para>Remove USB device links with the <command>devfsadm</command> command.</para>
</entry><entry><para><olink targetptr="devusbtasks-33" remap="internal">How to Remove Unused USB Device Links</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="devusbtasks-12"><title>Using USB Mass Storage Devices</title><para>Starting in the Solaris 9 release, the following USB removable mass
storage devices are supported:</para><itemizedlist><listitem><para>CD-RWs</para>
</listitem><listitem><para>Hard disks</para>
</listitem><listitem><para>DVDs</para>
</listitem><listitem><para>Digital cameras</para>
</listitem><listitem><para>Diskette devices</para>
</listitem><listitem><para>SmartMedia and CompactFlash devices</para>
</listitem>
</itemizedlist><para>For information about using USB mass storage devices with the Solaris
ZFS file system, see <olink targetptr="gafhv" remap="internal">What's New in USB Devices?</olink></para><para>For a complete list of USB devices that are supported in the Solaris OS,
see:</para><para><ulink url="http://www.sun.com/io_technologies/USB.html" type="url">http://www.sun.com/io_technologies/USB.html</ulink></para><para>In previous Solaris releases, all USB storage devices were identified
as removable media devices, which provides many of the following advantages,
including automatic mounting. In the Solaris Express release, USB mass storage devices are identified as hotpluggable
devices but also enjoy the advantages of USB removable devices that are listed
below. For more information about the hotpluggable behavior, see <olink targetptr="gcajp" remap="internal">USB and 1394 (FireWire) Support Enhancements</olink>.</para><itemizedlist><listitem><para>Starting in the Solaris
Express 6/05 release, a hot-pluggable device is automatically mounted.
For more information, see <olink targetptr="gafiu" remap="internal">vold Provides Awareness
of Hot-Plugged USB Devices</olink>.</para>
</listitem><listitem><para>USB storage devices with standard MS-DOS or Windows (FAT)
file systems are supported.</para>
</listitem><listitem><para>You can use the user-friendly <command>rmformat</command> command
to create slices. You can also use the <command>fdisk</command> command to
partition a USB device, but never use the <command>format</command> utility
or the <command>rmformat</command> <option>F</option> command to physically
format a USB drive.</para>
</listitem><listitem><para>Use the <command>rmformat</command> command to display all
USB devices with media inserted. For example, see <olink targetptr="eyhux" remap="internal">How
to Display USB Device Information</olink>.</para>
</listitem><listitem><para>Non-root users can now access USB storage devices, since the <command>mount</command> command is no longer needed. The device is automatically mounted
and is available under the  <filename>/media</filename> directory.  If a new device is connected while the system
is down, do a reconfiguration boot with the <command>boot -r</command> command
so that the device is recognized.</para>
</listitem><listitem><para>These devices can be managed with or without removable media
services.</para>
</listitem><listitem><para>Disks with FAT file systems can be mounted and accessed. For
example:</para><screen>mount -F pcfs /dev/dsk/c2t0d0s0:c /mnt</screen>
</listitem><listitem><para>All USB storage devices are now power managed, except for
those that support <literal>LOG SENSE</literal> pages. Devices with <literal>LOG
SENSE</literal> pages are usually SCSI drives connected through a USB-to-SCSI
bridge device. </para>
</listitem><listitem><para>Applications might work differently with USB mass storage
devices. Keep the following issues in mind when using applications with USB
storage devices:</para><itemizedlist><listitem><para>Applications might make incorrect assumptions about the size
of the media since only smaller devices like diskettes were removable previously.</para>
</listitem><listitem><para>Requests by applications to eject media on devices where this
would be inapplicable, such as a hard drive, will succeed and do nothing.</para>
</listitem><listitem><para>If you prefer the behavior in previous Solaris releases where
all USB mass storage were treated as removable media devices, then you can
force the old behavior by updating the <filename>/kernel/drv/scsa2usb.conf</filename> file.</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist><para>For more information on using USB mass storage devices, see <olink targetdoc="refman7" targetptr="scsa2usb-7d" remap="external"><citerefentry><refentrytitle>scsa2usb</refentrytitle><manvolnum>7D</manvolnum></citerefentry></olink>.</para><sect2 id="devusbtasks-46"><title>Using USB Diskette Devices</title><para>USB diskette devices appear as removable media devices. USB diskette
devices are not managed by the <literal>fd</literal> (floppy) driver. Applications
that issue <literal>ioctl(2)</literal> calls intended for the <literal>fd</literal> (native
floppy) driver will fail. Applications that issue only <literal>read(2)</literal> and <literal>write(2)</literal> calls will succeed. Other applications, such as SunPCI
and <command>rmformat</command>, also succeed.</para><para>The USB diskette device is identified as a SCSI removable media device.
The device is available for access under the  <filename>/media</filename> directory.</para><para>For more information on how to use USB diskette devices, see <olink targetptr="medintro-55492" remap="internal">Chapter&nbsp;1, Managing Removable Media (Overview)</olink>.</para>
</sect2><sect2 id="devusbtasks-13"><title>Using Non-Compliant USB Mass Storage Devices</title><para>Some devices might be supported by the USB mass storage driver even
though they do not identify themselves as compliant with the USB mass storage
class or identify themselves incorrectly. The <filename>scsa2usb.conf</filename> file
contains an attribute-override list that lists the vendor ID, product ID,
and revision for matching mass storage devices, as well as fields for overriding
the default device attributes. The entries in this list are commented out
by default. These entries can be copied and uncommented to enable support
of particular devices.</para><para>If you connect a USB mass storage device to a system running this Solaris
release and the system is unable to use it, you can check the <filename>/kernel/drv/scsa2usb.conf</filename> file to see if there is a matching, commented entry for this device.
Follow the information given in the <filename>scsa2usb.conf</filename> file
to see if a particular device can be supported by using the override information.</para><para>For a listing of recommended USB mass storage devices, go to:</para><para><ulink url="http://www.sun.com/io_technologies/USB.html" type="url">http://www.sun.com/io_technologies/USB.html</ulink></para><para>For more information, see <olink targetdoc="refman7" targetptr="scsa2usb-7d" remap="external"><citerefentry><refentrytitle>scsa2usb</refentrytitle><manvolnum>7D</manvolnum></citerefentry></olink>.</para><task id="gafha"><title>How to Use a Non-Complaint USB Mass Storage Device</title><procedure><step><para>Become superuser.</para>
</step><step><para>Add an entry to the <filename>/kernel/drv/scsa2usb.conf</filename> file.</para><para>The following entry is appropriate for a USB memory stick.</para><screen>attribute-override-list = "vid=* reduced-cmd-support=true";</screen>
</step><step><para>Either reboot the system or do the following:</para><substeps><step><para>Remove the device.</para>
</step><step><para>Manually update the driver.</para><screen># <userinput>update_drv -f scsa2usb</userinput></screen>
</step><step><para>Add the device.</para>
</step>
</substeps>
</step>
</procedure>
</task>
</sect2><sect2 id="eyhuz"><title>Hot-Plugging USB Mass Storage Devices</title><para>Hot-plugging a device means the device is added or removed without shutting
down the operating system or powering off the system. All USB devices are
hot-pluggable.</para><para>The removable media manager is now aware of hot-plugged devices. You
can just plug in the device, which is mounted in a few seconds. If nothing
happens, check to see if it is mounted.</para><para>Make sure that removable media services are running.</para><screen># <userinput>svcs hal dbus rmvolmgr</userinput>
STATE          STIME    FMRI
online         May_03   svc:/system/dbus:default
online         May_03   svc:/system/hal:default
online         May_03   svc:/system/filesystem/rmvolmgr:default</screen><para>The file system can be mounted from the device if it is valid and it
is recognized.</para><para>If the file system on the device is not automatically mounted, try a
manual mount.</para><para>Before hot-removing the device, find the name of the device in the <command>eject</command> <option>l</option> command's alias name. Then eject the device's
media. If you don't do this, the device is released and the port is usable
again, but the file system on the device might have been damaged.</para><para>When you hot-plug a USB device, the device is immediately seen in the
system's device hierarchy, as displayed in the <command>prtconf</command> command
output. When you remove a USB device, the device is removed from the system's
device hierarchy, unless you are using the device.</para><para>If you are using a device when it is unplugged, the device node  remains,
but the driver controlling this device stops all activity on the device. Any
new I/O activity issued to this device returns an error.</para><para>In this situation, the system prompts you to plug
in the original device. If the device is no longer available, stop the applications.
After a few seconds, the port becomes available again.</para><note><para>Data integrity might be impaired if you remove an active or open
device. Always close the device before removing, except the attached keyboard
and mouse, which can be moved while active.</para>
</note><task id="fapbw"><title>How to Add a USB Mass Storage Device</title><procedure><step><para>Become superuser or a console user.</para>
</step><step id="fapgq"><para>Connect the USB mass storage device.</para>
</step><step id="fapbv"><para>Verify that the USB device has been added.</para><para>For
example:</para><screen>$ rmformat
 Looking for devices...
       1. Logical Node: /dev/rdsk/c3t0d0p0
          Physical Node: /pci@0,0/pci108e,534a@2,1/storage@3/disk@0,0
          Connected Device: SanDisk  Cruzer Micro     0.3
          Device Type: Removable
          Bus: USB
          Size: 245.0 MB
          Label: &lt;None>
          Access permissions: Medium is not write protected.</screen>
</step><step><para>Verify that the device is automatically mounted under the <filename>/media</filename> directory.</para><para>For example:</para><screen>$ ls /media/NONAME
aa  bb</screen><para>You can also use the <command>rmmount</command> <option>l</option> command
to list the paths and nicknames of  mountable devices. If the device has been
mounted under the <filename>/media</filename> directory, you will see output
similar to the following:</para><screen>$ rmmount -l
/dev/dsk/c3t0d0p0:1  rmdisk0,NONAME,/media/NONAME</screen>
</step>
</procedure>
</task><task id="faphl"><title>How to Add a USB Camera</title><tasksummary><para>If the camera's media uses a PCFS file system, it will be automatically
mounted.  If the device does not bind to the <literal>scsa2usb</literal> driver,
use <literal>libusb</literal> applications for transferring the pictures.
For more information, refer to <filename>/usr/sfw/share/doc/libusb/libusb.txt</filename>.</para>
</tasksummary><procedure><step id="faphm"><para>Become superuser.</para>
</step><step><para>Plug in and turn on the USB camera.</para><para>The system creates a logical device for the camera.
After the camera is plugged in, output is written to the <filename>/var/adm/messages</filename> file to acknowledge the device's connection. The system treats
the camera as a storage device.</para>
</step><step id="fapdt"><para>Examine the output that is written to the <filename>/var/adm/messages</filename> file.</para><screen># <userinput>more /var/adm/messages</userinput></screen><para>Examining this output enables you to determine which logical device
was created so that you can then use that device to access your images. The
output looks similar to the following:</para><screen>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</screen><para>Match the device with a mountable <filename>/dev/dsk</filename> link
entry, by doing the following:</para><screen># <userinput>ls -l /dev/dsk/c*0 | grep /pci@0,0/pci925,1234@7,2/storage@2</userinput>
 lrwxrwxrwx   1 root     root          58 Jun 30  2004 c3t0d0p0 ->
 ../../devices/pci@0,0/pci925,1234@7,2/storage@2/disk@0,0:a</screen>
</step><step id="fapeu"><para>Mount the USB camera file system.</para><para>The camera's
file system is most likely a PCFS file system. If file system is PCFS, then
it should be automatically mounted.</para><para>To manually mount the file
system on an x86 system, you would use syntax similar to the following:</para><screen># <userinput>mount -F pcfs /dev/dsk/c3t0d0p0:c /mnt</userinput></screen><para>To manually mount the file system on a SPARC system, you would use syntax
similar to the following:</para><screen># <userinput>mount -F pcfs /dev/dsk/c3t0d0s0:c /mnt</userinput></screen><para>For information on mounting file systems, see <olink targetptr="fsmount-42780" remap="internal">Chapter&nbsp;18, Mounting and Unmounting File Systems
(Tasks)</olink>.</para><para>For information on mounting different PCFS file
systems, see <olink targetdoc="refman1m" targetptr="mount-pcfs-1m" remap="external"><citerefentry><refentrytitle>mount_pcfs</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para>
</step><step id="fapgo"><para>Verify that the image files are available.</para><para>For
example:</para><screen># <userinput>ls /mnt/DCIM/100OLYMP/</userinput>
P7220001.JPG*  P7220003.JPG*  P7220005.JPG*
P7220002.JPG*  P7220004.JPG*  P7220006.JPG*</screen>
</step><step id="fapim"><para>View and manipulate the image files created by the
USB camera.</para><para>For example:</para><screen># <userinput>/usr/dt/bin/sdtimage P7220001.JPG &amp;</userinput></screen>
</step><step id="fapin"><para>Unmount the file system before disconnecting the camera.</para><para>For example:</para><screen># <userinput>umount /mnt</userinput></screen>
</step><step performance="optional" id="fapcy"><para>Turn off and disconnect the
camera.</para>
</step>
</procedure>
</task><task id="fapic"><title>How to Remove a USB Mass Storage
Device</title><procedure><step id="fapds"><para>Become superuser or a console user.</para>
</step><step id="fapfg"><para>Stop any active applications that are using the device.</para>
</step><step id="fapgj"><para>Unmount the device.</para><screen>$ rmumount NONAME</screen><para>Or, use the <command>umount</command> command as superuser. For example:</para><screen># umount /media/NONAME</screen><para>For more information about unmounting a USB device, see <olink targetptr="devusbtasks-22" remap="internal">How to Mount or Unmount a USB Mass Storage Device</olink>.</para>
</step><step><para>Remove the device.</para>
</step>
</procedure>
</task>
</sect2><sect2 id="devusbtasks-3"><title>Preparing to Use a USB Mass Storage Device</title><para>You can access information on removable media with or without using
removable media services. For information on accessing information on removable
media with GNOME's File Manager, see the GNOME desktop documentation.</para><para>After the USB device is formatted, it is usually mounted under the  <filename>/media/</filename><replaceable>label</replaceable> directory.</para><para>The
device nodes are created under the <filename>/dev/rdsk</filename> directory
for character devices and under the <filename>/dev/dsk</filename> directory
for block devices. Device links are created when the devices are hot-plugged.
For more information, see <olink targetdoc="refman7" targetptr="scsa2usb-7d" remap="external"><citerefentry><refentrytitle>scsa2usb</refentrytitle><manvolnum>7D</manvolnum></citerefentry></olink>.</para><para>If the device cannot be identified by removable media services, then
try to manually mount the device. First, use the <command>rmformat</command> command
to identify the device path and then use the <command>mount</command> command
to manually mount the device as superuser.</para><para>If a device is mounted by removable media services then you
can unmount it by using the <command>rmumount</command> command. If the
device is manually mounted, then you would unmount it using the <command>umount</command> command
as superuser.</para><para>For more information about mounting and unmounting USB devices, see <olink targetptr="devusbtasks-22" remap="internal">How to Mount or Unmount a USB Mass Storage Device</olink>.</para>
</sect2><task id="eyhux"><title>How to Display USB Device Information</title><procedure remap="single-step"><step><para>Display information about USB devices.</para><para>For example, use
the <command>prtconf</command> command to display USB device information.
The <command>prtconf</command> output in this example has been truncated to
only display USB device information.</para><screen>$ <userinput>prtconf</userinput>
        usb, instance #0
                 hub, instance #2
                     device, instance #8
                         interface (driver not attached)
                     printer (driver not attached)
                     mouse, instance #14
                     device, instance #9
                         keyboard, instance #15
                         mouse, instance #16
                     storage, instance #7
                         disk (driver not attached)
                     communications, instance #10
                         modem (driver not attached)
                         data (driver not attached)
                 storage, instance #0
                     disk (driver not attached)
                 storage, instance #1
                     disk (driver not attached)</screen><para>For example, use the <command>rmformat</command> command
to display USB device information.</para><screen>$ rmformat
 Looking for devices...
       1. Logical Node: /dev/rdsk/c3t0d0p0
          Physical Node: /pci@0,0/pci108e,534a@2,1/storage@3/disk@0,0
          Connected Device: SanDisk  Cruzer Micro     0.3
          Device Type: Removable
          Bus: USB
          Size: 245.0 MB
          Label: &lt;None>
          Access permissions: Medium is not write protected.</screen>
</step>
</procedure>
</task><task id="devusbtasks-50"><title>How to Create a File System on a USB Mass
Storage Device </title><tasksummary><para>A USB diskette must be formatted before you can add a file system to
it. All other USB mass storage devices just need a PCFS or UFS file system
before they can be used. Keep the following key points in mind when formatting
a USB device:</para><itemizedlist><listitem><para>Do not use the <command>rmformat</command> <option>F</option> except
on a USB diskette.</para>
</listitem><listitem><para>If the default slices are not acceptable, use the <command>rmformat</command> <option>s</option> command to create slices. Use the <command>fdisk</command> utility
to partition a USB device, if needed. For step-by-step instructions, see:</para><itemizedlist><listitem><para><olink targetptr="gafmj" remap="internal">How to Modify Partitions and Create
a PCFS File System on a USB Mass Storage Device</olink></para>
</listitem><listitem><para><olink targetptr="gafnz" remap="internal">How to Create a Solaris Partition
and Modify the Slices on a USB Mass Storage Device</olink></para>
</listitem><listitem><para>If the USB device is automatically mounted, you will have
to unmount it before you can create a file system on the USB device. Use
the <command>rmmount</command> <option>l</option> command to identify the
device nickname and then the <command>rmumount</command> command to unmount
the USB device.</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist><note><para>Perform steps 4-5 only if you need to format a USB diskette.</para>
</note>
</tasksummary><procedure><step><para>Become superuser.</para>
</step><step id="devusbtasks-step-76"><para>Add the USB device to your system. For information on hot-plugging USB devices, see:</para><itemizedlist><listitem><para><olink targetptr="eyhuz" remap="internal">Hot-Plugging USB Mass Storage Devices</olink></para>
</listitem><listitem><para><olink targetptr="devusbtasks-37" remap="internal">Hot-Plugging USB Devices
With the cfgadm Command (Task Map)</olink></para>
</listitem>
</itemizedlist>
</step><step id="devusbtasks-step-75"><para>(Optional) Identify the USB device.</para><para>For example:</para><screen># rmformat
Looking for devices...
     1. Logical Node: /dev/rdsk/c2t0d0p0
        Physical Node: /pci@0,0/pci108e,534a@2,1/hub@7/floppy@1/disk@0,0
        Connected Device: MITSUMI  USB FDD          1039
        Device Type: Floppy drive
        Bus: USB
        Size: 1.4 MB
        Label: &lt;None>
        Access permissions: Medium is not write protected.</screen><para>In
this example, the diskette device is <literal>c2t0d0p0</literal>.</para>
</step><step id="devusbtasks-step-77"><para>Insert a diskette into the diskette drive,
if necessary.</para>
</step><step><para>Format the diskette, if necessary.</para><screen>% <userinput>rmformat -F long</userinput> <replaceable>raw-device</replaceable></screen><para>For example, on a SPARC system:</para><screen>% <userinput>rmformat -F long /dev/rdsk/c2t0d0s2</userinput></screen><para>For example, on an x86 system:</para><screen>% <userinput>rmformat -F long /dev/rdsk/c3t0d0p0</userinput></screen>
</step><step id="devusbtasks-step-33"><para>Determine the file system type and make
sure the device is unmounted. Then, select one of the following:</para><para>For
more information about unmounting a USB device, see <olink targetptr="devusbtasks-22" remap="internal">How to Mount or Unmount a USB Mass Storage Device</olink>.</para><itemizedlist><listitem><para>Create a PCFS file system.</para><screen># <userinput>mkfs -F pcfs -o nofdisk,size=</userinput><replaceable>size</replaceable> <replaceable>raw-device</replaceable></screen><para>Specify the <option>size</option> option in 512-byte blocks.</para><para>The
following example shows how to create a PCFS file system on a 1.4-Mbyte diskette
on a SPARC system:</para><screen># <userinput>mkfs -F pcfs /dev/rdsk/c2t0d0p0</userinput>
Construct a new FAT file system on /dev/rdsk/c2t0d0p0: (y/n)? <userinput>y</userinput></screen><para>The following example shows how to create a PCFS file system on a 1.4-Mbyte
diskette on an x86 system:</para><screen># <userinput>mkfs -F pcfs /dev/rdsk/c2t0d0s2</userinput>
Construct a new FAT file system on /dev/rdsk/c2t0d0s2: (y/n)? <userinput>y</userinput></screen><para>The following example shows how to create a PCFS file system on a 100-Mbyte
USB memory stick on a SPARC system:</para><screen># <userinput>mkfs -F pcfs /dev/rdsk/c5t0d0s2:c</userinput></screen><para>The following example shows how to create a PCFS file system on a 100-Mbyte
USB memory stick on an x86 system:</para><screen># <userinput>mkfs -F pcfs /dev/rdsk/c5t0d0p0:c</userinput></screen><para>This command can take several minutes to complete.</para>
</listitem><listitem><para>Create a UFS file system.</para><screen># <userinput>newfs</userinput> <replaceable>raw-device</replaceable></screen><para>For example:</para><screen># <userinput>newfs /dev/rdsk/c4t0d0s7</userinput></screen><para>Consider using the <literal>newfs -f 4096</literal> option or <literal>newfs
-T</literal> option for large USB hard disks.</para><note><para>UFS file system overhead consumes a significant portion of space
on a diskette, due to a diskette's limited storage capacity.</para>
</note>
</listitem>
</itemizedlist><para>See the next two procedures for a detailed example of creating a PCFS
file system and modifying slices on a USB mass storage device.</para>
</step>
</procedure>
</task><task id="gafmj"><title>How to Modify Partitions and Create
a PCFS File System on a USB Mass Storage Device</title><tasksummary><para>The following steps describe how to delete an existing partition, create
a new partition, and then create a PCFS file system on the USB device. Make
sure you backup any data before you perform this task.</para>
</tasksummary><procedure><step><para>Become superuser.</para>
</step><step><para>Start the <command>fdisk</command> utility.</para><para>For example:</para><screen># <userinput>fdisk /dev/rdsk/c3t0d0p0</userinput></screen>
</step><step><para>Delete the partition by selecting option 3.</para><para>For example:</para><screen>      Total disk size is 29 cylinders
             Cylinder size is 2048 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1       Active    Solaris2          1    28      28     97

SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Enter Selection: <userinput>3</userinput></screen>
</step><step><para>Choose the partition number to delete.</para><para>For example:</para><screen>      Total disk size is 29 cylinders
             Cylinder size is 2048 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1       Active    Solaris2          1    28      28     97

SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Specify the partition number to delete (or enter 0 to exit): <userinput>1</userinput>

Partition deleted.</screen>
</step><step><para>Create a partition.</para><para>For example:</para><screen>      Total disk size is 29 cylinders
             Cylinder size is 2048 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===

WARNING: no partitions are defined!

SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Enter Selection: <userinput>1</userinput></screen>
</step><step><para>Select the FAT32 partition type.</para><screen>      Total disk size is 29 cylinders
             Cylinder size is 2048 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===

WARNING: no partitions are defined!

SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Select the partition type to create:
   1=SOLARIS2  2=UNIX        3=PCIXOS     4=Other    
   5=DOS12     6=DOS16       7=DOSEXT     8=DOSBIG
   9=DOS16LBA  A=x86 Boot    B=Diagnostic C=FAT32
   D=FAT32LBA  E=DOSEXTLBA   F=EFI        0=Exit? <userinput>c</userinput></screen>
</step><step><para>Specify the percentage of disk to use for this partition.</para><screen>       Total disk size is 29 cylinders
              Cylinder size is 2048 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===

WARNING: no partitions are defined!

SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Select the partition type to create:
Specify the percentage of disk to use for this partition (or type "c" to 
specify the size in cylinders). <userinput>100</userinput></screen>
</step><step><para>Select whether the new partition should be the active partition
or an inactive partition.</para><screen>              Total disk size is 29 cylinders
              Cylinder size is 2048 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===

WARNING: no partitions are defined!

SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Select the partition type to create:
Should this become the active partition? If yes, it  will be activated 
each time the computer is reset or turned on.
Please type "y" or "n". <userinput>n</userinput></screen>
</step><step><para>Update the disk configuration and exit.</para><screen>      Total disk size is 29 cylinders
             Cylinder size is 2048 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1                 Win95 FAT32       1    28      28     97

SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Exit (update disk configuration and exit)
   6. Cancel (exit without updating disk configuration)
Enter Selection: <userinput>5</userinput></screen>
</step><step><para>Create the PCFS file system on this partition.</para><para>Make
sure the device is unmounted before creating the new file system. For more
information about unmounting a USB device, see <olink targetptr="devusbtasks-22" remap="internal">How to Mount or Unmount a USB Mass Storage Device</olink>.</para><para>For
example:</para><screen># <userinput>mkfs -F pcfs -o fat=32 /dev/rdsk/c3t0d0p0:c</userinput>
Construct a new FAT file system on /dev/rdsk/c3t0d0p0:c: (y/n)? <userinput>y</userinput></screen>
</step>
</procedure>
</task><task id="gafnz"><title>How to Create a Solaris Partition
and Modify the Slices on a USB Mass Storage Device</title><tasksummary><para>The following steps illustrate how to create a Solaris partition and
modify the slices.</para><para>Make sure you back up any data before you perform this task.</para>
</tasksummary><procedure><step><para>Become superuser.</para>
</step><step><para>Start the <command>fdisk</command> utility.</para><para>For example:</para><screen># <userinput>fdisk /dev/rdsk/c5t0d0s2</userinput>
No fdisk table exists. The default partition for the disk is:

  a 100% "SOLARIS System" partition

Type "y" to accept the default partition,  otherwise type "n" to edit the
 partition table.
<userinput>y</userinput></screen>
</step><step><para>Display the current slices.</para><para>For example:</para><screen># <userinput>prtvtoc /dev/rdsk/c5t0d0s2</userinput>
* /dev/rdsk/c5t0d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*     255 tracks/cylinder
*   16065 sectors/cylinder
*    5836 cylinders
*    5836 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      0    00          0  93755340  93755339
       2      0    00          0  93755340  93755339</screen>
</step><step><para>Create a text file with the slice information.</para><para>For
example:</para><screen>slices: 0 = 0, 5GB, "wm", "home" :
        1 = 8225280000, 6GB :
        2 = 0, 44GB, "wm", "backup" :
        6 = 16450560000, 15GB</screen><para>Make sure each slice starts on a cylinder boundary. For example, slice
1 starts at 822280000 bytes, which is the cylinder size in bytes multiplied
by 1000.</para><para>For more information, see the <option>s</option> option
description in <olink targetdoc="refman1" targetptr="rmformat-1" remap="external"><citerefentry><refentrytitle>rmformat</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>.</para>
</step><step><para>Create the slices by including the slice file created above.</para><para>For example:</para><screen># <userinput>rmformat -s slice_file /dev/rdsk/c5t0d0s2</userinput></screen>
</step><step><para>View the new slice information.</para><para>For example:</para><screen># <userinput>prtvtoc /dev/rdsk/c5t0d0s2</userinput>
* /dev/rdsk/c5t0d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*      63 sectors/track
*     255 tracks/cylinder
*   16065 sectors/cylinder
*    5836 cylinders
*    5836 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
* Unallocated space:
*       First     Sector    Last
*       Sector     Count    Sector
*    10485760   5579240  16064999
*    28647912   3482088  32129999
*    63587280  30168060  93755339
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      8    00          0  10485760  10485759
       1      3    01   16065000  12582912  28647911
       2      5    00          0  92274688  92274687
       6      4    00   32130000  31457280  63587279</screen>
</step>
</procedure>
</task><task id="devusbtasks-22"><title>How to Mount or Unmount
a USB Mass Storage Device</title><tasksummary><para>The following steps illustrate how to mount and unmount a USB mass storage
device.</para>
</tasksummary><procedure><step id="devusbtasks-step-30"><para>Become superuser or console user.</para>
</step><step id="devusbtasks-step-78"><para>(Optional) Identify the device.</para><para>For example:</para><screen>$ rmformat
 Looking for devices...
       1. Logical Node: /dev/rdsk/c3t0d0p0
          Physical Node: /pci@0,0/pci108e,534a@2,1/storage@3/disk@0,0
          Connected Device: SanDisk  Cruzer Micro     0.3
          Device Type: Removable
          Bus: USB
          Size: 245.0 MB
          Label: &lt;None>
          Access permissions: Medium is not write protected.</screen><para>In
this example, the physical diskette device is <literal>c2t0d0p0</literal>.</para><para>Or, identify the nickname for the device. For example:</para><screen>$ <userinput>rmmount -l</userinput>
/dev/dsk/c2t0d0p0       floppy,floppy0,fd,fd0,diskette,diskette0,rdiskette,rdiskette0</screen>
</step><step id="devusbtasks-step-31"><para>Select one of the following to mount
or unmount a USB mass storage device:</para><itemizedlist><listitem><para>Mount a USB mass storage device as
a console user. </para><para>You can use the <command>rmmount</command> command
with device nicknames, mount points, or device paths, similar to the following:</para><screen>$ rmmount rmdisk0
$ rmmount NONAME
$ rmmount /dev/dsk/c3t0d0p0:1</screen><para>For example:</para><screen>$ <userinput>rmmount NONAME</userinput>
NONAME /dev/dsk/c2t0d0p0 mounted
$ <userinput>ls /media/NONAME</userinput>
AA.TXT</screen>
</listitem><listitem><para>Unmount a USB mass storage device as a console
user.</para><para>For example:</para><screen>$ <userinput>rmumount NONAME</userinput>  
NONAME /dev/dsk/c2t0d0p0 unmounted</screen>
</listitem><listitem><para>Mount a USB mass storage device as superuser.</para><para>This
example shows how to mount a device with a UFS file system:</para><screen># <userinput>mount /dev/dsk/c1t0d0s2 /mnt</userinput></screen><para>This example shows how to mount a device with a PCFS file system on
a SPARC system:</para><screen># <userinput>mount -F pcfs /dev/dsk/c3t0d0s2:c /mnt</userinput></screen><para>This example shows how to mount a device with a PCFS file system on
an x86 system:</para><screen># <userinput>mount -F pcfs /dev/dsk/c3t0d0p0:c /mnt</userinput></screen><para>This example shows how to mount a CD with a read-only HSFS file system:</para><screen># <userinput>mount -F hsfs -o ro /dev/dsk/c1t0d0s2 /mnt</userinput></screen>
</listitem><listitem><para>Unmount a USB mass storage device as superuser.</para><para>First,
be sure no one is using the file system on the device.</para><para>For example:</para><screen># <userinput>fuser -c -u /mnt</userinput>
# <userinput>umount /mnt</userinput></screen>
</listitem>
</itemizedlist>
</step><step><para>Eject the device, which is optional for DVD, CD, or diskette devices.</para><para>For example:</para><screen># <userinput>eject /dev/rdsk/c1t0d0s2</userinput></screen>
</step>
</procedure>
</task><sect2 id="devusbover-45"><title>Troubleshooting Tips for USB Mass Storage
Devices</title><para>Keep the following tips in mind if you have problems adding or removing
a USB mass storage device.</para><itemizedlist><para>Check the <filename>/var/adm/messages</filename> file for failures to
enumerate the device. For enumeration failures, possibly, insert the USB hub
or remove a hub and connect it directly to a root USB hub.</para><listitem><para>If USB devices are added or removed when the system is down,
you must perform a reconfiguration boot.</para><screen>ok <userinput>boot -r</userinput></screen><para>If you have problems accessing a device that was connected while the
system is running, try the following command:</para><screen># <userinput>devfsadm</userinput></screen>
</listitem><listitem><para>Do not move devices around if the system has been powered
down by a suspend operation. For more information, see <olink targetptr="devusbover-23" remap="internal">USB Power Management</olink>.</para>
</listitem><listitem><para>If a device has been hot removed while in use by applications
and is no longer available, then stop the applications. Use the <command>prtconf</command> command
to see whether the device node has been removed.</para>
</listitem>
</itemizedlist>
</sect2><sect2 id="devusbtasks-59"><title>Disabling Specific USB Drivers</title><para>You can disable specific types of USB devices by disabling their client
driver. For example, USB printers can be disabled by disabling the <filename>usbprn</filename> driver that directs them. Disabling <filename>usbprn</filename> does
not affect other kinds of devices, such as USB storage devices.</para><para>The following table identifies some USB device
types and their corresponding drivers.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colname="colspec0" colwidth="21.72*"/><colspec colname="colspec3" colwidth="28.28*"/><thead><row rowsep="1"><entry><para>Device Type</para>
</entry><entry><para>Driver to Disable</para>
</entry>
</row>
</thead><tbody><row><entry><para>Audio</para>
</entry><entry><para><filename>usb_ac</filename> and <filename>usb_as</filename></para>
</entry>
</row><row><entry><para>HID (usually keyboard and mouse)</para>
</entry><entry><para><filename>hid</filename></para>
</entry>
</row><row><entry><para>Storage</para>
</entry><entry><para><filename>scsa2usb</filename></para>
</entry>
</row><row><entry><para>Printer</para>
</entry><entry><para><filename>usbprn</filename></para>
</entry>
</row><row><entry><para>Serial</para>
</entry><entry><para><filename>usbser_edge</filename></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>If you disable a driver for a USB device that is still connected to
the system, you see a console message similar to the following:</para><screen>usba10: WARNING: usba:    no driver found for device <replaceable>name</replaceable></screen>
</sect2><task id="devusbtasks-56"><title>How to Disable Specific USB Drivers</title><procedure><step><para>Become superuser.</para>
</step><step id="devusbtasks-step-61"><para>Exclude the driver alias entry from the <filename>/etc/system</filename> file.</para><para>For example, include the following
exclude statement to exclude the <literal>usbprn</literal> driver.</para><screen>exclude: usbprn</screen>
</step><step id="devusbtasks-step-62"><para>Reboot the system.</para><screen># <userinput>init 6</userinput></screen>
</step>
</procedure>
</task><task id="devusbtasks-33"><title>How to Remove Unused USB Device Links</title><tasksummary><para>Use this procedure if a USB device is removed while the system is powered
off. Removing the USB device while the system is powered off can leave device
links for devices that do not exist.</para>
</tasksummary><procedure><step id="devusbtasks-step-50"><para>Become superuser.</para>
</step><step id="devusbtasks-step-40"><para>Close all applications that might be
accessing the device.</para>
</step><step id="devusbtasks-step-46"><para>Remove the unused links for a specific
USB class.</para><para>For example:</para><screen># <userinput>devfsadm -C -c audio</userinput></screen><para>Or, just remove the dangling links:</para><screen># <userinput>devfsadm -C</userinput></screen>
</step>
</procedure>
</task>
</sect1><sect1 id="devusbtasks-36"><title>Using USB Audio Devices (Task Map)</title><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="33*"/><colspec colname="colspec1" colwidth="33*"/><colspec colname="colspec2" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Add USB audio devices.</para>
</entry><entry><para>Add a USB microphone and speakers.</para>
</entry><entry><para><olink targetptr="devusbtasks-26" remap="internal">How to Add USB Audio Devices</olink></para>
</entry>
</row><row><entry><para>Identify your system's primary audio device.</para>
</entry><entry><para>Identify which audio device is your primary audio device.</para>
</entry><entry><para><olink targetptr="devusbtasks-31" remap="internal">How to Identify Your System's Primary
Audio Device</olink></para>
</entry>
</row><row><entry><para>Change the primary USB audio device.</para>
</entry><entry><para>You might want to make one audio device the primary audio device if
you remove or change your USB audio devices.</para>
</entry><entry><para><olink targetptr="eyhvg" remap="internal">How to Change the Primary USB Audio Device</olink></para>
</entry>
</row><row><entry><para>Remove unused USB device links.</para>
</entry><entry><para>If you remove a USB audio device while the system is powered off, the <filename>/dev/audio</filename> device might be pointing to a <filename>/dev/sound/*</filename> device
that doesn't exist.</para>
</entry><entry><para><olink targetptr="devusbtasks-33" remap="internal">How to Remove Unused USB Device Links</olink></para>
</entry>
</row><row><entry><para>Solve USB audio problems.</para>
</entry><entry><para>Use this section if no sound comes from the USB speakers.</para>
</entry><entry><para><olink targetptr="devusbtasks-30" remap="internal">Troubleshooting USB Audio Device Problems</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="eyhva"><title>Using USB Audio Devices</title><para>For information about USB audio support in specific Solaris releases,
see <olink targetptr="devusbover-28" remap="internal">Solaris Support for USB Devices</olink>.</para><para>This Solaris release provides USB
audio support that is implemented by a pair of cooperating drivers, <filename>usb_ac</filename> and <filename>usb_as</filename>.  The audio control driver, <filename>usb_ac</filename>, is a Solaris USB Architecture compliant client driver that
provides the controlling interface to user applications. The audio streaming
driver, <filename>usb_as</filename>, processes audio data messages during
play and record. It sets sample frequency and precision, and encodes requests
from the <filename>usb_ac</filename> driver. Both drivers comply with the
USB audio class 1.0 specification.</para><para>Some audio devices can set volume under software control. A STREAMS
module, <literal>usb_ah</literal>, is pushed on top of the HID driver for
managing this function.</para><para>Solaris supports USB audio devices that are play-only, record-only,
or record and play. Hot-plugging of USB audio devices is supported.</para><itemizedlist><listitem><para>USB audio devices are supported on SPARC <trademark>Ultra</trademark> and
x86 platforms that have USB connectors.</para>
</listitem><listitem><para>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. </para>
</listitem><listitem><para>For fully supported audio data format information, see <olink targetdoc="refman7" targetptr="usb-ac-7d" remap="external"><citerefentry><refentrytitle>usb_ac</refentrytitle><manvolnum>7D</manvolnum></citerefentry></olink>.</para>
</listitem>
</itemizedlist><para>The primary audio device is <filename>/dev/audio</filename>. You can
verify that <filename>/dev/audio</filename> is pointing to USB audio by using
the following command:</para><screen>% <userinput>mixerctl</userinput>
Device /dev/audioctl:
  Name    = USB Audio
  Version = 1.0
  Config  = external

Audio mixer for /dev/audioctl is enabled</screen><para>After you connect your USB audio devices, you access them with the <command>audioplay</command> and <command>audiorecord</command> command through the <filename>/dev/sound/</filename><replaceable>N</replaceable> device links.</para><para>Note that the <filename>/dev/audio</filename> and <filename>/dev/sound/N</filename> devices
can refer to speakers, microphones, or combination devices.  If you refer
to the incorrect device type, the command fails. For example, the <command>audioplay</command> command fails if you try to use it with a microphone.</para><para>You can select a specific default audio device for most Sun audio applications,
such as <command>audioplay</command> and <command>audiorecord</command>, by
setting the <literal>AUDIODEV</literal> shell variable or by specifying the <option>d</option> option for these commands. However, setting <literal>AUDIODEV</literal> does
not work for third-party applications that have <filename>/dev/audio</filename> hardcoded
as the audio file.</para><para>When you plug in a USB audio device, it automatically becomes the primary
audio device, <filename>/dev/audio</filename>, unless <filename>/dev/audio</filename> is
in use. For instructions on changing <filename>/dev/audio</filename> from
on-board audio to USB audio and vice versa, refer to <olink targetptr="eyhvg" remap="internal">How
to Change the Primary USB Audio Device</olink>, and <olink targetdoc="refman7" targetptr="usb-ac-7d" remap="external"><citerefentry><refentrytitle>usb_ac</refentrytitle><manvolnum>7D</manvolnum></citerefentry></olink>.</para><sect2 id="devusbtasks-29"><title>Hot-Plugging Multiple USB Audio Devices</title><para>If a USB audio device is plugged into a system, it becomes the primary
audio device, <filename>/dev/audio</filename>. 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.</para><para>For additional information on troubleshooting USB audio device problems,
see <olink targetdoc="refman7" targetptr="usb-ac-7d" remap="external"><citerefentry><refentrytitle>usb_ac</refentrytitle><manvolnum>7D</manvolnum></citerefentry></olink>.</para>
</sect2><task id="devusbtasks-26"><title>How to Add USB Audio Devices</title><procedure><step id="devusbtasks-step-2"><para>Plug in the USB speaker.</para><para>The primary audio device, <filename>/dev/audio</filename>, points to the USB speaker.</para><screen>% <userinput>ls -l /dev/audio</userinput>
lrwxrwxrwx   1 root     root    10 Feb 13 08:46 /dev/audio -> usb/audio0</screen>
</step><step id="devusbtasks-step-8"><para>(Optional) Remove the speaker. Then, plug
it back in.</para><para>If you remove the speaker, the <filename>/dev/audio</filename> device
reverts back to on-board audio.</para><screen>% <userinput>ls -l /dev/audio</userinput>
lrwxrwxrwx   1 root     root   7 Feb 13 08:47 /dev/audio -> sound/0</screen>
</step><step id="devusbtasks-step-29"><para>Add a USB microphone.</para><screen>% <userinput>ls -l /dev/audio</userinput>
lrwxrwxrwx   1 root     root    10 Feb 13 08:54 /dev/audio -> usb/audio1</screen>
</step>
</procedure>
</task><task id="devusbtasks-31"><title>How to Identify Your System's Primary Audio
Device</title><tasksummary><para>This procedure assumes that you have already connected the USB audio
devices.</para>
</tasksummary><procedure remap="single-step"><step id="devusbtasks-step-47"><para>Examine your system's new audio links.</para><itemizedlist><listitem><para>Display your system's new audio links with the <command>ls</command> command.</para><para>For example:</para><screen>% <userinput>ls -lt /dev/audio*</userinput>
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/
% <userinput>ls -lt /dev/sound/*</userinput>
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
% </screen><para>Notice that the primary audio device, <filename>/dev/audio</filename>,
is pointing to the newly plugged in USB audio device, <filename>/dev/usb/audio0</filename>.</para>
</listitem><listitem><para>You can also examine your system's USB audio devices with
the <command>prtconf</command> command and look for the USB device information.</para><screen>% <userinput>prtconf</userinput>
.
.
.
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
.
.
.</screen>
</listitem>
</itemizedlist>
</step>
</procedure>
</task><task id="eyhvg"><title>How to Change the Primary USB Audio Device</title><procedure remap="single-step"><step><para>Select one of the following to change the primary USB audio device.</para><itemizedlist><listitem><para>If you want the on-board audio device to become the primary
audio device, remove the USB audio devices. The <filename>/dev/audio</filename> link
then points to the <filename>/dev/sound/0</filename> entry. If the <filename>/dev/sound/0</filename> entry is not the primary audio device, then either shut down the
system and use the <command>boot</command> <option>r</option> command, or
run the <command>devfsadm</command> <option>i</option> command as root.</para>
</listitem><listitem><para>If you want the USB audio device to become primary audio device,
just plug it in and check the device links.</para>
</listitem>
</itemizedlist>
</step>
</procedure>
</task><sect2 id="devusbtasks-30"><title>Troubleshooting USB Audio Device Problems</title><para>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.</para><para>The workaround is to power cycle the USB speakers.</para><sect3 id="devusbtasks-16"><title>Key Points of Audio Device Ownership</title><para>Keep the following key points of audio device ownership in mind when
working with audio devices:</para><itemizedlist><listitem><para>When you plug in a USB audio device and you are logged in
on the console, the console is the owner of the <filename>/dev/</filename>*
entries. This situation means you can use the audio device as long as you
are logged in to the console.</para>
</listitem><listitem><para>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 <olink targetdoc="refman4" targetptr="logindevperm-4" remap="external"><citerefentry><refentrytitle>logindevperm</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>.</para>
</listitem><listitem><para>When you remotely log in with the <command>rlogin</command> 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. </para>
</listitem>
</itemizedlist>
</sect3>
</sect2>
</sect1><sect1 id="devusbtasks-37"><title>Hot-Plugging USB Devices With the <command>cfgadm</command> Command (Task Map)</title><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="33*"/><colspec colname="colspec1" colwidth="33*"/><colspec colname="colspec2" colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Display USB bus information.</para>
</entry><entry><para>Display information about USB devices and buses.</para>
</entry><entry><para><olink targetptr="eyhvx" remap="internal">How to Display USB Bus Information (cfgadm)</olink></para>
</entry>
</row><row><entry><para>Unconfigure a USB device.</para>
</entry><entry><para>Logically unconfigure a USB device that is still physically connected
to the system.</para>
</entry><entry><para><olink targetptr="devusbtasks-96" remap="internal">How to Unconfigure a USB Device</olink></para>
</entry>
</row><row><entry><para>Configure a USB device.</para>
</entry><entry><para>Configure a USB device that was previously unconfigured.</para>
</entry><entry><para><olink targetptr="devusbtasks-100" remap="internal">How to Configure a USB Device</olink></para>
</entry>
</row><row><entry><para>Logically disconnect a USB device.</para>
</entry><entry><para>You can logically disconnect a USB device if you are not physically
near the system.</para>
</entry><entry><para><olink targetptr="devusbtasks-104" remap="internal">How to Logically Disconnect a USB
Device</olink></para>
</entry>
</row><row><entry><para>Logically connect a USB device.</para>
</entry><entry><para>Logically connect a USB device that was previously logically disconnected
or unconfigured.</para>
</entry><entry><para><olink targetptr="devusbtasks-108" remap="internal">How to Logically Connect a USB Device</olink></para>
</entry>
</row><row><entry><para>Disconnect a USB device subtree.</para>
</entry><entry><para>Disconnect a USB device subtree, which is the hierarchy (or tree) of
devices below a hub.</para>
</entry><entry><para><olink targetptr="devusbtasks-112" remap="internal">How to Logically Disconnect a USB
Device Subtree</olink></para>
</entry>
</row><row><entry><para>Reset a USB device.</para>
</entry><entry><para>Reset a USB device to logically remove and re-create the device.</para>
</entry><entry><para><olink targetptr="devusbtasks-115" remap="internal">How to Reset a USB Device</olink></para>
</entry>
</row><row><entry><para>Change the default configuration of a multi-configuration USB device.</para>
</entry><entry><para>Change the default configuration of a multi-configuration USB device.</para>
</entry><entry><para><olink targetptr="devusbtasks-51" remap="internal">How to Change the Default Configuration
of a Multi-Configuration USB Device</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><sect2 id="devusbtasks-94"><title>Hot-Plugging USB Devices With the <command>cfgadm</command> Command</title><para>You can add and remove a USB device from a running system without using
the <command>cfgadm</command> command. However, a USB device can also be <emphasis>logically</emphasis> hot-plugged without physically removing the device. This
scenario is convenient when you are working remotely and you need to  disable
or reset a non functioning USB device. The <command>cfgadm</command> command
also provides a way to display the USB device tree, including manufacturer
and product information.</para><para>The <command>cfgadm</command> command displays information about <emphasis>attachment</emphasis> <emphasis>points</emphasis>, which are locations in
the system where dynamic reconfiguration operations can occur. An attachment
point consists of the following:</para><itemizedlist><listitem><para>An occupant, which represents a hardware resource, such as
a USB device, that might be configured into the system</para>
</listitem><listitem><para>A receptacle, which is the location that accepts the occupant,
such as a USB port</para>
</listitem>
</itemizedlist><para>Attachment points are represented by logical and physical attachment
point IDs (<literal>Ap_Id</literal>s). The physical <literal>Ap_Id</literal> is
the physical path name of the attachment point. The logical <literal>Ap_Id</literal> is
a user-friendly alternative for the physical <literal>Ap_Id</literal>. For
more information on <literal>Ap_Id</literal>s, see <olink targetdoc="refman1m" targetptr="cfgadm-usb-1m" remap="external"><citerefentry><refentrytitle>cfgadm_usb</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><para>The <command>cfgadm</command> command provides the following USB device
status information.</para><informaltable frame="topbot"><tgroup cols="2" colsep="0" rowsep="0"><colspec colwidth="50*"/><colspec colwidth="50*"/><thead><row rowsep="1"><entry><para>Receptacle State</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para><literal>empty</literal>/<literal>unconfigured</literal></para>
</entry><entry><para>The device is not physically connected.</para>
</entry>
</row><row><entry><para><literal>disconnected</literal>/<literal>unconfigured</literal></para>
</entry><entry><para>The device is logically disconnected and unavailable, even though the
device could still be physically connected.</para>
</entry>
</row><row><entry><para><literal>connected</literal>/<literal>unconfigured</literal></para>
</entry><entry><para>The device is logically connected, but unavailable. The device is visible
in <command>prtconf</command> output.</para>
</entry>
</row><row><entry><para><literal>connected</literal>/<literal>configured</literal></para>
</entry><entry><para>The device is connected and available.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>The following sections describe how to hot-plug a USB device through
the software with the <command>cfgadm</command> command. All of the sample
USB device information in these sections has been truncated to focus on relevant
information.</para>
</sect2><task id="eyhvx"><title>How to Display USB Bus Information (<command>cfgadm</command>)</title><tasksummary><para>For examples of using the <command>prtconf</command> command to display
USB configuration information, see <olink targetptr="eyhux" remap="internal">How to Display
USB Device Information</olink>.</para>
</tasksummary><procedure><step><para>Display USB bus information.</para><para>For example:</para><screen>% <userinput>cfgadm</userinput>
Ap_Id                    Type         Receptacle   Occupant     Condition
usb0/4.5                 usb-hub      connected    configured   ok
usb0/4.5.1               usb-device   connected    configured   ok
usb0/4.5.2               usb-printer  connected    configured   ok
usb0/4.5.3               usb-mouse    connected    configured   ok
usb0/4.5.4               usb-device   connected    configured   ok
usb0/4.5.5               usb-storage  connected    configured   ok
usb0/4.5.6               usb-communi  connected    configured   ok
usb0/4.5.7               unknown      empty        unconfigured ok</screen><para>In the preceding example, <literal>usb0/4.5.1</literal> identifies a
device connected to port 1 of the second-level external hub, which is connected
to port 5 of first-level external hub, which is connected to the first USB
controller's root hub, port 4.</para>
</step><step><para>Display specific USB device information.</para><para>For example:</para><screen>% <userinput>cfgadm -l -s "cols=ap_id:info"</userinput>
Ap_Id       Information
 usb0/4.5.1  Mfg: Inside Out Networks Product: Edgeport/421 NConfigs: 1 
Config: 0  : ...
 usb0/4.5.2  Mfg: &lt;undef> Product: &lt;undef>   NConfigs: 1 Config: 0 ...
 usb0/4.5.3  Mfg: Mitsumi Product: Apple USB Mouse NConfigs: 1
Config: 0 ...
 usb0/4.5.4  Mfg: NMB  Product: NMB USB KB/PS2 M NConfigs: 1 Config: 0
 usb0/4.5.5  Mfg: Hagiwara Sys-Com  Product: SmartMedia R/W  NConfigs: 1 
Config: 0 : ...
 usb0/4.5.6  Mfg: 3Com Inc.  Product: U.S.Robotics 56000 Voice USB Modem 
NConfigs: 2 ...
 usb0/4.5.7</screen>
</step>
</procedure>
</task><task id="devusbtasks-96"><title>How to Unconfigure a USB Device</title><tasksummary><para>You can unconfigure a USB device that is still physically connected
to the system. However, a driver will never attach to the device. Note that
a USB device remains in the <command>prtconf</command> output even after that
device is unconfigured.</para>
</tasksummary><procedure><step><para>Become superuser.</para>
</step><step id="devusbtasks-step-98"><para>Unconfigure the USB device.</para><para>For example:</para><screen># <userinput>cfgadm -c unconfigure usb0/4.7</userinput>
Unconfigure the device: /devices/pci@8,700000/usb@5,3/hub@4:4.7
This operation will suspend activity on the USB device
Continue (yes/no)? <userinput>y</userinput></screen>
</step><step id="devusbtasks-step-99"><para>Verify that the device is unconfigured.</para><para>For example:</para><screen># <userinput>cfgadm</userinput>  
Ap_Id                    Type         Receptacle   Occupant     Condition
usb0/4.5                 usb-hub      connected    configured   ok
usb0/4.5.1               usb-device   connected    configured   ok
usb0/4.5.2               usb-printer  connected    configured   ok
usb0/4.5.3               usb-mouse    connected    configured   ok
usb0/4.5.4               usb-device   connected    configured   ok
usb0/4.5.5               usb-storage  connected    configured   ok
usb0/4.5.6               usb-communi  connected    configured   ok
usb0/4.5.7               unknown      empty        unconfigured ok
usb0/4.6                 usb-storage  connected    configured   ok
usb0/4.7                 usb-storage  connected    unconfigured ok</screen>
</step>
</procedure>
</task><task id="devusbtasks-100"><title>How to Configure a USB Device</title><procedure><step><para>Become superuser.</para>
</step><step id="devusbtasks-step-102"><para>Configure a USB device.</para><para>For example:</para><screen># <userinput>cfgadm -c configure usb0/4.7</userinput> </screen>
</step><step id="devusbtasks-step-103"><para>Verify that the USB device is configured.</para><para>For example:</para><screen># <userinput>cfgadm usb0/4.7</userinput>
Ap_Id                  Type         Receptacle  Occupant    Condition
usb0/4.7               usb-storage  connected   configured  ok</screen>
</step>
</procedure>
</task><task id="devusbtasks-104"><title>How to Logically Disconnect a USB Device</title><tasksummary><para>If you want to remove a USB device from the system and the <command>prtconf</command> output, but you are not physically near the system, just logically
disconnect the USB device. The device is still physically connected. However,
the device is logically disconnected, unusable, and not visible to the system.</para>
</tasksummary><procedure><step><para>Become superuser.</para>
</step><step id="devusbtasks-step-106"><para>Disconnect a USB device.</para><para>For example:</para><screen># <userinput>cfgadm -c disconnect -y usb0/4.7</userinput></screen>
</step><step id="devusbtasks-step-107"><para>Verify that the device is disconnected.</para><para>For example:</para><screen># <userinput>cfgadm usb0/4.7</userinput>
Ap_Id                  Type      Receptacle    Occupant      Condition
usb0/4.7               unknown   disconnected  unconfigured  ok</screen>
</step>
</procedure>
</task><task id="devusbtasks-108"><title>How to Logically Connect a USB Device</title><tasksummary><para>Use this procedure to logically connect a USB device that was previously
logically disconnected or unconfigured.</para>
</tasksummary><procedure><step><para>Become superuser.</para>
</step><step id="devusbtasks-step-110"><para>Connect a USB device.</para><para>For
example:</para><screen># <userinput>cfgadm -c configure usb0/4.7</userinput></screen>
</step><step id="devusbtasks-step-111"><para>Verify that the device is connected.</para><para>For example:</para><screen># <userinput>cfgadm usb0/4.7</userinput>
Ap_Id                  Type         Receptacle  Occupant    Condition
usb0/4.7               usb-storage  connected   configured  ok</screen><para>The device is now available and visible to the system.</para>
</step>
</procedure>
</task><task id="devusbtasks-112"><title>How to Logically Disconnect a USB Device
Subtree</title><tasksummary><para>Use this procedure to disconnect a USB device subtree, which is the
hierarchy (or tree) of devices below a hub.</para>
</tasksummary><procedure><step><para>Become superuser.</para>
</step><step><para>Remove a USB device subtree.</para><para>For example:</para><screen># <userinput>cfgadm -c disconnect -y usb0/4</userinput></screen>
</step><step id="devusbtasks-step-114"><para>Verify that the USB device subtree is
disconnected.</para><para>For example:</para><screen># <userinput>cfgadm usb0/4</userinput>
Ap_Id                  Type       Receptacle   Occupant     Condition
usb0/4                 unknown    disconnected unconfigured ok</screen>
</step>
</procedure>
</task><task id="devusbtasks-115"><title>How to Reset a USB Device</title><tasksummary><para>If a USB device behaves erratically, use the <command>cfgadm</command> command
to reset the device, which logically removes and re-creates the device.</para>
</tasksummary><procedure><step><para>Become superuser.</para>
</step><step id="devusbtasks-step-118"><para>Make sure that the device is not in
use.</para>
</step><step id="devusbtasks-step-117"><para>Reset the device.</para><para>For example:</para><screen># <userinput>cfgadm -x usb_reset -y usb0/4.7</userinput></screen>
</step><step id="devusbtasks-step-119"><para>Verify that the device is connected.</para><para>For example:</para><screen># <userinput>cfgadm usb0/4.7</userinput>
Ap_Id                  Type         Receptacle   Occupant     Condition
usb0/4.7               usb-storage  connected    configured   ok</screen>
</step>
</procedure>
</task><task id="devusbtasks-51"><title>How to Change the Default Configuration of
a Multi-Configuration USB Device</title><tasksummary><para>Keep the following in mind when working with multi-configuration USB
devices:</para><itemizedlist><listitem><para>A USB device configuration defines how a device presents itself
to the operating system.  This method is different from system device configurations
discussed in other <command>cfgadm</command> sections.</para>
</listitem><listitem><para>Some USB devices support multiple configurations, but only
one configuration can be active at a time.</para>
</listitem><listitem><para>Multi-configuration devices can be identified by examining
the <command>cfgadm</command> <option>lv</option> output.  <literal>Nconfigs</literal> will
be greater than 1.</para>
</listitem><listitem><para>The default USB configuration is configuration 1.  The current
configuration is reflected in <command>cfgadm</command> <option>lv</option> output
as <literal>Config</literal>.</para>
</listitem><listitem><para>Changes to the default configuration persist across reboots,
hot-removes, and the reconfiguration of the device, as long as the device
is reconnected to the same port.</para>
</listitem>
</itemizedlist>
</tasksummary><procedure><step><para>Make sure that the device is not in use.</para>
</step><step id="devusbtasks-step-64"><para>Change the default USB configuration.</para><para>For example:</para><screen># <userinput>cfgadm -x usb_config -o config=2 usb0/4</userinput>
   Setting the device: /devices/pci@1f,0/usb@c,3:4
   to USB configuration 2
   This operation will suspend activity on the USB device
   Continue (yes/no)? <userinput>yes</userinput></screen>
</step><step id="devusbtasks-step-38"><para>Verify that the device changed.</para><para>For example:</para><screen># <userinput>cfgadm -lv usb0/4</userinput>
Ap_Id  Receptacle   Occupant     Condition  Information When  Type    
     Busy     Phys_Id
usb0/4 connected    unconfigured ok         Mfg: Sun  2000   
Product: USB-B0B0 aka Robotech
With 6 EPPS High Clk Mode   NConfigs: 7  Config: 2  : EVAL Board Setup  
unavailable
usb-device   n        /devices/pci@1f,0/usb@c,3:4</screen><para>Note that <literal>Config:</literal> now shows 2.</para>
</step>
</procedure>
</task>
</sect1>
</chapter>