Control USB power on a port by port basis on some USB hubs
github.com
github.com
>Original idea for this code was inspired by hub-ctrl.c by Niibe Yutaka: https://www.gniibe.org/development/ac-power-control-by-USB-h...
I got some ti chip ones from aliexpress for around 4 bucks each that have worked flawlessly on laptops and phones.
Do you happen to have that github link with the poc link to youtube?
I use it to turn a USB desk lamp on and off.
Someone on Amazon is boldly offering to sell you one, a 4 port USB 2.0 hub, for $72, but whether they actually have it or are a robot planning to order one from another robot that doesn’t have it but thinks it can get it for $60 is anyone’s guess.
Last time I went through hubctl’s list, none were available new, and lots of the ones listed have “issues” where later buyers can’t make them work (probably because the manufacturer changed the design but kept the model number). But that’s been a few years.
I just like to tell the manufacturers that I’m a niche, but I will happily pay double for them to put the current sense shunts and power switching transistors from the IC reference design on their board.
I also had trouble finding the original author online when I created the GitHub repo, but the other repo links him. I’m sure this didn’t exist back in the day. I did reach out to Niibe Yutaka way back and get his permission to post on GitHub.
I know other hubs, like those by Acroname, have their own libraries for power control of USB ports. (and I would guess are not supported by this library)
USB was always a shitty standard to begin with, nothing should ever require unplugging and plugging to get it to work, yet I have to do that to my webcam every day.
If the USB device still doesn't respond then it means that they have some buggy firmware that requires a hard reboot to work.
Example for a USB reset in linux: https://marc.info/?l=linux-usb&m=121459435621262&w=2
That Linux USB reset does not work.
(I even replace `reboot` with a script warning of this gotcha :) )
Caveat: this is with a typical x86 motherboard. Not all SBCs have RTCs needed to use rtcwake (e.g. RPi doesn't I think?)
I've never seen a device so far that has a physical switch to make sure it's really been unplugged, but I'd imagine someone could find a use case.
I don't know if it's the board or if it's down to circuitpython, but being able to software powercycle the USB ports on my motherboard would be really useful, particularly as the RP2040 is mounted inside the PC.
We needed to reset a plugged high-speed webcam, and we needed high-speed USB3, and the ability to cut the data lines too.
The Windows driver (usbctl.sys?) does not support the USB power control commands, the solution that Pegasus or Yepkit use is to add a HID/COM USB device to control the power rail. [edit] We used Pegasus instead of yepkit due to it going to a customer setup, and the bare-board yepkit was a no-go.