Previously, I’d have simply pointed someone to this AdaFruit Article as the Kernel Modules weren’t included in the stock kernel.
Not the case anymore, as the Kernel GitHub Repository currently has all the changes needed for USB Gadget Mode to function.
How do I put this, these guys are simply fantastic. If you haven’t already, I suggest their weekly Live Stream, Bilge Tank
over on YouTube, weekly on Thursday afternoons (Around 3PM UK Time). Not only do they show off cool stuff, answer your questions; they also do Giveaways. For example, during Bilge Tank 022, I answered a very simple question first and won myself a Raspberry Pi Zero pHat DAC Kit worth £30+Postage. Not only that but I’ve won quite a few freebies from these guys in the past and they offer decent prices with frequent store-wide discounts!