private static void printHubDetails(int indent, Device dev) { try { Hub h = new Hub(dev); int ports = h.getNumPorts(); indentLine(indent, (h.isRootHub() ? "Root " : "") + "Hub, " + ports + " ports"); indentLine(indent, "overcurrent protection: " + h.getOverCurrentMode()); indentLine(indent, "power switching: " + h.getPowerSwitchingMode()); if (h.isCompound()) indentLine(indent, "Part of a compound device"); // not showing POTPGT, or hub's own current draw indent -= 4; indentLine(indent, ""); for (int i = 1; i <= ports; i++) { Device child = dev.getChild(i); if (child == null) continue; indentLine(indent, "<!-- Port " + i + (h.isRemovable(i) ? "" : " is built-in.") + " -->"); printDevice(indent, child); } } catch (IOException e) { e.printStackTrace(System.out); } }