Open LinoBarreca opened 5 years ago
lsusb -t output: /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M | Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M | Port 4: Dev 4, If 0, Class=Vendor Specific Class, Driver=ch341, 12M <--------3d printer
yes I did
I guess I will need to wait until I myself get a Raspberry Pi 4B so that I can adjust the software. What's sad is that the three versions (1MB, 2MB and 4MB) will each have different IDs, making this problematic.
I guess it's just the ram size which is different. what IDs are you talking about? are you using a sort of ID to see if you are running on some PI model?
The output of cat /proc/cpuinfo
returns a Revision which has an identifier for the board. I've managed to research this for the three new RAM flavors of the Raspi 4B but I still need to have one now so that I can research what type of USB buses they're now using in this. There are smart buses and otherwise. Of the first type, there are ganged and individually-controllable. The recent 3B+ split the bus into two plus two; I'm guessing they did something similar with the 4B.
You cannot fix this until uhubctl can support it. And that requires updated firmware for 4B, see https://github.com/raspberrypi/linux/issues/3079.
Bummer. I've subscribed to your thread to keep an eye on this.
uhubctl
should now support Raspberry Pi 4B (port 4 only) https://github.com/mvp/uhubctl/commit/4aae44ced039.
You may need to update USB firmware to https://www.raspberrypi.org/forums/download/file.php?id=33477
Please give it a try and report back.
@OutsourcedGuru Any updates on possible pi 4B support after the uhubctl update? I recently installed a new printer mainboard and setup my 4B for Octoprint with psu control. My Ender 3's stock mainboards usb stopped responding to anything but the 5v line so Im super paranoid that octoprints 5v supply fried something in my stock board. This seems like the best setup for preventing it in the future. If not having a 4B is your main limit Id happly do a veriatey of tests to help using my own. I figure my time is better spent helping you get the pluging as universal as possible then it is spending the time unknowingly trying to make uhubctl work for myself!
I'm using a RPI4 with 2GB and with the following uhubctl command I can toggle all the usb ports on /off:
(don't forget to give sudo rights to the user without password via "sudo visudo" ... )
The plugin could detect the type of RPI (2/3/4) based on the output of cat /proc/cpuinfo In case it is a RPI4, then the plugin could show 1 toggle to toggle all ports.
Might it be possible to add that logic to the plugin?
I might. I've just been busy doing other things lately.
I have a Pi4-2GB for Octoprint, if I can help, ping me.
Just submitted a pull to update for RPi4. Note this is a bigger rewrite that removes the ability to toggle individual ports on RPi3B+, per the latest uhubctl update. This is tested and confirmed working on RPi3B+ and RPi4B boards.
How do I install your branch?
@sr1329 if you add a plugin from URL and use https://github.com/TokugawaHeavyIndustries/OctoPrint-USBControl/archive/master.zip it should work on the Pi4
@TokugawaHeavyIndustries thanks for this!!! Have installed on a 4gb Pi 4B and its working great. Can now turn off my printer and screen! Would be great to see this merged into master.
@sr1329 if you add a plugin from URL and use https://github.com/TokugawaHeavyIndustries/OctoPrint-USBControl/archive/master.zip it should work on the Pi4
@TokugawaHeavyIndustries thanks for this!!! Have installed on a 4gb Pi 4B and its working great. Can now turn off my printer and screen! Would be great to see this merged into master.
Just installed on a Pi 4 B 4GB and toggling the switch doesn't seem to control the power, but "sudo /home/pi/uhubctl/uhubctl -l 1-1 -a 0" works, seems like the switch is executing the wrong command.
2020-10-30 12:08:54,661 - octoprint.plugins.usbcontrol - INFO - usb4
off... 2020-10-30 12:08:54,713 - octoprint.plugins.usbcontrol - INFO - uhubctl failed, throwing error 2020-10-30 12:09:11,373 - octoprint.plugins.usbcontrol - INFO - usb4
on... 2020-10-30 12:09:11,417 - octoprint.plugins.usbcontrol - INFO - uhubctl failed, throwing error
@Coolie1101 Did you install the commit from my pull/branch or did you install the main from OutsourcedGuru?
@OutsourcedGuru , if you have abandoned this project, perhaps you should pass the helm to @TokugawaHeavyIndustries. I would be happy to update uhubctl readme to point to @TokugawaHeavyIndustries repository instead.
@Coolie1101 Did you install the commit from my pull/branch or did you install the main from OutsourcedGuru?
Installed via link with "https://github.com/TokugawaHeavyIndustries/OctoPrint-USBControl/archive/master.zip"
@Coolie1101 , did you upgrade RPI 4 firmware? Also, please show output of sudo uhubctl
@TokugawaHeavyIndustries , @Coolie1101 , your plugin should be calling uhubctl -l 2 -a 0
(or uhubctl -l 1-1 -a 0
. Also, need to make sure to use uhubctl version 2.2.0 or later.
@mvp I just updated my fork to the latest ver of uhubctl. Looks like the I was originally using v2.1.0-38-gb73213dd.
And yes the command for the 4B that the plugin is sending is uhubctl -l 1-1 -p 1-4 -a 0
Note that -p 1-4
is the same as -p all
or not specifying ports at all.
Yeah that was leftover from @OutsourcedGuru 's original work, and I just haven't cleaned it up. 😄
did you upgrade RPI 4 firmware? Yes.
sudo uhubctl
pi@octoprint:~ $ sudo uhubctl Current status for hub 2 [1d6b:0003 Linux 5.4.72-v7l+ xhci-hcd xHCI Host Controller 0000:01:00.0, USB 3.00, 4 ports] 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] Port 1: 0103 power enable connect [1a86:7523 USB Serial] Port 2: 0503 power highspeed enable connect [05a3:9331 HD Web Camera HD Web Camera Ucamera001] Port 3: 0100 power Port 4: 0503 power highspeed enable connect [2ab8:0531 Sonix Technology Co., Ltd. USB 2.0 Camera SN0001] Current status for hub 1 [1d6b:0002 Linux 5.4.72-v7l+ xhci-hcd xHCI Host Controller 0000:01:00.0] Port 1: 0503 power highspeed enable connect [2109:3431 USB2.0 Hub, USB 2.10, 4 ports]
pi@octoprint:~ $ uhubctl --version 2.2.0-13-gdcb1e611
Also, is the only way to use the feature is by going to settings>USBControl?
And is there any way to restore the usb camera connection after restoring power?
@Coolie1101 , USB camera should reconnect after restoring power. If that doesn't work, try adding -R
to uhubctl command line - it should force USB bus reset.
@mvp, Tx, I tried with "sudo /home/pi/uhubctl/uhubctl -R", but no go.
@Coolie1101 , I meant adding this flag to other flags. Try this to turn power back on:
sudo uhubctl -l 2 -a 1 -R
sudo uhubctl -l 2 -a 1 -R
Doesn't seem to work, still no video until a host reboot.
@Coolie1101 Does the plugin work now (at least for turning off the power)?
it complains that it isn't installed on a Pi2/3 and doesn't work.