Turn on/off the power of the USB port on RaspberryPi 4 Model B -Qiita Retry version of
Detects anomalies with the USB camera image connected to the Raspberry Pi and warns with a patrol lamp
- BUFFALO 4-port self-powered hub with power saving function Black BSH4AE12BK - SANWA SUPPLY TAP-RE10SPUN 7 high-performance lightning interlocking taps - LED rotating light Nico FAX φ45 VL04S type VL04P-100FAN
I wanted to use a USB hub that supports Per-port power switching, but there was information that BSH4AE12BK could be used, and it was cheap, so I used that. As for the patrol light, the one for fax detection was cheap, so I used it. Just wrap a blank sheet around the paper detector and it will always light up.
A mechanism that can turn on/off the power supply for each port of the USB hub. If the supported hub is Linux
sudo lsusb -v | less
So, at the hub
wHubCharacteristic 0x0009
Per-port power switching
Per-port overcurrent protection
Is displayed, there is a high possibility that it can be used. (Less recommended because it comes out in large quantities) The possibility is high because ** Raspberry Pi 4 cannot be individually controlled despite the above display **. It's annoying!
The physical arrangement is like this
LAN
+---+ Port1 Port2(USB3.0)
| |
+---+ Port3 Port4(USB2.0)
The logical arrangement is probably like this
Hub1(Root) - Hub 1.1(USB2.0) - Hub 2(USB3.0)
├ Port1 ├ Port1
├ Port2 ├ Port2
├ Port3 ├ Port3
└ Port4 └ Port4
If you can turn all ports on and off, the following is OK, but I want to control them individually.
sudo uhubctl -l 1-1 -a off
In the previous article, I used hub-ctrl, but after investigating it, I found that it was easier to use, so I used it. GitHub - mvp/uhubctl: uhubctl - USB hub per-port power control
It seems that it doesn't work if the firmware is old, so I updated it.
sudo apt update
sudo apt full-upgrade
sudo reboot
git clone https://github.com/mvp/uhubctl
cd uhubctl
make
sudo make install
If you call the command with no arguments, it will list the supported hubs. However, ** it is not always supported **, so it is necessary to actually check the power supply status. The GitHub page also says that you should actually connect an appropriate smartphone or light and check the energization. It's really annoying. .. ..
sudo uhubctl
Current status for hub 2 [1d6b:0003 Linux 5.4.83-v7l+ xhci-hcd xHCI Host Controller 0000:01:00.0, USB 3.00, 4 ports, ppps]
Port 1: 02a0 power 5gbps Rx.Detect
Port 2: 02a0 power 5gbps Rx.Detect
Port 3: 02a0 power 5gbps Rx.Detect
Port 4: 02a0 power 5gbps Rx.Detect
Current status for hub 1-1 [2109:3431 USB2.0 Hub, USB 2.10, 4 ports, ppps]
Port 1: 0507 power highspeed suspend enable connect [05e3:0608 USB2.0 Hub, USB 2.00, 4 ports, ganged]
Port 2: 0107 power suspend enable connect [1e4e:0100 GroupGets PureThermal (fw:v1.3.0) 800c0031-5109-3538-3731-313200000000]
Port 3: 0100 power
Port 4: 0100 power
Current status for hub 1 [1d6b:0002 Linux 5.4.83-v7l+ xhci-hcd xHCI Host Controller 0000:01:00.0, USB 2.00, 1 ports, ppps]
Port 1: 0503 power highspeed enable connect [2109:3431 USB2.0 Hub, USB 2.10, 4 ports, ppps]
Turn on/off the HUB connected to 1-1.1 above HUB itself does not support Per-port power switching, so add the "-f" option.
sudo uhubctl -l 1-1.1 -f -a off
It works even if I change the ".1" part to .2 to .4, Even when using USB 2.0 ports (3,4)
sudo uhubctl -l 1-1.4 -f -a off
Note that it is necessary to specify.
- BUFFALO 4-port self-powered hub with power saving function Black BSH4AE12BK
↑ is compatible with external power supply, but it is linked to the power supply of the main USB, so it seems that some kind of emulation (or malfunction) is done internally.
Also, because of power supply control, hubs that have overvoltage detection for individual ports or can turn power supply on/off individually may support Per-port power switching.
According to the information on GitHub, it seems that this manufacturer's HUB is compatible. (16 ports are reported on GitHub)
ROSONWAY USB Hub 3.0 16 Port Aluminum USB Hub 100W Self-Powered USB Hub 5Gbps High Speed Transfer 12V/8.3A Independent Switch with AC Adapter
USB Hub 3.0 ROSONWAY Aluminum 7 Port USB3.0 Hub 24W Powered Bus Power and Self Power Independent Switch 5Gbps High Speed Transfer, 12V/2A AC Adapter
This time I achieved the purpose with BSH4AE12BK, so I would like to try the above HUB if there is an opportunity in the future.
Recommended Posts