WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Raspberry Pi Zero W and gadget mode  (Read 4464 times)

Offline Izeau

  • Newbie
  • *
  • Posts: 4
Raspberry Pi Zero W and gadget mode
« on: February 16, 2018, 10:10:45 AM »
Hello!

I’m trying to use my Raspberry Pi Zero W as gadget USB device but getting stuck. Here's what I did so far:

  • dd the piCore 9.0.3 image to the SD card
  • mount the SD card
  • update config.txt to add the dtoverlay=dwc2 line in the [ALL] section
  • update commandline.txt to add the modules-load=dwc2,g_ether bit (not sure if this does anything)
  • create a tcz file with the gadget files and dependencies inside (see below for the list)
  • add modprobe dwc2 and modprobe g_ether in bootlocal.sh
  • add my tcz in onboot.lst
  • save mydata.tgz

Now dwc2 loads just fine but I can't get g_ether, g_multi or any other module to load. Dependencies load fine (e.g. for g_ether I can see libcomposite, u_ether, usb_f_rndis in lsmod) but not the modules themselves.

Included modules:
Code: [Select]
lib
└── modules
    └── 4.9.22-piCore
        └── kernel
            └── drivers
                ├── media
                │   ├── media.ko
                │   └── v4l2-core
                │       ├── videobuf2-core.ko
                │       ├── videobuf2-memops.ko
                │       ├── videobuf2-v4l2.ko
                │       ├── videobuf2-vmalloc.ko
                │       └── videodev.ko
                └── usb
                    ├── dwc2
                    │   └── dwc2.ko
                    ├── gadget
                    │   ├── function
                    │   │   ├── u_ether.ko
                    │   │   ├── usb_f_hid.ko
                    │   │   ├── usb_f_mass_storage.ko
                    │   │   ├── usb_f_rndis.ko
                    │   │   └── usb_f_uvc.ko
                    │   ├── legacy
                    │   │   ├── g_acm_ms.ko
                    │   │   ├── g_audio.ko
                    │   │   ├── g_cdc.ko
                    │   │   ├── g_ether.ko
                    │   │   ├── g_hid.ko
                    │   │   ├── g_mass_storage.ko
                    │   │   ├── g_midi.ko
                    │   │   ├── g_multi.ko
                    │   │   ├── g_printer.ko
                    │   │   ├── g_serial.ko
                    │   │   ├── g_webcam.ko
                    │   │   └── g_zero.ko
                    │   ├── libcomposite.ko
                    │   └── udc
                    │       └── udc-core.ko
                    └── usbip
                        ├── usbip-core.ko
                        ├── usbip-host.ko
                        └── vhci-hcd.ko

The error unknown symbol in module, or unknown parameter pops up, and dmesg gives the error code -2 (ENOENT?)

I’ve tried about everything from these three threads, to no avail:


Can anyone point me in the right direction? Many thanks
« Last Edit: February 16, 2018, 10:13:40 AM by Izeau »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14850
Re: Raspberry Pi Zero W and gadget mode
« Reply #1 on: February 16, 2018, 10:46:02 AM »
What does "modinfo g_ether" give?

Offline Izeau

  • Newbie
  • *
  • Posts: 4
Re: Raspberry Pi Zero W and gadget mode
« Reply #2 on: February 16, 2018, 11:34:31 AM »
I'm in my dev VM right now, so don't mind the filename (which is /lib/modules/4.9.22-piCore/kernel/drivers/usb/gadget/legacy/g_ether.ko on the Pi)

Code: [Select]
filename:       /tmp/4.9.22-piCore-usb-gadgets/lib/modules/4.9.22-piCore/kernel/drivers/usb/gadget/legacy/./g_ether.ko
license:        GPL
author:         David Brownell, Benedikt Spanger
description:    RNDIS/Ethernet Gadget
srcversion:     E982E948F6BC8C5A476FB72
depends:        libcomposite,u_ether,usb_f_rndis
intree:         Y
vermagic:       4.9.22-piCore mod_unload modversions ARMv6 p2v8
parm:           idVendor:USB Vendor ID (ushort)
parm:           idProduct:USB Product ID (ushort)
parm:           bcdDevice:USB Device version (BCD) (ushort)
parm:           iSerialNumber:SerialNumber string (charp)
parm:           iManufacturer:USB Manufacturer string (charp)
parm:           iProduct:USB Product string (charp)
parm:           qmult:queue length multiplier at high/super speed (uint)
parm:           dev_addr:Device Ethernet Address (charp)
parm:           host_addr:Host Ethernet Address (charp)
parm:           use_eem:use CDC EEM mode (bool)

(I tried setting all the parameters but the result is the same)

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14850
Re: Raspberry Pi Zero W and gadget mode
« Reply #3 on: February 16, 2018, 12:29:52 PM »
Are all the modules on the “depends” line (recursively) present?

Offline Izeau

  • Newbie
  • *
  • Posts: 4
Re: Raspberry Pi Zero W and gadget mode
« Reply #4 on: February 16, 2018, 12:39:14 PM »
Yes they are (and their dependencies too). I can even see them listed in lsmod.

Offline Izeau

  • Newbie
  • *
  • Posts: 4
Re: Raspberry Pi Zero W and gadget mode
« Reply #5 on: March 29, 2018, 06:02:26 AM »
Hey, still no success. Does anyone have a working config?

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Raspberry Pi Zero W and gadget mode
« Reply #6 on: March 29, 2018, 11:25:42 AM »

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Raspberry Pi Zero W and gadget mode
« Reply #7 on: March 29, 2018, 01:11:52 PM »