MDS - Cycle power on USB port with uhubctl

I discovered a nifty utility the other day - uhubctl - which can cycle power on a USB port or hub. Useful for cycling power to an Automaton before rebooting the Mac. (I think some Macs cycle power to their USB devices during restart, and some do not. Cycling power before reboot makes sure the Automaton starts another keystroke cycle.)

Ok, so the tool is here:

You can install it with brew:
brew tap mvp/uhubctl GitHub - mvp/uhubctl: uhubctl - USB hub per-port power control
brew install uhubctl

And then I send this via ARD as root:

# cycle power for USB port connected to Automaton
/usr/local/bin/uhubctl --action cycle --search Adafruit

# Set next reboot to Recovery
/usr/sbin/nvram internet-recovery-mode=RecoveryModeDisk

# Aaaand reboot
reboot

After a couple tests, I think this might be a good way to deal with devices which are booted already, and have an automaton, but restart the MDS process.

Cool. I have used that utility or something like it on a RPi for a different project. You can also use the automaton command line to reboot it:

specifically:

reboot: reboot the device

run it like this on a boot macos system:

echo reboot >> /dev/cu.usbmodem*

tim