Skip to content

Commit 812197f

Browse files
committed
Add support for automatic USB2/3 dual power switch
When compatible USB3 hub connected to USB3 upstream port, it is detected as 2 independent virtual hubs: USB2 and USB3, and USB devices will be connected to USB2 or USB3 virtual hub depending on their capabilities and connection speed. To control power for physical USB3 hubs, we must turn off/on power on both USB2 and USB3 virtual hubs for power off/on changes to take effect. Included fixes: * Enumerate all USB hubs, but mark ones we will work on with actionable flag. Because of this, increased max size of hubs array to 128 (maybe need even more?). * Moved all code that was getting hub info into get_hub_info(). * Display "power" status as first status flag if port is powered. (uhubctl is about USB port power, and we should display power as first flag). * Display "off" status for USB3 port when it is off (was "5gbps SS.Disabled"). This makes both USB2 and USB3 status to display "off" consistently. * Added expert option --exact which disables USB3 duality handling. * Added small wait (150ms) after turning off USB3 port. It seems that USB3 reacts slowly to power off command. Perhaps we need to implement more deterministic approach for this, e.g. keep querying new power state few times until it has finally changed. Oddly enough, power on is always instant and does not need waiting. This fixes issue #72.
1 parent 4d84b62 commit 812197f

File tree

1 file changed

+168
-93
lines changed

1 file changed

+168
-93
lines changed

0 commit comments

Comments
 (0)