Interface UsbDevice
- All Superinterfaces:
Comparable<UsbDevice>
- All Known Implementing Classes:
AbstractUsbDevice, AixUsbDevice, FreeBsdUsbDevice, LinuxUsbDevice, LinuxUsbDeviceNF, MacUsbDevice, NetBsdUsbDevice, OpenBsdUsbDevice, SolarisUsbDevice
A USB device is a device connected via a USB port, possibly internally/permanently. Hubs may contain ports to which
other devices connect in a recursive fashion.
USB devices form a tree structure rooted at one or more host controllers. Each device may be a hub with child devices
accessible via getConnectedDevices(). To traverse the full USB tree:
for (UsbDevice device : hal.getUsbDevices(true)) {
printDevice(device, 0);
}
void printDevice(UsbDevice device, int indent) {
String prefix = " ".repeat(indent);
System.out.printf("%s%s (vendor=%s)%n", prefix, device.getName(), device.getVendor());
for (UsbDevice child : device.getConnectedDevices()) {
printDevice(child, indent + 2);
}
}
-
Method Summary
Modifier and TypeMethodDescriptionOther devices connected to this hubgetName()Name of the USB deviceProduct ID of the USB deviceSerial number of the USB deviceA Unique Device ID of the USB device, such as the PnPDeviceID (Windows), Device Node Path (Linux), Registry Entry ID (macOS), or Device Node number (Unix)Vendor that manufactured the USB deviceID of the vendor that manufactured the USB deviceMethods inherited from interface Comparable
compareTo
-
Method Details
-
getName
-
getVendor
-
getVendorId
String getVendorId()ID of the vendor that manufactured the USB device- Returns:
- The vendor ID, a 4-digit hex string
-
getProductId
-
getSerialNumber
-
getUniqueDeviceId
String getUniqueDeviceId()A Unique Device ID of the USB device, such as the PnPDeviceID (Windows), Device Node Path (Linux), Registry Entry ID (macOS), or Device Node number (Unix)- Returns:
- The Unique Device ID
-
getConnectedDevices
-