Sorry but that's not something I have any experience with.
From what I've read in the past you can't remove a dtoverlay that was loaded by the bootloader/config.txt after system boot and you probably need to do that before reloading it with new parameters.
You could try loading the dwc2 overlay and module after boot from one of the usual places. That should allow you to remove it and reload it with different parameters.
The other option is to look at how the CM4 and CM5 do it though I'm not sure those allow on the fly switching between modes.
The only Pi models I'm aware of that allow hot swapping between host and device roles are the zero series (zero[w], zero2W) so if you don't need the horsepower of the 4B consider using one of those instead.
From what I've read in the past you can't remove a dtoverlay that was loaded by the bootloader/config.txt after system boot and you probably need to do that before reloading it with new parameters.
You could try loading the dwc2 overlay and module after boot from one of the usual places. That should allow you to remove it and reload it with different parameters.
The other option is to look at how the CM4 and CM5 do it though I'm not sure those allow on the fly switching between modes.
The only Pi models I'm aware of that allow hot swapping between host and device roles are the zero series (zero[w], zero2W) so if you don't need the horsepower of the 4B consider using one of those instead.
Statistics: Posted by thagrol — Mon Aug 25, 2025 3:47 pm