Power down USB ports

I am personally use this tool to power down and then turn on USB ports:

It has very short source code, the most important part is in function power_cycle(). It has the code split in two parts, one marked as “vendor command enable” (I think it powers down ports) and “vendor command disable” (I think it turns them back on). You can try to split it into two functions to turn USB ports on and off.