javax.usb
Interface UsbPort

All Known Implementing Classes:
UsbPortImp

public interface UsbPort

Interface for a USB port.

USB ports belong to a USB hub. In this API, they represent downstream ports. Upstream and (non-declared) internal ports are not represented in this API. Internal ports that are reported as downstream ports by the USB hub (in the USB hub descriptor) are represented.

See the USB 1.1 specification sec 11.16.

Author:
E. Michael Maximilien, Dan Streetman

Method Summary
 byte getPortNumber()
          Get the number of this port.
 UsbDevice getUsbDevice()
          Get the UsbDevice attached to this UsbPort.
 UsbHub getUsbHub()
          Get the parent UsbHub.
 boolean isUsbDeviceAttached()
          If a device is attached to this port.
 

Method Detail

getPortNumber

byte getPortNumber()
Get the number of this port.

Port numbers are 1-based, not 0-based; see the USB 1.1 specification table 11.8 offset 7. Since the number is 1-based, the first port on a hub has port number 1. There is a maximum of 255 ports on a single hub (so the maximum port number is 255).

This is actually an unsigned byte.

Returns:
The number of this port.

getUsbHub

UsbHub getUsbHub()
Get the parent UsbHub.

Returns:
The parent UsbHub.

getUsbDevice

UsbDevice getUsbDevice()
Get the UsbDevice attached to this UsbPort.

If no UsbDevice is attached, this returns null.

Returns:
The attached device, or null.

isUsbDeviceAttached

boolean isUsbDeviceAttached()
If a device is attached to this port.

Returns:
If a device is attached to this port.