Switching off USB hub - Jetson NX

Hi there,

I have a fleet of standard Jetson NX carrier board kits with a single USB device connected to each, a Stereolabs ZED2 USB3.0 camera. These devices are remote sensors running on solar and the ZED2 uses far too much passive power for me to leave it plugged in all the time while the Jetson spends most of the time in deep sleep.

Is there any way that I can switch off & on the 5V USB output in a way that will not upset the ZED2?

After reading some ideas in other threads I have this little script which is a total hack that successfully switched the USB power off and on. It just spams this off command for >5sec:

import subprocess
import time

password = 'XXXXXX' # <--- change this to yours
print('Now switching off power to all USB hubs')
start = time.time()
while time.time() < (start+6): # Seems to consistantly work with 5sec, using 6 to be safe.
	subprocess.call('echo '+ password +' | sudo -S uhubctl -l 1-2 -a off', shell=True)

print('\n')
print('Sleeping for a while to show that the ZED is really off...')
time.sleep(60)
print('\n switching power back on!')
subprocess.call('echo  '+ password +' | sudo -S uhubctl -l 1-2 -a on', shell=True)
time.sleep(1)
print('Done!')

But after the power is switched back on, the camera is unusable until I physically cycle it again. It appears that this is because the USB2.0 lines are still held high which is stopping the ZED2 from shutting down properly.
I’ve made a test rig that switched 5V, D+ and D- with a modified USB3.0 cable to the ZED2 and this switched the power nice and reliably, but I get loads of corrupt video frames after cutting & re-terminating the fragile USB3.0 SS lines. Hence why I’d much prefer to achieve this switching via a purely software method onboard the NX carrier.

Any help would be very much appreciated!

Hi,
Due to the hardware design of developer kit, we are not able to physically turn off/on VBUS. The only method is to control hub as the script does.

Here is a similar post:
Power down USB ports - #4 by vsaw