Open jeanparpaillon opened 3 years ago
Hi,
What's dmesg
output on rpi?
rpi should be visible in lsusb (keep in mind usb gadget is active only while /dev/iap0 is open)
Some ideas:
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/overview
Thank you for your answer. I've tried many configurations with other gadget drivers and it looks like there is some hardware issue.
Here is my dmesg output:
$ cat /srv/scratch/mercedes/dmesg
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.4.79+ (dom@buildbot) (gcc version 8.4.0 (Ubuntu/Linaro 8.4.0-3ubuntu1)) #1373 Mon Nov 23 13:18:15 GMT 2020
[ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[ 0.000000] OF: fdt: Machine model: Raspberry Pi Zero W Rev 1.1
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] Reserved memory: created CMA memory pool at 0x17c00000, size 64 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[ 0.000000] On node 0 totalpages: 114688
[ 0.000000] Normal zone: 1008 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 114688 pages, LIFO batch:31
[ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113680
[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 smsc95xx.macaddr=B8:27:EB:D3:42:37 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000 console=ttyS0,115200 console=tty1 root=PARTUUID=b36d4013-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,libcomposite,g_ipod_audio,g_ipod_hid,g_ipod_gadget g_ipod_gadget.swap_configs=1 g_ipod_gadget.product_id=0x1297
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 376184K/458752K available (7814K kernel code, 712K rwdata, 2468K rodata, 512K init, 804K bss, 17032K reserved, 65536K cma-reserved)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] ftrace: allocating 27740 entries in 55 pages
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] random: get_random_bytes called from start_kernel+0x2a8/0x4d8 with crng_init=0
[ 0.000020] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
[ 0.000077] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[ 0.000178] bcm2835: system timer (irq = 27)
[ 0.000758] Console: colour dummy device 80x30
[ 0.001331] printk: console [tty1] enabled
[ 0.001422] Calibrating delay loop... 697.95 BogoMIPS (lpj=3489792)
[ 0.050346] pid_max: default: 32768 minimum: 301
[ 0.050646] LSM: Security Framework initializing
[ 0.050981] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.051044] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.052986] Disabling memory control group subsystem
[ 0.053260] CPU: Testing write buffer coherency: ok
[ 0.054775] Setting up static identity map for 0x8200 - 0x8238
[ 0.055847] devtmpfs: initialized
[ 0.068331] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[ 0.068796] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.068881] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[ 0.076853] pinctrl core: initialized pinctrl subsystem
[ 0.078536] NET: Registered protocol family 16
[ 0.083292] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[ 0.089399] audit: initializing netlink subsys (disabled)
[ 0.091697] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[ 0.091760] hw-breakpoint: maximum watchpoint size is 4 bytes.
[ 0.091940] Serial: AMBA PL011 UART driver
[ 0.095394] bcm2835-mbox 2000b880.mailbox: mailbox enabled
[ 0.100630] audit: type=2000 audit(0.080:1): state=initialized audit_enabled=0 res=1
[ 0.120702] raspberrypi-firmware soc:firmware: Attached to firmware from 2020-11-25 17:12, variant start
[ 0.130719] raspberrypi-firmware soc:firmware: Firmware hash is 2e6292a5304b95ecfd700fc5ab2b793402056332
[ 0.190858] bcm2835-dma 20007000.dma: DMA legacy API manager, dmachans=0x1
[ 0.193877] SCSI subsystem initialized
[ 0.194157] usbcore: registered new interface driver usbfs
[ 0.194293] usbcore: registered new interface driver hub
[ 0.194586] usbcore: registered new device driver usb
[ 0.197259] clocksource: Switched to clocksource timer
[ 1.666845] VFS: Disk quotas dquot_6.6.0
[ 1.667036] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 1.667494] FS-Cache: Loaded
[ 1.667884] CacheFiles: Loaded
[ 1.685882] thermal_sys: Registered thermal governor 'step_wise'
[ 1.686540] NET: Registered protocol family 2
[ 1.687996] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 1.688111] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 1.688226] TCP bind hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 1.688350] TCP: Hash tables configured (established 4096 bind 4096)
[ 1.688546] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 1.688619] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 1.689093] NET: Registered protocol family 1
[ 1.690304] RPC: Registered named UNIX socket transport module.
[ 1.690365] RPC: Registered udp transport module.
[ 1.690397] RPC: Registered tcp transport module.
[ 1.690428] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 1.692075] hw perfevents: no irqs for PMU, sampling events not supported
[ 1.692190] hw perfevents: enabled with armv6_1176 PMU driver, 3 counters available
[ 1.696336] Initialise system trusted keyrings
[ 1.697000] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[ 1.713623] FS-Cache: Netfs 'nfs' registered for caching
[ 1.715181] NFS: Registering the id_resolver key type
[ 1.715291] Key type id_resolver registered
[ 1.715328] Key type id_legacy registered
[ 1.715382] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 1.717643] Key type asymmetric registered
[ 1.717708] Asymmetric key parser 'x509' registered
[ 1.717818] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[ 1.717869] io scheduler mq-deadline registered
[ 1.717903] io scheduler kyber registered
[ 1.721181] bcm2708_fb soc:fb: FB found 1 display(s)
[ 1.732815] Console: switching to colour frame buffer device 82x26
[ 1.740402] bcm2708_fb soc:fb: Registered framebuffer for display 0, size 656x416
[ 1.750975] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
[ 1.757747] bcm2835-rng 20104000.rng: hwrng registered
[ 1.761365] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[ 1.768470] vc-sm: Videocore shared memory driver
[ 1.772285] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[ 1.798817] brd: module loaded
[ 1.816117] loop: module loaded
[ 1.821265] Loading iSCSI transport class v2.0-870.
[ 1.825352] usbcore: registered new interface driver smsc95xx
[ 1.828481] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[ 1.831801] dwc_otg: FIQ enabled
[ 1.831815] dwc_otg: NAK holdoff enabled
[ 1.831825] dwc_otg: FIQ split-transaction FSM enabled
[ 1.831845] Module dwc_common_port init
[ 1.832326] usbcore: registered new interface driver usb-storage
[ 1.835834] mousedev: PS/2 mouse device common for all mice
[ 1.840534] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[ 1.846750] sdhci: Secure Digital Host Controller Interface driver
[ 1.849959] sdhci: Copyright(c) Pierre Ossman
[ 1.853873] mmc-bcm2835 20300000.mmcnr: could not get clk, deferring probe
[ 1.858019] sdhost-bcm2835 20202000.mmc: could not get clk, deferring probe
[ 1.861484] sdhci-pltfm: SDHCI platform and OF driver helper
[ 1.865258] ledtrig-cpu: registered to indicate activity on CPUs
[ 1.868908] hidraw: raw HID events driver (C) Jiri Kosina
[ 1.872206] usbcore: registered new interface driver usbhid
[ 1.875181] usbhid: USB HID core driver
[ 1.879452] vchiq: vchiq_init_state: slot_zero = (ptrval)
[ 1.884373] [vc_sm_connected_init]: start
[ 1.893525] [vc_sm_connected_init]: end - returning 0
[ 1.899044] Initializing XFRM netlink socket
[ 1.901882] NET: Registered protocol family 17
[ 1.904848] Key type dns_resolver registered
[ 1.909032] registered taskstats version 1
[ 1.911764] Loading compiled-in X.509 certificates
[ 1.920394] random: fast init done
[ 1.931367] uart-pl011 20201000.serial: cts_event_workaround enabled
[ 1.934324] 20201000.serial: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
[ 1.943195] printk: console [ttyS0] disabled
[ 1.946043] 20215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud = 50000000) is a 16550
[ 2.724199] printk: console [ttyS0] enabled
[ 2.732436] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[ 2.744824] mmc-bcm2835 20300000.mmcnr: mmc_debug:0 mmc_debug2:0
[ 2.753834] mmc-bcm2835 20300000.mmcnr: DMA channel allocated
[ 2.791058] sdhost: log_buf @ (ptrval) (97d10000)
[ 2.836703] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[ 2.846904] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 2.855257] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 2.866801] of_cfs_init
[ 2.892896] of_cfs_init: OK
[ 2.898870] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 2.908526] Waiting for root device PARTUUID=b36d4013-02...
[ 2.919973] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[ 2.962750] mmc0: host does not support reading read-only switch, assuming write-enable
[ 2.980573] mmc0: new high speed SDHC card at address 0007
[ 2.990809] mmcblk0: mmc0:0007 SD08G 7.42 GiB
[ 3.001610] mmcblk0: p1 p2
[ 3.038701] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem
[ 3.049102] EXT4-fs (mmcblk0p2): write access will be enabled during recovery
[ 3.098946] mmc1: new high speed SDIO card at address 0001
[ 5.808514] EXT4-fs (mmcblk0p2): recovery complete
[ 5.822482] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 5.836239] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[ 5.855410] devtmpfs: mounted
[ 5.867178] Freeing unused kernel memory: 512K
[ 5.874703] This architecture does not have kernel memory protection.
[ 5.884264] Run /sbin/init as init process
[ 6.650820] systemd[1]: System time before build time, advancing clock.
[ 6.839404] NET: Registered protocol family 10
[ 6.849255] Segment Routing with IPv6
[ 6.912637] systemd[1]: systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
[ 6.945588] systemd[1]: Detected architecture arm.
[ 6.979014] systemd[1]: Set hostname to <raspberrypi>.
[ 9.346827] random: systemd: uninitialized urandom read (16 bytes read)
[ 9.380408] random: systemd: uninitialized urandom read (16 bytes read)
[ 9.392380] systemd[1]: Listening on fsck to fsckd communication Socket.
[ 9.407446] random: systemd: uninitialized urandom read (16 bytes read)
[ 9.418123] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[ 9.440396] systemd[1]: Created slice User and Session Slice.
[ 9.455342] systemd[1]: Listening on Syslog Socket.
[ 9.469263] systemd[1]: Listening on udev Kernel Socket.
[ 9.482400] systemd[1]: Reached target Swap.
[ 9.495430] systemd[1]: Listening on udev Control Socket.
[ 10.549658] dwc2 20980000.usb: 20980000.usb supply vusb_d not found, using dummy regulator
[ 10.612500] dwc2 20980000.usb: 20980000.usb supply vusb_a not found, using dummy regulator
[ 10.917544] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[ 10.968255] dwc2 20980000.usb: DWC OTG Controller
[ 10.975961] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[ 11.047501] dwc2 20980000.usb: irq 33, io mem 0x20980000
[ 11.087849] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[ 11.102294] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 11.112803] usb usb1: Product: DWC OTG Controller
[ 11.120786] usb usb1: Manufacturer: Linux 5.4.79+ dwc2_hsotg
[ 11.129666] usb usb1: SerialNumber: 20980000.usb
[ 11.396777] hub 1-0:1.0: USB hub found
[ 11.450008] hub 1-0:1.0: 1 port detected
[ 11.763360] g_ipod_audio: loading out-of-tree module taints kernel.
[ 11.844111] **********************************************************
[ 11.853995] ** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **
[ 11.863778] ** **
[ 11.873538] ** trace_printk() being used. Allocating extra memory. **
[ 11.883229] ** **
[ 11.892933] ** This means that this is a DEBUG kernel and it is **
[ 11.902577] ** unsafe for production use. **
[ 11.912193] ** **
[ 11.921811] ** If you see this message and you are not debugging **
[ 11.931390] ** the kernel, report this immediately to your vendor! **
[ 11.940976] ** **
[ 11.950518] ** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **
[ 11.960003] **********************************************************
[ 11.969783] systemd[1]: Started File System Check on Root Device.
[ 12.086651] systemd[1]: Starting Remount Root and Kernel File Systems...
[ 12.162293] systemd[1]: Started Journal Service.
[ 12.532470] ipod-gadget: init
[ 12.538525] ipod-gadget: swapping usb configuration: ipod is #1
[ 12.547466] ipod-gadget: override usb idProduct: 1297
[ 12.617451] g_ipod gadget: = ipod_bind()
[ 12.759871] Mass Storage Function, version: 2009/09/11
[ 12.797607] LUN: removable file: (no medium)
[ 12.804832] g_ipod gadget: = ipod_config_ptp_bind()
[ 12.827522] ipod-gadget-hid: alloc_chrdev_region dev: 241 0
[ 12.836105] ipod-gadget-hid: ipod_hid_alloc()
[ 12.895689] g_ipod gadget: = ipod_config_bind()
[ 12.895714] g_ipod gadget: = ipod_audio_bind()
[ 12.897099] g_ipod gadget: = ipod_hid_bind(), deactivs=1
[ 12.897138] g_ipod gadget: g_ipod ready
[ 12.903939] dwc2 20980000.usb: bound driver g_ipod
[ 13.217469] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 14.165777] systemd-journald[78]: Received request to flush runtime journal from PID 1
[ 16.381650] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[ 16.384410] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[ 16.384436] [vc_sm_connected_init]: start
[ 16.418059] mc: Linux media interface: v0.10
[ 16.427095] [vc_sm_connected_init]: installed successfully
[ 16.506452] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[ 16.683561] videodev: Linux video capture interface: v2.00
[ 16.824428] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[ 16.838318] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[ 16.839910] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[ 16.898589] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[ 16.910944] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[ 16.960613] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[ 16.975871] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[ 16.978580] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[ 16.980110] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[ 16.980942] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[ 16.980987] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[ 16.981022] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[ 16.981047] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[ 16.981073] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[ 16.981440] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[ 17.001167] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[ 17.001243] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[ 17.047718] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[ 17.047816] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[ 17.091211] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[ 17.091278] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[ 18.495800] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 18.994000] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 19.468473] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[ 19.487114] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[ 19.487619] usbcore: registered new interface driver brcmfmac
[ 19.519962] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.raspberrypi,model-zero-w.txt failed with error -2
[ 19.769483] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[ 19.769684] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[ 19.770817] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 22 2019 01:59:28 version 7.45.98.94 (r723000 CY) FWID 01-3b33decd
[ 26.125516] random: crng init done
[ 26.125544] random: 7 urandom warning(s) missed due to ratelimiting
[ 26.872362] uart-pl011 20201000.serial: no DMA platform data
[ 27.545986] 8021q: 802.1Q VLAN Support v1.8
[ 27.686458] Adding 102396k swap on /var/swap. Priority:-2 extents:1 across:102396k SSFS
[ 28.395696] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
[ 29.852777] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 31.282722] Bluetooth: Core ver 2.22
[ 31.282908] NET: Registered protocol family 31
[ 31.282920] Bluetooth: HCI device and connection manager initialized
[ 31.290366] Bluetooth: HCI socket layer initialized
[ 31.290394] Bluetooth: L2CAP socket layer initialized
[ 31.290457] Bluetooth: SCO socket layer initialized
[ 31.308563] Bluetooth: HCI UART driver ver 2.3
[ 31.308583] Bluetooth: HCI UART protocol H4 registered
[ 31.308698] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 31.308976] Bluetooth: HCI UART protocol Broadcom registered
[ 32.089344] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 32.089361] Bluetooth: BNEP filters: protocol multicast
[ 32.089391] Bluetooth: BNEP socket layer initialized
Check if you have dtoverlay=dwc2
in your /boot/config.txt
.
@oandrew after testing with different cables and simple g_ether or g_serial gadget drivers, I came to the conclusion there should be some hw issue. I am waiting for new rpi0 and then will update this issue
Hi Jean
Did you ever get ipod gadget to work? I'm not getting the device file after loading the kernel modules
[94002.524086] ipod-gadget: init [94002.524088] udc-core: couldn't find an available UDC - added [g_ipod] to list of pending drivers
I'm trying to use it with a AVR-X2300W amp.
Is there some USB/kernel config option I should know about that should probably be mentioned in the readme to enable USB OTG or something? I'm running Ubuntu 20.04 amd64 so its not a DTB issue.
Hi, First, thanks for this nice piece of code.
I could compile, install, insmod g_ipod modules.
/dev/iap0
is showing up andipod
command can connect to it.However, on my linux laptop, I can not see the rpi0 with
lsusb
. I have also tried with a Denon AVR-X1200W amp and the rpi0 is not detected,ipod
trace does not show any command.Is it normal
lsusb
does not show any device with the product_id ? What may be wrong ?My config: