-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
Different boards use different USB controllers (dwc2, dwc3, tegra-xudc). The gadget should auto-detect and configure appropriately.
Current Problem
The current implementation assumes dwc2 controller and doesn't adapt to different hardware platforms.
Implementation
Detect USB controller type and configure:
- USB version (2.0 vs 3.0)
- Power settings (bus-powered vs self-powered)
- Device class and attributes
Detection Logic
# Check for dwc3 (USB 3.x)
if lsmod | grep -q "dwc3" || find /sys/class/udc -name "*dwc3*"; then
USB_VERSION="0x0300" # USB 3.0
USB_CONTROLLER="dwc3"
# Check for dwc2 (USB 2.0)
elif lsmod | grep -q "dwc2" || find /sys/class/udc -name "*dwc2*"; then
USB_VERSION="0x0200" # USB 2.0
USB_CONTROLLER="dwc2"
# Check for Tegra (Jetson)
elif lsmod | grep -q "tegra_xudc" || find /sys/class/udc -name "*tegra*"; then
USB_VERSION="0x0300" # USB 3.0
USB_CONTROLLER="tegra-xudc"
fiPower Configuration
if [ "$USB_CONTROLLER" = "dwc3" ]; then
# Self-powered device
echo 0xC0 > configs/c.1/bmAttributes
else
# Bus-powered device
echo 0x80 > configs/c.1/bmAttributes
echo 250 > configs/c.1/MaxPower
fiAcceptance Criteria
- Correctly identifies dwc2, dwc3, tegra-xudc controllers
- Sets USB version based on controller capabilities
- Configures power settings appropriately
- Works across RPi, Jetson, and generic ARM platforms
- Logs detected controller for debugging
- Handles unknown controllers gracefully
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request