Files
Etienne Cordonnier 55cc6751e4 android-tools-conf: replace sysfs implementation with configfs
The android-tools-conf recipe used /sys/class/android_usb/android0/,
an interface exported by the out-of-tree android.c USB gadget driver
that Google carried in Android kernels but never submitted to mainline
Linux. It was never part of any upstream kernel release.

The configfs-based USB gadget framework (CONFIG_USB_CONFIGFS) was
merged into mainline Linux with kernel 3.10 (June 2013) and is the
correct interface for all upstream kernels since then. Additionally,
Google's Generic Kernel Image (GKI) initiative dropped android.c from
Android common kernels starting with kernel 5.10 (Android 12, 2021),
so even custom BSPs targeting modern Android cannot use this interface.

Remove android-tools-conf and rename android-tools-conf-configfs to
android-tools-conf, since the configfs-based implementation is the
only correct one for any modern kernel. Backward compatibility is
preserved via PROVIDES/RPROVIDES retaining the old
android-tools-conf-configfs name.

AI-Generated: Uses GitHub Copilot (Claude Sonnet 4.6)
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-06-20 23:41:39 -07:00

17 lines
692 B
Bash

#!/bin/sh
set -e
# Wait for adbd to open ep0 before activating the UDC. Without systemd
# sd_notify synchronisation there is no other signal that adbd is ready, so
# a fixed delay is used. When this script is invoked via ExecStartPost in a
# Type=notify service, adbd has already sent READY=1 before this runs and
# no delay is needed; set ANDROID_GADGET_UDC_DELAY=0 in that case (e.g. via
# a systemd drop-in Environment= line).
ANDROID_GADGET_UDC_DELAY="${ANDROID_GADGET_UDC_DELAY:-10}"
sleep "$ANDROID_GADGET_UDC_DELAY"
ls /sys/class/udc/ | head -n 1 | xargs echo -n > /sys/kernel/config/usb_gadget/adb/UDC
echo "Setting UDC $(ls /sys/class/udc/ | head -n 1) for USB ADB Gadget usage"