News for hackers. Stuff that matters.
Re:Software control USB power on some USB hubs by dheera on Wednesday September 13, 2023 @05:28PM (#37501961)
Would be nice if someone could intergrate this with the OS itself so that if some USB device stops responding, the OS "unplugs and plugs" it automatically until it works.

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.

Re:Software control USB power on some USB hubs by krasin on Wednesday September 13, 2023 @05:40PM (#37502097)
Sometimes, it's the device, but sometimes it's the USB controller on your motherboard. If you have this problem on a desktop, one option is to buy a PCIe card with USB ports, so that there's a chance to bypass the buggy motherboard USB stack (PCIe is a lot more reliable).
Re:Software control USB power on some USB hubs by tcas on Wednesday September 13, 2023 @05:39PM (#37502070)
USB has a built in protocol level reset that should achieve the same thing. The only change is 5V power is not cut. It's basically the same as doing an OS reboot from the peripheral's perspective.

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

Re:Software control USB power on some USB hubs by dheera on Wednesday September 13, 2023 @06:10PM (#37502375)
I've tried that, my RealSense camera and several other USB devices I've used require physically unplugging and plugging after every reboot or it refuses to work.

That Linux USB reset does not work.

Re:Software control USB power on some USB hubs by gertlex on Thursday September 14, 2023 @02:00PM (#37512472)
I've got experience with this... `reboot` won't work, as it doesn't cut power, but if you can do `rtcwake -m off -s 30`, the power to the USB ports gets cut in between the computer being off and booting back up again.

(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?)

Re:Software control USB power on some USB hubs by TheRealPomax on Wednesday September 13, 2023 @06:43PM (#37502662)
You need to cut the power for certain USB devices to actually reset their in-device memory though (like an iLok dongle). Just "disconnecting and reconnecting" via software without a power cycle won't do anything for those. And that's not a bug, in dongles that's literally an anti-piracy feature.
Re:Software control USB power on some USB hubs by gorkish on Wednesday September 13, 2023 @07:29PM (#37503020)
Some devices (mostly security devices) trigger things based on the physical connection state, cycle count, etc. and it's useful to have a means to test these.

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.

Re:Software control USB power on some USB hubs by XorNot on Wednesday September 13, 2023 @08:53PM (#37503575)
That doesn't solve the problem that I still need to do it though. I've got this problem right now with my Blue microphone: it hates being rebooted without being power-cycled for some reason.
Re:Software control USB power on some USB hubs by Nursie on Wednesday September 13, 2023 @09:21PM (#37503772)
Yeah, this would be really useful for my RP2040Zero project.

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.