Developer Ben Hardill has penned a guide to using the new Raspberry Pi 5 as a USB Type-C Gadget — after the release of both the new hardware and the Debian Bookworm-based Raspberry Pi OS rendered old guides obsolete.
The USB Type-C port on a Raspberry Pi 5, released late last year as a major upgrade for the popular single-board computer family and boasting a considerably more powerful processor and new PCI Express connectivity for high-speed peripherals, is typically used to provide power to the board — but hides a secondary function: the ability to work in USB Gadget mode, connecting the Raspberry Pi to a host computer over USB.
The functionality has existed in Raspberry Pi models for years, but the Raspberry Pi 5 hardware coupled with the new version of Raspberry Pi OS released at the same time means existing guides for configuring USB Gadget mode don't apply. That's where Hardill's new guide, brought to our attention by Adafruit, comes in.
Hardill's updated guide provides full step-by-step instructions on using USB Gadget mode on any Raspberry Pi 5 model using the official Debian Bookworm-based Raspberry Pi OS software — starting with updating the firmware and including configuring the kernel and configuring
libcomposite. A Bash script is provided for creating two USB Ethernet interfaces, which are then managed using NetworkManager — the new OS having moved away from
"I'm working on updating my script that automatically updates Raspberry Pi OS SD Card images with these changes before they are flashed to the card," Hardill notes, "but I'm having problems getting the new images to boot in the
dockerpi containers (this runs the image in an Arm emulator so we can run the install scripts properly for
dnsmasq). I'll probably post again if/when I get it working."
Hardill's full guide is available on his website.