[HN Gopher] Control USB power on a port by port basis on some US...
       ___________________________________________________________________
        
       Control USB power on a port by port basis on some USB hubs
        
       Author : codazoda
       Score  : 22 points
       Date   : 2023-09-12 12:14 UTC (1 days ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | dheera wrote:
       | 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.
        
         | tcas wrote:
         | 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
        
           | dheera wrote:
           | 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.
        
           | TheRealPomax wrote:
           | 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.
        
         | [deleted]
        
       | tehlike wrote:
       | We used something like this for one of the high resolution depth
       | cameras we had that had some buggy driver/firmware issue. IT
       | needed to be power cycled every once in a while...
        
       | gertlex wrote:
       | Hmmm. Readme unfortunately fails to note what the required
       | hardware is (that apparently has a common/shared control
       | interface) which makes these USB hubs controllable.
        
         | dheera wrote:
         | What? They list several hubs that work, I guess you could buy
         | any of these.
         | 
         | https://github.com/codazoda/hub-ctrl.c#hubs-known-to-work
        
       | tpolzer wrote:
       | Is this just a less polished/active version of
       | https://github.com/mvp/uhubctl?
        
         | RaoulP wrote:
         | Thanks for linking! This one is way more up to date with
         | regards to compatible USB hubs. It credits the project in the
         | OP:
         | 
         | >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...
        
           | teakie wrote:
           | I want power only USB Cables. The USB-C protcoll was allready
           | a security thread resulting in unlocking fde and successfull
           | boot up
        
       | TheRealPomax wrote:
       | This is what I have a ykush[1] hub for, with an iLok dongle
       | plugged in and VirtualHere sharing that USB device over the
       | network. Only one machine can use the dongle at a time (so it's
       | basically just a way to not have to constantly walk a dongle from
       | a laptop to a workstation to a bedroom computer and back) the
       | iLok binds the machine id of whatever computer's using it and the
       | only way to clear it is to unplug the iLok. Or cut its power. A
       | simple LAN-only server that accepts a "GET /reset-usb" call that
       | cycles the power on each of the ports on the hub solves that
       | problem
       | 
       | [1] https://www.yepkit.com/products/ykush
        
       ___________________________________________________________________
       (page generated 2023-09-13 23:00 UTC)