Is there a terminal command that resets the USB port without having to unplug and plug the device? Sometimes my USB hub (HDMI, Ethernet, USB3) malfunctions, and the only fix is to unplug/plug or reboot the computer.
In my case, my external monitor connected by HDMI will sometimes fail to be detected when waking from sleep. What happens is that my MacBook Air M1 still thinks the external is connected, but the monitor is black. The built-in display still behaves as the extended monitor. I have tried to detect displays in the Display options or scaling to try and force the system to redetect the monitor. The fix is always to restart or unplug the USB hub.
There is an app called "uhubctl", but that did not work on the port for HDMI. I had similar issues when I used Linux with USB hubs. Sometimes Ethernet would not be detected on boot, but there was a terminal command that reset the port which I wrote into a script and hot keyed. Therefore I am trying to do the same with my Mac.