Was able to find this thread as well. It essentially verifies what I initially thought, which is you cannot do both. I'm not sure if possible to switch between them without rebooting though.
viewtopic.php?t=312809
As I said above, a zero2w can do both just not simultaneously. It can hot swap between roles too.
There is a pin in the micro USB socket that is used to signal whether it should act as a host or device (this is the same mechanism used by phones with micro USB).
If you load the dwc2 overlay with either dtoverlay=dwc2 or dtoverlay=dwc2,dr_mode=otg the driver will monitor the state of the ID pin and switch mode accordingly.
Unplug the OTG adapter and plug in a standard "charge and sync" micro USB cable to get device mode.
Gadget devices will still be present in the OS in host mode but using them won't do anything, I'd expect devices connected in host mode to be abruptly disconnect and disappear from the OS (as you're unplugging them) which may cause problems.
And, frankly, if you're going to the PI to change out cables you might as well take a laptop with you and connect using that.
Also as I said before, your best option is ethernet via a USB adapter but take all necessary precautions if the cable is running outdoors.
Note: the default driver is less of a CPU hog in host mode and cannot hot swap roles - it's host only.
Statistics: Posted by thagrol — Fri Apr 19, 2024 12:08 pm