|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--usb.core.PortIdentifier
This class provides "stable" string identifiers for USB devices,
appropriate for use in operations and troubleshooting. The names
identify the path used to access a hub port (and hence implicitly
identify any device connected there) on a Host
.
If you control the physical cabling of a tree of USB hubs and devices, you control the devices associated with these names. If you don't rewire your USB tree, port identifiers won't change. When you do switch cables, you can figure out the new port ids by using the port numbers on your hubs (or positions, for hubs that don't label their ports).
There are three basic parts in the string representation, currently separated by single dashes (slashes are also reserved):
Bus.getBusId()
. If the port identifier only has a type
tag and bus id, it's referring to the root hub for that bus.
These names are distinct from everyday user-meaningful names. A
convenience method is provided to support simple mappings from user
assigned names to physical port identifiers, using a Dictionary.
Use Host
methods to enumerate devices which are
physically present, unaffected by all naming policies. The model
here is direct driver-level access to devices, with security policies
to be established separately.
Note that with USB 2.0 hosts, port ids change depending on what kind of device you plug into the root hub. USB 2.0 devices (high speed, 480 Mbit/s) get switched to a different controller than USB 1.1 devices (slower, at 12 Mbit/s or 1.5 Mbit/s). The identifiers are consistent and still predictable, but you know whether you're talking about a USB 2.0 device or not.
Host
Constructor Summary | |
PortIdentifier(Device dev)
Constructs an identifier for the physical location of this device, scoped to the associated host. |
|
PortIdentifier(java.lang.String path)
Constructs a port identifier using its string form. |
Method Summary | |
Device |
getDevice(Host host)
Returns the appropriate device from this host, or null if the address describes a port connection that isn't available just now. |
static Device |
lookup(Host host,
java.util.Dictionary dict,
java.lang.String name)
This maps names to devices, using a dictionary to associate user-meaningful names like ReceiptPrinter or
RedCable with port identifier strings like
usb-00:0b.0-1.3. |
java.lang.String |
toString()
Provides a printable (and restorable) form of this path, for example usb-00:0b.0-3 identifying the device on the third port on the root hub of the USB controller on PCI slot 0:0b.0. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PortIdentifier(Device dev) throws java.io.IOException
public PortIdentifier(java.lang.String path)
java.lang.IllegalArgumentException
- if the parameter isn't
a valid port identifier string.Method Detail |
public Device getDevice(Host host) throws java.io.IOException
Host.getDevice(java.lang.String)
public java.lang.String toString()
toString
in class java.lang.Object
public static Device lookup(Host host, java.util.Dictionary dict, java.lang.String name)
ReceiptPrinter
or
RedCable
with port identifier strings like
usb-00:0b.0-1.3. If the name isn't found in the
dictionary, but is a valid port identifier, then the device
at that port is returned.dict
- Maps names to port identifier stringsname
- Used as lookup key in the dict.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |