Sun Microsystems Logo
Products & Services
 
Support & Training
 
 

Previous Previous     Contents     Index     Next Next

Hot-Plugging USB Devices With the cfgadm Command

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:

  • An occupant, which represents a hardware resource, such as a USB device, that might be configured into the system, and

  • 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 pathname 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.

How to Display USB Bus Information (cfgadm)

Use the cfgadm command to display USB bus 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
usb0/4.6                    usb-storage  connected    configured   ok
usb0/4.7                    usb-storage  connected    configured   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.

Use the following cfgadm command to 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
 usb0/4.6    Mfg: Iomega  Product: USB Zip 250  NConfigs: 1  Config: 0
 : Default
 usb0/4.7    Mfg: Iomega  Product: USB Zip 100  NConfigs: 1  Config: 0
 : Default

For examples of using the prtconf command to display USB configuration information, see How to Display USB Device Information (prtconf).

ProcedureHow to Unconfigure a USB Device

You can unconfigure a USB device that is still physically connected to the system, but a driver will never attach to it. Note that a USB device remains in the prtconf output even after that device is unconfigured.

  1. Become superuser.

  2. Unconfigure the USB device.

    # 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

  3. Verify that the device is unconfigured.

    # 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

ProcedureHow to Configure a USB Device

  1. Become superuser.

  2. Configure a USB device.

    # cfgadm -c configure usb0/4.7 

  3. Verify that the USB device is configured.

    # cfgadm usb0/4.7
    Ap_Id                  Type         Receptacle  Occupant    Condition
    usb0/4.7               usb-storage  connected   configured  ok

ProcedureHow to Logically Disconnect a USB Device

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, but it is logically disconnected, unusable, and not visible to the system.

  1. Become superuser.

  2. Disconnect a USB device.

    # cfgadm -c disconnect -y usb0/4.7

  3. Verify that the device is disconnected.

    # cfgadm usb0/4.7
    Ap_Id                  Type      Receptacle    Occupant      Condition
    usb0/4.7               unknown   disconnected  unconfigured  ok

Previous Previous     Contents     Index     Next Next