While trying the solutions suggested by a comment on my first question I tried to enable gadgetfs. I tried the following:

sudo modprobe dwc2
sudo modprobe gadgetfs
sudo mkdir /dev/gadget
sudo mount -t gadgetfs none /dev/gadget

But while executing the mount-Command, following error occurs:
mount: /dev/gadget: unknown filesystem type 'gadgetfs'.

Does anyone know why this happens?


Output of lsmod | grep gadget:

gadgetfs               24576  0
udc_core               49152  4 dwc2,libcomposite,gadgetfs,usb_f_hid

dmesg containing dwc2 or gadget:

[    5.102521] dwc2 20980000.usb: 20980000.usb supply vusb_d not found, using dummy regulator
[    5.102690] dwc2 20980000.usb: Linked as a consumer to regulator.0
[    5.102716] dwc2 20980000.usb: 20980000.usb supply vusb_a not found, using dummy regulator
[    5.323744] dwc2 20980000.usb: dwc2_check_params: Invalid parameter lpm=1
[    5.326750] dwc2 20980000.usb: dwc2_check_params: Invalid parameter lpm_clock_gating=1
[    5.332324] dwc2 20980000.usb: dwc2_check_params: Invalid parameter besl=1
[    5.335372] dwc2 20980000.usb: dwc2_check_params: Invalid parameter hird_threshold_en=1
[    5.423716] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[    5.425129] dwc2 20980000.usb: DWC OTG Controller
[    5.425199] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[    5.425277] dwc2 20980000.usb: irq 33, io mem 0x20980000
[   34.182486] dwc2 20980000.usb: bound driver configfs-gadget
[  171.860961] gadgetfs: USB Gadget filesystem, version 24 Aug 2004

  • Can you check the output of lsmod | grep gadget? Also try reading through the output of dmesg for anything to do with dwc2 or gadget. – Fred Oct 3 '19 at 16:12
  • @Fred I've edited both in. – MonsterDruide1 Oct 3 '19 at 16:19
  • @Fred Any more hints? – MonsterDruide1 Oct 4 '19 at 9:37
  • I don't have any in-depth experience with gadgetfs so I'm a bit limited on what I can do. It looks like you may need to have a gadget module loaded before trying to mount. What happens if you try after modprobe g_mass_storage? – Fred Oct 4 '19 at 11:24
  • @Fred Still doesn't find "filesystem type 'gadgetfs'.". – MonsterDruide1 Oct 4 '19 at 11:48

From Pi Zero as HID: How to control PC Mouse from Pi Zero through USB? and Zero GadgetFS?, it looks like you must add dtoverlay=dwc2 into /boot/config.txt and then restart.

Edit: @The Great Rambler below suggets that the libcomposite kernel module shouldn't be loaded. Based on searching for libcomposite, it also looks like these posts on Composite Gadgets on Pi Zero and Pi Zero as Multiple Gadgets might be useful resources for using the Pi Zero in gadget mode.

| improve this answer | |
  • In the config.txt there was that line two times at the end. Even when I removed one of them, restarted and tried again it failed. – MonsterDruide1 Oct 3 '19 at 16:02
  • Along with Fred's answer, make sure you don't have the kernel module libcomposite loaded. – The Great Rambler Oct 5 '19 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.