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 vold features in the Solaris 10 release, see System Administration Guide: Devices and File Systems.
For information on the procedures associated with using USB devices, see the following:
For recent information about USB devices, go to the following site:
http://www.sun.com/io_technologies/usb/USB-Faq.html
For overview information about using USB devices, see Chapter 7, Using USB Devices (Overview).
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.
For information about using USB components in the Solaris OS, see About USB in the Solaris OS.
Task |
Description |
For Instructions |
---|---|---|
Use USB mass storage devices. |
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. This section also describes how to physically add or remove USB devices from your system. | |
Add USB audio devices. |
Use this task map to identify tasks associated with adding USB audio devices. | |
Add or remove USB devices to and from your system with the cfgadm command. |
You can logically add or remove USB devices to and from your system with the cfgadm command. |
Task |
Description |
For Instructions |
---|---|---|
Add or remove a USB mass storage device. |
Select one of the following to add a USB mass storage device: |
|
Add a USB mass storage device. | ||
|
Add a USB camera to access digital images. | |
Remove a USB mass storage device . | ||
Add a non-compliant USB mass storage device. |
Add a non-compliant USB mass storage device by adding an entry to scsa2usb.conf. | |
Prepare to use a USB mass storage device. |
Prepare to use a USB mass storage device. | |
Display USB device information. |
Display information about USB devices. | |
Create a file system on a USB mass storage device. |
You must create a file system on a device before you can put data on it. | |
Modify partitions and create a file system on a USB mass storage device. |
You might need to modify existing partitions before creating file systems on a USB mass storage device. |
How to Modify Partitions and Create a PCFS File System on a USB Mass Storage Device |
Create a Solaris partition and modify the slices on a USB mass storage device. |
You will need to create a file with slice information before using the rmformat to modify the slice information. |
How to Create a Solaris Partition and Modify the Slices on a USB Mass Storage Device |
Mount a USB mass storage device. |
Mount a USB mass storage device. | |
(Optional) Disable a USB device driver. |
Disable a USB device driver if you do not want USB support on your system. | |
(Optional) Remove unused USB device links. |
Remove USB device links with the devfsadm command. |
Starting in the Solaris 9 release, the following USB removable mass storage devices are supported:
CD-RWs
Hard disks
DVDs
Digital cameras
Diskette devices
SmartMedia and CompactFlash devices
For information about using USB mass storage devices with the Solaris ZFS file system, see What's New in USB Devices?
For a complete list of USB devices that are supported in the Solaris OS, see:
http://www.sun.com/io_technologies/USB.html
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 USB and 1394 (FireWire) Support Enhancements.
Starting in the Solaris Express 6/05 release, a hot-pluggable device is automatically mounted. For more information, see vold Provides Awareness of Hot-Plugged USB Devices.
USB storage devices with standard MS-DOS or Windows (FAT) file systems are supported.
You can use the user-friendly rmformat command to create slices. You can also use the fdisk command to partition a USB device, but never use the format utility or the rmformat -F command to physically format a USB drive.
Use the rmformat command to display all USB devices with media inserted. For example, see How to Display USB Device Information.
Non-root users can now access USB storage devices, since the mount command is no longer needed. The device is automatically mounted and is available under the /media directory. If a new device is connected while the system is down, do a reconfiguration boot with the boot -r command so that the device is recognized.
These devices can be managed with or without removable media services.
Disks with FAT file systems can be mounted and accessed. For example:
mount -F pcfs /dev/dsk/c2t0d0s0:c /mnt |
All USB storage devices are now power managed, except for those that support LOG SENSE pages. Devices with LOG SENSE pages are usually SCSI drives connected through a USB-to-SCSI bridge device.
Applications might work differently with USB mass storage devices. Keep the following issues in mind when using applications with USB storage devices:
Applications might make incorrect assumptions about the size of the media since only smaller devices like diskettes were removable previously.
Requests by applications to eject media on devices where this would be inapplicable, such as a hard drive, will succeed and do nothing.
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 /kernel/drv/scsa2usb.conf file.
For more information on using USB mass storage devices, see scsa2usb(7D).
USB diskette devices appear as removable media devices. USB diskette devices are not managed by the fd (floppy) driver. Applications that issue ioctl(2) calls intended for the fd (native floppy) driver will fail. Applications that issue only read(2) and write(2) calls will succeed. Other applications, such as SunPCI and rmformat, also succeed.
The USB diskette device is identified as a SCSI removable media device. The device is available for access under the /media directory.
For more information on how to use USB diskette devices, see Chapter 1, Managing Removable Media (Overview).
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 scsa2usb.conf 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.
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 /kernel/drv/scsa2usb.conf file to see if there is a matching, commented entry for this device. Follow the information given in the scsa2usb.conf file to see if a particular device can be supported by using the override information.
For a listing of recommended USB mass storage devices, go to:
http://www.sun.com/io_technologies/USB.html
For more information, see scsa2usb(7D).
Become superuser.
Add an entry to the /kernel/drv/scsa2usb.conf file.
The following entry is appropriate for a USB memory stick.
attribute-override-list = "vid=* reduced-cmd-support=true"; |
Either reboot the system or do the following:
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.
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.
Make sure that removable media services are running.
# svcs hal dbus rmvolmgr 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 |
The file system can be mounted from the device if it is valid and it is recognized.
If the file system on the device is not automatically mounted, try a manual mount.
Before hot-removing the device, find the name of the device in the eject -l 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.
When you hot-plug a USB device, the device is immediately seen in the system's device hierarchy, as displayed in the prtconf command output. When you remove a USB device, the device is removed from the system's device hierarchy, unless you are using the device.
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.
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.
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.
Connect the USB mass storage device.
Verify that the USB device has been added.
For example:
$ 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: <None> Access permissions: Medium is not write protected. |
Verify that the device is automatically mounted under the /media directory.
For example:
$ ls /media/NONAME aa bb |
You can also use the rmmount -l command to list the paths and nicknames of mountable devices. If the device has been mounted under the /media directory, you will see output similar to the following:
$ rmmount -l /dev/dsk/c3t0d0p0:1 rmdisk0,NONAME,/media/NONAME |
If the camera's media uses a PCFS file system, it will be automatically mounted. If the device does not bind to the scsa2usb driver, use libusb applications for transferring the pictures. For more information, refer to /usr/sfw/share/doc/libusb/libusb.txt.
Become superuser.
Plug in and turn on the USB camera.
The system creates a logical device for the camera. After the camera is plugged in, output is written to the /var/adm/messages file to acknowledge the device's connection. The system treats the camera as a storage device.
Examine the output that is written to the /var/adm/messages file.
# more /var/adm/messages |
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:
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 |
Match the device with a mountable /dev/dsk link entry, by doing the following:
# ls -l /dev/dsk/c*0 | grep /pci@0,0/pci925,1234@7,2/storage@2 lrwxrwxrwx 1 root root 58 Jun 30 2004 c3t0d0p0 -> ../../devices/pci@0,0/pci925,1234@7,2/storage@2/disk@0,0:a |
Mount the USB camera file system.
The camera's file system is most likely a PCFS file system. If file system is PCFS, then it should be automatically mounted.
To manually mount the file system on an x86 system, you would use syntax similar to the following:
# mount -F pcfs /dev/dsk/c3t0d0p0:c /mnt |
To manually mount the file system on a SPARC system, you would use syntax similar to the following:
# mount -F pcfs /dev/dsk/c3t0d0s0:c /mnt |
For information on mounting file systems, see Chapter 19, Mounting and Unmounting File Systems (Tasks).
For information on mounting different PCFS file systems, see mount_pcfs(1M).
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* |
View and manipulate the image files created by the USB camera.
For example:
# /usr/dt/bin/sdtimage P7220001.JPG & |
Unmount the file system before disconnecting the camera.
For example:
# umount /mnt |
(Optional) Turn off and disconnect the camera.
Stop any active applications that are using the device.
Unmount the device.
$ rmumount NONAME |
Or, use the umount command as superuser. For example:
# umount /media/NONAME |
For more information about unmounting a USB device, see How to Mount or Unmount a USB Mass Storage Device.
Remove the device.
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.
After the USB device is formatted, it is usually mounted under the /media/label directory.
The device nodes are created under the /dev/rdsk directory for character devices and under the /dev/dsk directory for block devices. Device links are created when the devices are hot-plugged. For more information, see scsa2usb(7D).
If the device cannot be identified by removable media services, then try to manually mount the device. First, use the rmformat command to identify the device path and then use the mount command to manually mount the device as superuser.
If a device is mounted by removable media services then you can unmount it by using the rmumount command. If the device is manually mounted, then you would unmount it using the umount command as superuser.
For more information about mounting and unmounting USB devices, see How to Mount or Unmount a USB Mass Storage Device.
Display information about USB devices.
For example, use the prtconf command to display USB device information. The prtconf output in this example has been truncated to only display USB device information.
$ prtconf 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) |
For example, use the rmformat command to display USB device information.
$ 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: <None> Access permissions: Medium is not write protected. |
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:
Do not use the rmformat -F except on a USB diskette.
If the default slices are not acceptable, use the rmformat -s command to create slices. Use the fdisk utility to partition a USB device, if needed. For step-by-step instructions, see:
How to Modify Partitions and Create a PCFS File System on a USB Mass Storage Device
How to Create a Solaris Partition and Modify the Slices on a USB Mass Storage Device
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 rmmount -l command to identify the device nickname and then the rmumount command to unmount the USB device.
Perform steps 4-5 only if you need to format a USB diskette.
Become superuser.
Add the USB device to your system. For information on hot-plugging USB devices, see:
(Optional) Identify the USB device.
For example:
# 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: <None> Access permissions: Medium is not write protected. |
In this example, the diskette device is c2t0d0p0.
Insert a diskette into the diskette drive, if necessary.
Format the diskette, if necessary.
% rmformat -F long raw-device |
For example, on a SPARC system:
% rmformat -F long /dev/rdsk/c2t0d0s2 |
For example, on an x86 system:
% rmformat -F long /dev/rdsk/c3t0d0p0 |
Determine the file system type and make sure the device is unmounted. Then, select one of the following:
For more information about unmounting a USB device, see How to Mount or Unmount a USB Mass Storage Device.
Create a PCFS file system.
# mkfs -F pcfs -o nofdisk,size=size raw-device |
Specify the -size option in 512-byte blocks.
The following example shows how to create a PCFS file system on a 1.4-Mbyte diskette on a SPARC system:
# mkfs -F pcfs /dev/rdsk/c2t0d0p0 Construct a new FAT file system on /dev/rdsk/c2t0d0p0: (y/n)? y |
The following example shows how to create a PCFS file system on a 1.4-Mbyte diskette on an x86 system:
# mkfs -F pcfs /dev/rdsk/c2t0d0s2 Construct a new FAT file system on /dev/rdsk/c2t0d0s2: (y/n)? y |
The following example shows how to create a PCFS file system on a 100-Mbyte USB memory stick on a SPARC system:
# mkfs -F pcfs /dev/rdsk/c5t0d0s2:c |
The following example shows how to create a PCFS file system on a 100-Mbyte USB memory stick on an x86 system:
# mkfs -F pcfs /dev/rdsk/c5t0d0p0:c |
This command can take several minutes to complete.
Create a UFS file system.
# newfs raw-device |
For example:
# newfs /dev/rdsk/c4t0d0s7 |
Consider using the newfs -f 4096 option or newfs -T option for large USB hard disks.
UFS file system overhead consumes a significant portion of space on a diskette, due to a diskette's limited storage capacity.
See the next two procedures for a detailed example of creating a PCFS file system and modifying slices on a USB mass storage device.
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.
Become superuser.
Start the fdisk utility.
For example:
# fdisk /dev/rdsk/c3t0d0p0 |
Delete the partition by selecting option 3.
For example:
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: 3 |
Choose the partition number to delete.
For example:
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): 1 Partition deleted. |
Create a partition.
For example:
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: 1 |
Select the FAT32 partition type.
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? c |
Specify the percentage of disk to use for this partition.
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). 100 |
Select whether the new partition should be the active partition or an inactive partition.
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". n |
Update the disk configuration and exit.
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: 5 |
Create the PCFS file system on this partition.
Make sure the device is unmounted before creating the new file system. For more information about unmounting a USB device, see How to Mount or Unmount a USB Mass Storage Device.
For example:
# mkfs -F pcfs -o fat=32 /dev/rdsk/c3t0d0p0:c Construct a new FAT file system on /dev/rdsk/c3t0d0p0:c: (y/n)? y |
The following steps illustrate how to create a Solaris partition and modify the slices.
Make sure you back up any data before you perform this task.
Become superuser.
Start the fdisk utility.
For example:
# fdisk /dev/rdsk/c5t0d0s2 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. y |
Display the current slices.
For example:
# prtvtoc /dev/rdsk/c5t0d0s2 * /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 |
Create a text file with the slice information.
For example:
slices: 0 = 0, 5GB, "wm", "home" : 1 = 8225280000, 6GB : 2 = 0, 44GB, "wm", "backup" : 6 = 16450560000, 15GB |
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.
For more information, see the -s option description in rmformat(1).
Create the slices by including the slice file created above.
For example:
# rmformat -s slice_file /dev/rdsk/c5t0d0s2 |
View the new slice information.
For example:
# prtvtoc /dev/rdsk/c5t0d0s2 * /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 |
The following steps illustrate how to mount and unmount a USB mass storage device.
(Optional) Identify the device.
For example:
$ 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: <None> Access permissions: Medium is not write protected. |
In this example, the physical diskette device is c2t0d0p0.
Or, identify the nickname for the device. For example:
$ rmmount -l /dev/dsk/c2t0d0p0 floppy,floppy0,fd,fd0,diskette,diskette0,rdiskette,rdiskette0 |
Select one of the following to mount or unmount a USB mass storage device:
Mount a USB mass storage device as a console user.
You can use the rmmount command with device nicknames, mount points, or device paths, similar to the following:
$ rmmount rmdisk0 $ rmmount NONAME $ rmmount /dev/dsk/c3t0d0p0:1 |
For example:
$ rmmount NONAME NONAME /dev/dsk/c2t0d0p0 mounted $ ls /media/NONAME AA.TXT |
Unmount a USB mass storage device as a console user.
For example:
$ rmumount NONAME NONAME /dev/dsk/c2t0d0p0 unmounted |
Mount a USB mass storage device as superuser.
This example shows how to mount a device with a UFS file system:
# mount /dev/dsk/c1t0d0s2 /mnt |
This example shows how to mount a device with a PCFS file system on a SPARC system:
# mount -F pcfs /dev/dsk/c3t0d0s2:c /mnt |
This example shows how to mount a device with a PCFS file system on an x86 system:
# mount -F pcfs /dev/dsk/c3t0d0p0:c /mnt |
This example shows how to mount a CD with a read-only HSFS file system:
# mount -F hsfs -o ro /dev/dsk/c1t0d0s2 /mnt |
Unmount a USB mass storage device as superuser.
First, be sure no one is using the file system on the device.
For example:
# fuser -c -u /mnt # umount /mnt |
Eject the device, which is optional for DVD, CD, or diskette devices.
For example:
# eject /dev/rdsk/c1t0d0s2 |
Keep the following tips in mind if you have problems adding or removing a USB mass storage device.
Check the /var/adm/messages 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.
If USB devices are added or removed when the system is down, you must perform a reconfiguration boot.
ok boot -r |
If you have problems accessing a device that was connected while the system is running, try the following command:
# devfsadm |
Do not move devices around if the system has been powered down by a suspend operation. For more information, see SPARC: USB Power Management.
If a device has been hot removed while in use by applications and is no longer available, then stop the applications. Use the prtconf command to see whether the device node has been removed.
You can disable specific types of USB devices by disabling their client driver. For example, USB printers can be disabled by disabling the usbprn driver that directs them. Disabling usbprn does not affect other kinds of devices, such as USB storage devices.
The following table identifies some USB device types and their corresponding drivers.
Device Type |
Driver to Disable |
---|---|
Audio |
usb_ac and usb_as |
HID (usually keyboard and mouse) |
hid |
Storage |
scsa2usb |
Printer |
usbprn |
Serial |
usbser_edge |
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:
usba10: WARNING: usba: no driver found for device name |
Become superuser.
Exclude the driver alias entry from the /etc/system file.
For example, include the following exclude statement to exclude the usbprn driver.
exclude: usbprn |
Reboot the system.
# init 6 |
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.
Become superuser.
Close all applications that might be accessing the device.
Remove the unused links for a specific USB class.
For example:
# devfsadm -C -c audio |
Or, just remove the dangling links:
# devfsadm -C |
Task |
Description |
For Instructions |
---|---|---|
Add USB audio devices. |
Add a USB microphone and speakers. | |
Identify your system's primary audio device. |
Identify which audio device is your primary audio device. | |
Change the primary USB audio device. |
You might want to make one audio device the primary audio device if you remove or change your USB audio devices. | |
Remove unused USB device links. |
If you remove a USB audio device while the system is powered off, the /dev/audio device might be pointing to a /dev/sound/* device that doesn't exist. | |
Solve USB audio problems. |
Use this section if no sound comes from the USB speakers. |
For information about USB audio support in specific Solaris releases, see Solaris Support for USB Devices.
This Solaris release provides USB audio support that is implemented by a pair of cooperating drivers, usb_ac and usb_as. The audio control driver, usb_ac, is a Solaris USB Architecture compliant client driver that provides the controlling interface to user applications. The audio streaming driver, usb_as, processes audio data messages during play and record. It sets sample frequency and precision, and encodes requests from the usb_ac driver. Both drivers comply with the USB audio class 1.0 specification.
Some audio devices can set volume under software control. A STREAMS module, usb_ah, is pushed on top of the HID driver for managing this function.
Solaris supports USB audio devices that are play-only, record-only, or record and play. Hot-plugging of USB audio devices is supported.
USB audio devices are supported on SPARC UltraTM and x86 platforms that have USB connectors.
USB audio devices that are supported in the Solaris 8 10/01, Solaris 8 2/02, or Solaris 9 releases must support a fixed 44100 or 48000 Hz sampling frequency to play or record. The 44100 Hz or 48000 Hz sampling frequency is no longer required in the Solaris 10 release.
For fully supported audio data format information, see usb_ac(7D).
The primary audio device is /dev/audio. You can verify that /dev/audio is pointing to USB audio by using the following command:
% mixerctl Device /dev/audioctl: Name = USB Audio Version = 1.0 Config = external Audio mixer for /dev/audioctl is enabled |
After you connect your USB audio devices, you access them with the audioplay and audiorecord command through the /dev/sound/N device links.
Note that the /dev/audio and /dev/sound/N devices can refer to speakers, microphones, or combination devices. If you refer to the incorrect device type, the command fails. For example, the audioplay command fails if you try to use it with a microphone.
You can select a specific default audio device for most Sun audio applications, such as audioplay and audiorecord, by setting the AUDIODEV shell variable or by specifying the -d option for these commands. However, setting AUDIODEV does not work for third-party applications that have /dev/audio hardcoded as the audio file.
When you plug in a USB audio device, it automatically becomes the primary audio device, /dev/audio, unless /dev/audio is in use. For instructions on changing /dev/audio from on-board audio to USB audio and vice versa, refer to How to Change the Primary USB Audio Device, and usb_ac(7D).
If a USB audio device is plugged into a system, it becomes the primary audio device, /dev/audio. It remains the primary audio device even after the system is rebooted. If additional USB audio devices are plugged in, the last one becomes the primary audio device.
For additional information on troubleshooting USB audio device problems, see usb_ac(7D).
The primary audio device, /dev/audio, points to the USB speaker.
% ls -l /dev/audio lrwxrwxrwx 1 root root 10 Feb 13 08:46 /dev/audio -> usb/audio0 |
(Optional) Remove the speaker. Then, plug it back in.
If you remove the speaker, the /dev/audio device reverts back to on-board audio.
% ls -l /dev/audio lrwxrwxrwx 1 root root 7 Feb 13 08:47 /dev/audio -> sound/0 |
Add a USB microphone.
% ls -l /dev/audio lrwxrwxrwx 1 root root 10 Feb 13 08:54 /dev/audio -> usb/audio1 |
This procedure assumes that you have already connected the USB audio devices.
Examine your system's new audio links.
Display your system's new audio links with the ls command.
For example:
% ls -lt /dev/audio* lrwxrwxrwx 1 root root 7 Jul 23 15:46 /dev/audio -> usb/audio0 lrwxrwxrwx 1 root root 10 Jul 23 15:46 /dev/audioctl -> usb/audioctl0/ % ls -lt /dev/sound/* lrwxrwxrwx 1 root root 74 Jul 23 15:46 /dev/sound/1 -> ../../devices/pci@1f,4000/usb@5/hub@1/device@3/sound-control@0:... lrwxrwxrwx 1 root root 77 Jul 23 15:46 /dev/sound/1ctl -> ../../devices/pci@1f,4000/usb@5/hub@1/device@3/sound-control@0:... lrwxrwxrwx 1 root other 66 Jul 23 14:21 /dev/sound/0 -> ../../devices/pci@1f,4000/ebus@1/SUNW,CS4231@14,200000:sound,audio lrwxrwxrwx 1 root other 69 Jul 23 14:21 /dev/sound/0ctl -> ../../devices/pci@1f,4000/ebus@1/SUNW,CS4231@14,200000:sound,audioctl % |
Notice that the primary audio device, /dev/audio, is pointing to the newly plugged in USB audio device, /dev/usb/audio0.
You can also examine your system's USB audio devices with the prtconf command and look for the USB device information.
% prtconf . . . usb, instance #0 hub, instance #0 mouse, instance #0 keyboard, instance #1 device, instance #0 sound-control, instance #0 sound, instance #0 input, instance #0 . . . |
Select one of the following to change the primary USB audio device.
If you want the on-board audio device to become the primary audio device, remove the USB audio devices. The /dev/audio link then points to the /dev/sound/0 entry. If the /dev/sound/0 entry is not the primary audio device, then either shut down the system and use the boot -r command, or run the devfsadm -i command as root.
If you want the USB audio device to become primary audio device, just plug it in and check the device links.
Sometimes, USB speakers do not produce any sound, even though the driver is attached and the volume is set to high. Hot-plugging the device might not change this behavior.
The workaround is to power cycle the USB speakers.
Keep the following key points of audio device ownership in mind when working with audio devices:
When you plug in a USB audio device and you are logged in on the console, the console is the owner of the /dev/* entries. This situation means you can use the audio device as long as you are logged in to the console.
If you are not logged in to the console when you plug in a USB audio device, root becomes the owner of the device. However, if you log in to the console and attempt to access the USB audio device, device ownership changes to the console. For more information, see logindevperm(4).
When you remotely log in with the rlogin command and attempt to access the USB audio device, the ownership does not change. This means that, for example, unauthorized users cannot listen to conversations over a microphone owned by someone else.
Task |
Description |
For Instructions |
---|---|---|
Display USB bus information. |
Display information about USB devices and buses. | |
Unconfigure a USB device. |
Logically unconfigure a USB device that is still physically connected to the system. | |
Configure a USB device. |
Configure a USB device that was previously unconfigured. | |
Logically disconnect a USB device. |
You can logically disconnect a USB device if you are not physically near the system. | |
Logically connect a USB device. |
Logically connect a USB device that was previously logically disconnected or unconfigured. | |
Disconnect a USB device subtree. |
Disconnect a USB device subtree, which is the hierarchy (or tree) of devices below a hub. | |
Reset a USB device. |
Reset a USB device to logically remove and re-create the device. | |
Change the default configuration of a multi-configuration USB device. |
Change the default configuration of a multi-configuration USB device. |
How to Change the Default Configuration of a Multi-Configuration USB Device |
You can add and remove a USB device from a running system without using the cfgadm command. However, a USB device can also be logically 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 cfgadm command also provides a way to display the USB device tree, including manufacturer and product information.
The cfgadm command displays information about attachment points, which are locations in the system where dynamic reconfiguration operations can occur. An attachment point consists of the following:
An occupant, which represents a hardware resource, such as a USB device, that might be configured into the system
A receptacle, which is the location that accepts the occupant, such as a USB port
Attachment points are represented by logical and physical attachment point IDs (Ap_Ids). The physical Ap_Id is the physical path name of the attachment point. The logical Ap_Id is a user-friendly alternative for the physical Ap_Id. For more information on Ap_Ids, see cfgadm_usb(1M).
The cfgadm command provides the following USB device status information.
Receptacle State |
Description |
---|---|
empty/unconfigured |
The device is not physically connected. |
disconnected/unconfigured |
The device is logically disconnected and unavailable, even though the device could still be physically connected. |
connected/unconfigured |
The device is logically connected, but unavailable. The device is visible in prtconf output. |
connected/configured |
The device is connected and available. |
The following sections describe how to hot-plug a USB device through the software with the cfgadm command. All of the sample USB device information in these sections has been truncated to focus on relevant information.
For examples of using the prtconf command to display USB configuration information, see How to Display USB Device Information.
For example:
% cfgadm 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 |
In the preceding example, usb0/4.5.1 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.
Display specific USB device information.
For example:
% cfgadm -l -s "cols=ap_id:info" Ap_Id Information usb0/4.5.1 Mfg: Inside Out Networks Product: Edgeport/421 NConfigs: 1 Config: 0 : ... usb0/4.5.2 Mfg: <undef> Product: <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 |
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 prtconf output even after that device is unconfigured.
Become superuser.
For example:
# cfgadm -c unconfigure usb0/4.7 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)? y |
Verify that the device is unconfigured.
For example:
# cfgadm 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 |
Become superuser.
For example:
# cfgadm -c configure usb0/4.7 |
Verify that the USB device is configured.
For example:
# cfgadm usb0/4.7 Ap_Id Type Receptacle Occupant Condition usb0/4.7 usb-storage connected configured ok |
If you want to remove a USB device from the system and the prtconf 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.
Become superuser.
For example:
# cfgadm -c disconnect -y usb0/4.7 |
Verify that the device is disconnected.
For example:
# cfgadm usb0/4.7 Ap_Id Type Receptacle Occupant Condition usb0/4.7 unknown disconnected unconfigured ok |
Use this procedure to logically connect a USB device that was previously logically disconnected or unconfigured.
Become superuser.
For example:
# cfgadm -c configure usb0/4.7 |
Verify that the device is connected.
For example:
# cfgadm usb0/4.7 Ap_Id Type Receptacle Occupant Condition usb0/4.7 usb-storage connected configured ok |
The device is now available and visible to the system.
Use this procedure to disconnect a USB device subtree, which is the hierarchy (or tree) of devices below a hub.
Become superuser.
For example:
# cfgadm -c disconnect -y usb0/4 |
Verify that the USB device subtree is disconnected.
For example:
# cfgadm usb0/4 Ap_Id Type Receptacle Occupant Condition usb0/4 unknown disconnected unconfigured ok |
If a USB device behaves erratically, use the cfgadm command to reset the device, which logically removes and re-creates the device.
Become superuser.
Reset the device.
For example:
# cfgadm -x usb_reset -y usb0/4.7 |
Verify that the device is connected.
For example:
# cfgadm usb0/4.7 Ap_Id Type Receptacle Occupant Condition usb0/4.7 usb-storage connected configured ok |
Keep the following in mind when working with multi-configuration USB devices:
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 cfgadm sections.
Some USB devices support multiple configurations, but only one configuration can be active at a time.
Multi-configuration devices can be identified by examining the cfgadm -lv output. Nconfigs will be greater than 1.
The default USB configuration is configuration 1. The current configuration is reflected in cfgadm -lv output as Config.
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.
Make sure that the device is not in use.
Change the default USB configuration.
For example:
# cfgadm -x usb_config -o config=2 usb0/4 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)? yes |
Verify that the device changed.
For example:
# cfgadm -lv usb0/4 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 |
Note that Config: now shows 2.