USB PD request makes gadgets not work with some hosts
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 32/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- c, linux
- Domain
- embedded-iot, networking, operating-systems
Research direction
Reproduce the failure using /boot/firmware/config.txt, /boot/firmware/cmdline.txt, dwc2 and g_ether, then compare USB PD captures and kernel logs with a working host. Trace the handling of the PD messages after the 5V3A request; done means the USB ethernet gadget enumerates and usb0 reports carrier and link-local connectivity on the affected Apple hosts.
Written by the indexing model from the issue text.
Description
Describe the bug
When connecting a Raspberry Pi 5 (or CM5) to some hosts (recent Apple devices) using a direct USB C cable connection and configuring the Pi as a USB ethernet gadget, the host does not recognize the ethernet gadget. This happens only in cases where the Pi sends a USB PD request to the host. If the EEPROM is configured not to send a USB PD request, then the host does recognize the gadget. The hosts where this happen include
- iPad Pro M4
- Mac mini M4
- MacBook Air M3
Steps to reproduce the behaviour
- in
/boot/firmware/config.txt, add a linedtoverlay=dwc2,dr_mode=peripheral - in
/boot/firmware/cmdline.txt, appendmodules-load=dwc2,g_ether - add a link-local NM connection:
nmcli con add type ethernet ifname usb0 con-name usb0 ipv4.method link-local - override the udev rule that makes gadget interfaces unmanaged:
touch /etc/udev/rules.d/85-nm-unmanaged.rules - use a USB C cable to connect the USB C port on the Pi 5 to one of the hosts listed above
What I see on the Pi:
- the usb0 interface appears
od -t u4 --endian=big /proc/device-tree/chosen/power/max_currentshows 3000mA current has been negotiatedethtool usb0shows no link detected- NetworkManager does not activate the usb0 connection
nmcli dev show usb0shows carrier off
On the host no ethernet gadget shows up in Settings.
What I expect to see on the Pi:
- NetworkManager does activate the usb0 connection
ethtool usb0shows link detected- usb0 gets a link local address
I also expect that the ethernet gadget shows up on the host and that I can ssh into the Pi using ssh raspberrypi.local
If I use rpi-eeprom-config -e to add PSU_MAX_CURRENT=3000, then I see what I expect to see.
Device (s)
Raspberry Pi 5, Raspberry Pi CM5
System
/etc/rpi-issue
Raspberry Pi reference 2024-07-04
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 48efb5fc5485fafdc9de8ad481eb5c09e1182656, stage4
Firmware
2024/12/19 11:57:13
Copyright (c) 2012 Broadcom
version ccf64a4f (release) (embedded)
Kernel
Linux raspberrypi 6.6.62+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.62-1+rpt1 (2024-11-25) aarch64 GNU/Linux
Logs
When things work I see
[ 2.595364] dwc2 1000480000.usb: bound driver g_ether
[ 2.848187] dwc2 1000480000.usb: new device is high-speed
[ 2.898746] dwc2 1000480000.usb: new device is high-speed
[ 2.920452] dwc2 1000480000.usb: new address 1
When things don't work, I don't see the last three lines.
Additional context
Everything works OK on:
- iPad Mini Gen 7
- iPad 10th Gen
On these, /proc/device-tree/chosen/power/max_current shows a current of 1500mA. Everything also works if I put a USB PD powered hub between the host and the Pi.
I used a USB tester (a POWER-Z KM003C) with Windows software that allows the USB PD messages to be captured. With the iPad Mini, the iPad advertises some PDOs, but the Raspberry Pi never sends any PD requests (presumably because it is offering less than 5V3A). With the iPad Pro, the Raspberry Pi sends a request for 5V3A, which the iPad accepts. The iPad Pro then sends a whole bunch of messages (e.g. Get Sink Cap, Get Source Cap Extended, Get Sink Cap Extended, Get Revision, Get Source Info), which the Pi does not respond to. None of these messages got sent in the iPad Mini case. This suggests that a possible explanation is that the iPad is expecting a more complete USB PD implementation than the Pi provides.
- Dominant language
- C
- Stars
- 13.2k
- Forks
- 5.5k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 21
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/linux
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7415 · 2 comments · 1 reaction ·
-
rp1-cfe doesn't forward V4L2_EVENT_SOURCE_CHANGE event from csi-2 sensor driver to userspace app Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
raspberrypi/linux#7399 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
raspberrypi/linux#7357 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/linux#7054 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
raspberrypi/linux#7634 · 8 comments · 1 reaction ·
All issues in raspberrypi/linux
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
zephyrproject-rtos/zephyr#119726 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BasedHardware/omi#15320 ·
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
HarbourMasters/Shipwright#7229 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
riscv-software-src/riscv-isa-sim#2435 · 1 comment ·