CannonFodderSE
Posts: 3
Joined: Fri Jul 08, 2016 2:34 am

No ODC for gadget to bind to

Sun Jan 08, 2017 12:49 am

Greetings,
I'm having an issue with setting up gadget mode on a Pi Zero. My goal is to eventually build a game controller along the lines of the Razer Nostromo (http://www.razerzone.com/gaming-keyboar ... r-nostromo). It uses Windows only software to configure it. Has no onboard memory for configuration storage. Also notice some key response issues when switching between modes (red/green/blue).

Done a lot of web searching and everybody says the support has been built into the Raspian image since the beginning of 2016. Downloaded the November 2016 image and couldn't get it to work. After days of trying every sample I could find, no joy. It wasn't creating the necessary directories below "/sys/kernel/config/usb_gaget". libcomposite, or any other gadget modules, wasn't loading. Finally figured out that support is in the source tree, but not on the image.

Through menuconfig I enabled all the gadget modules as far as I could tell. Recompiled the modules (make modules) and installed them (make modules-install). All this was done on a Pi 3 for net access and better compile speed. Back on the Zero, did "modeprobe libcomposite". It now loads. See lsmod results below for modules loaded at boot up.

Module Size Used by
snd_bcm2835 23131 0
snd_pcm 95473 1 snd_bcm2835
snd_timer 22556 1 snd_pcm
snd 68400 3 snd_bcm2835,snd_timer,snd_pcm
bcm2835_wdt 4133 0
bcm2835_gpiomem 3823 0
uio_pdrv_genirq 3718 0
uio 10230 1 uio_pdrv_genirq
libcomposite 49383 0
dwc2 109939 0
udc_core 12769 2 dwc2,libcomposite
i2c_dev 6578 0
fuse 90472 1
ipv6 367671 18

I attempt to create a device using the scripted below. It's not for a hid device. Just to test the creation of a device or in case of the script three devices.

#!/bin/bash
# This example creates 2xACM + ECM Gadget.

# Creating the g1 directory to instantiated a new gadget device template to fill in.
cd /sys/kernel/config/
cd usb_gadget
mkdir g1
cd g1

# Write in our vendor/product IDs
echo "0x1d6b" > idVendor
echo "0x0104" > idProduct

#Instantiate English language strings
mkdir strings/0x409

# Write in our serial number, manufacturer, and product descriptor strings.
echo "0123456789" > strings/0x409/serialnumber
echo "Foo Inc." > strings/0x409/manufacturer
echo "Bar Gadget" > strings/0x409/product

# Create function instances.
# Note that multiple function instances of the same type must have a unique extension.
mkdir functions/acm.GS0
mkdir functions/acm.GS1
mkdir functions/ecm.usb0

# Create a configuration instance.
# Will contain "MaxPower" "bmAttributes" "strings"
mkdir configs/c.1

# Create English language strings and write in a description for this device configuration.
mkdir configs/c.1/strings/0x409
echo "CDC 2xACM+ECM" > configs/c.1/strings/0x409/configuration

# Bind each of our function instances to this configuration.
ln -s functions/acm.GS0 configs/c.1
ln -s functions/acm.GS1 configs/c.1
ln -s functions/ecm.usb0 configs/c.1

# Verify which UDC drivers are available.
ls /sys/class/udc > UDC


The directory structure is created and the modules are loaded. See lsmod results below.

Module Size Used by
usb_f_ecm 7608 2
u_ether 13959 1 usb_f_ecm
usb_f_acm 6023 4
u_serial 11369 1 usb_f_acm
snd_bcm2835 23131 0
snd_pcm 95473 1 snd_bcm2835
snd_timer 22556 1 snd_pcm
snd 68400 3 snd_bcm2835,snd_timer,snd_pcm
bcm2835_wdt 4133 0
bcm2835_gpiomem 3823 0
uio_pdrv_genirq 3718 0
uio 10230 1 uio_pdrv_genirq
libcomposite 49383 13 usb_f_acm,usb_f_ecm
dwc2 109939 0
udc_core 12769 2 dwc2,libcomposite
i2c_dev 6578 0
fuse 90472 1
ipv6 367671 18

Now my stumbling block is "ls /sys/class/udc/" return is empty. So there is nothing to bind the UDC to.

Any suggestion would be greatly appreciated.

Thanks,
Randy

CannonFodderSE
Posts: 3
Joined: Fri Jul 08, 2016 2:34 am

Re: No ODC for gadget to bind to

Mon Jan 09, 2017 2:08 pm

Solved. Operator error. Had a typo in the dtoverlay line inconfig.txt.

Doub
Posts: 26
Joined: Fri Apr 07, 2017 9:48 pm

Re: No ODC for gadget to bind to

Fri Apr 07, 2017 10:19 pm

I'm trying to create a UVC gadget with a Pi Zero W. But the last line of the script fails with the error "ls: write error: No such device". The only thing in /sys/class/udc is a symbolic link named "20980000.usb" pointing to "../../devices/platform/soc/20980000.usb/udc/20980000.usb". What's yours looking like?

Return to “Other projects”