Managing Devices in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014
 
 

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, the cfgadm command enables you to perform logical hot-plug operations on the USB device. In logical hot-plug operations, you do not have to physically handle the device. Thus, you can remotely disable or reset a non functioning USB device without having to remove the device itself. The cfgadm command also enables you to display the USB device tree, including manufacturer and product information.

The cfgadm command works on USB devices in the same manner that it does on other hot-pluggable devices. For more conceptual and overview information about how the command works, see the relevant sections in Chapter 2, Dynamically Configuring Devices.

The following cfgadm commands apply to all devices including USB devices. See detailed information in Chapter 2, Dynamically Configuring Devices:

cfgadm -l[a]

Displays information about devices.

cfgadm -c configure device; cfgadm -c unconfigure device

Configures or unconfigures a device.

cfgadm -c connect device; cfgadm -c disconnect device

Connects or disconnects a device.

cfgadm -x usb-option device

Perform logical operations on a USB device. The command is specific to USB devices only.


Note -  The prtconf command can also display configuration information of all devices including USB devices.

The following examples show the use of the cfgadm command to perform hot-plug operations on USB devices. The sample output displays only information relevant to USB devices. The actual command output depends on the devices on your system.

Example 13-3  Displaying USB Bus Information
$ 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

Using usb0/4.5.1 as an example, you obtain the following information from the output:

  • usb0 refers to the first USB controller.

  • The 3 dot-separated numbers after the device name indicate that in addition to the root hub, the system has 2 external hubs.

    • The first number refers to port 4 of the controller's root hub.

    • The second number refers to port 5 of the first-level external hub.

    • The third number refers to port 1 of the second-level external hub.

Note that as a useful practice, you should display information about the system devices before and after the actual hot-plugging step. The information helps you in the following ways:

  • You can properly identify the bus or device to dynamically reconfigure.

  • You can verify from the state of the bus or device that the reconfiguration completed successfully.

You can also customize the specific information that you want about a USB device. The following example provides full information about the devices.

$ 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
Example 13-4  Unconfiguring a USB Device

You can unconfigure a USB device and leave it physically connected to the system. The device continues to be included in a prtconf command output. However, no driver will attach to the 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

# cfgadm -l
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 okDevice is unconfigured.
Example 13-5  Configuring a USB Device
# cfgadm -c configure usb0/4.7

# cfgadm usb0/4.7
Ap_Id                  Type         Receptacle  Occupant    Condition
usb0/4.7               usb-storage  connected   configured  ok
Example 13-6  Logically Disconnecting a USB Device

In this example, the USB device remains physically connected to the system. However, it becomes unusable after being logically disconnected. The prtconf command output will not include this device in the output.

# cfgadm -c disconnect -y usb0/4.7
# cfgadm usb0/4.7
Ap_Id                  Type      Receptacle    Occupant      Condition
usb0/4.7               unknown   disconnected  unconfigured  okThe device is disconnected and becomes unavailable.
Example 13-7  Logically Connecting a USB Device

You can connect a USB device remotely without physical access to the device. However, the device must be physically connected to the system for a logical connection to succeed.

# cfgadm -c configure usb0/4.7

# cfgadm usb0/4.7
Ap_Id                  Type         Receptacle  Occupant    Condition
usb0/4.7               usb-storage  connected   configured  okThe device is connected and becomes available.
Example 13-8  Logically Disconnecting a USB Device Subtree

In this example, the entire hierarchy of devices below the hub is removed.

# cfgadm -c disconnect -y usb0/4

# cfgadm usb0/4
Ap_Id                  Type       Receptacle   Occupant     Condition
usb0/4                 unknown    disconnected unconfigured okAll devices under port 4 of the hub are disconnected.
Example 13-9  Resetting a USB Device

Resetting a device removes and then recreates the device. You can reset a device that behaves erratically. This example assumes that the device is not in use. Resetting fails if any application is using the device.

# cfgadm -x usb_reset -y usb0/4.7

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