-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raspberry Pi zero USB Gadget Mode #648
Conversation
Thanks for this great PR. I will try to review it during the next days, but I cannot promise to integrate it already with the next upcoming release. But what I can already state is, that instead of checking for the dtoverlay change in Or do you think that there is some use-case for also having USB Gadget mode available for anything else than a RaspberryPiZero (RaspberryPi3, etc.?!?) |
There is no time pressure. :) I think the problem with enabling this by default is that it would break any USB dongles people attach to the Zero. I don't know if this is a common use case, but people may also attach an Ethernet adapter via USB. I don't think it makes sense to enable gadget mode for anything but the Zero, because other boards usually have ethernet. |
Ok, haven't tested Gadget mode myself yet. But does that mean that if the |
It is my understanding that dwc2 disables the root hub of the pi in favour of gadget mode. However, I have not tested this. According to config.txt's documentation, it is also possible to have By the way, the other Raspberries do not support gadget mode. |
Could you please test if loading dwc2.dtbo in config.txt alone already takes over the whole USB or if loading the module does this? |
I had some time to test this now. I attached to the serial port of the pi zero, and the usb port seems to stay active no matter what I do, even after loading In addition, it is also possible to load the overlay at run time using the The only problem is that
The lib is actually missing on the RaspberryMatic image, but is there after building it from soruce in |
Ok, I found the missing lib via |
@fhirschmann why do you need configfs in fstab? IMHO this is not required and should be omitted. |
included, thus making the dtoverlay, dtparam commands to actually work. This refs #648.
The dtoverlay command line utility does not work without configfs. If you still want to just include |
I still cannot get the dtoverlay command to work reliably. I guess some more digging is required. |
@jens-maus, I can now confirm this working and ready to merge. The USB ports still works with the default RaspberryMatic configuration. I tested this with an USB keyboard. |
Thanks. However, can you please also test USB Sticks and large file transfers, etc. Because the dwc2 overlay replaces the whole USB driver AFAIK. In addition, please also test old RaspberryPis like Pi1 because the rpi0 image is also used by these hardware models. |
Unfortunately, I neither have the time nor the equipment (pi1) for these tests. Hence, I suggest to not touch The other option, the The third option is of course to close this PR and I can provide a patch against RaspberryMatic to enable gadget mode for users to apply and compile themselves. |
What‘s the problem with dtoverlay command exactly?!? Shouldn‘t it work reliably when configfs is added to fstab? |
I think configfs isn't enough for dtoverlay to work reliably. There were some errors that |
I just had some time in testing your proposed changes here and in fact, it works! :) Great job. Thus, I will merge your PR into master and get it stabilised there with some more minor changes applied (e.g. applying it also to the recoveryfs setup...) Thanks again for this great PR! |
Description
This implements USB Gadget Mode on the Raspberry Pi Zero as discussed in #216.
This is not ready to merge yet. I can't figure out how to include
dwc2.dtbo
during the build process - maybe somebody can help with this?I'd also like to discuss how to best enable this mode from a user-perspective. Right now,
/boot/config.txt
has to be edited to enable thedwc2
overlay. This should be fine, but will a RaspberryMatic upgrade reset/boot/config.txt
again?Changes:
usb0
toeth0
dwc2.dtbo
during the build process to the sd card (image)Related Issues
Types of changes
Possible Drawbacks
I expect no side-effects because:
/boot/config.txt
Verification Process
/boot/config.txt
Release Notes
Contributing checklist