1

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?

EDIT:

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

1 Answers1

2

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.

Fred
  • 4,552
  • 18
  • 29