Go to file
Ernest Van Hoecke 88c7b3ee93
libusbgx: exit with failure code when no UDC is detected
The systemd target `usb-gadget.target` is triggered by udev when a UDC
first comes up. It can happen that by the time gadget-start runs, this
UDC has been removed from the system again.

Have the gadget-start script exit with status 1 when `ls /sys/class/udc`
returns nothing.

Causing a service failure when no UDC is detected and no default was
given, allows the service to be restarted by a udev rule calling the
service (and not the target since those are not reentrant) directly. On
its own this patch will not do much.

For example, we saw such a situation using the DWC3 USB controller and
usb-conn-gpio kernel modules as loadables. By the time of the DWC3 init,
udev was active, and during init DWC3 started the USB OTG port in device
mode. If a pen drive was plugged in at boot, it would quickly switch to
host mode right after initialisation, emitting another udev event for
the removal of the UDC. The systemd target as thus reached, but by the
time gadget-start ran, the UDC was gone.

  dwc3 init       usb-conn-gpio role switch
      │                       │
      ▼                       ▼
udev: add UDC─┐         udev: del UDC─────►/sys/class/udc empty
              │                                         │
              │                                         x
              │                                         │
              │                                         ▼
              └────────────►usb-gadget.target─────►gadget-start

Signed-off-by: Ernest Van Hoecke <ernest.vanhoecke@toradex.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-07-02 23:27:07 -07:00
contrib contrib: oe-stylize: Use Python3 explicitly 2023-06-04 22:29:46 -07:00
meta-filesystems add nilfs-utils_v2.2.11 2025-06-26 07:26:19 -07:00
meta-gnome gexiv2: fix buildpath error 2025-06-25 06:44:55 -07:00
meta-initramfs meta-openembedded/all: adapt to UNPACKDIR changes 2025-06-25 06:44:52 -07:00
meta-multimedia meta-openembedded/all: adapt to UNPACKDIR changes 2025-06-25 06:44:52 -07:00
meta-networking pgpool2: upgrade 4.5.3 -> 4.5.4 2025-07-02 12:50:58 -07:00
meta-oe libusbgx: exit with failure code when no UDC is detected 2025-07-02 23:27:07 -07:00
meta-perl meta-openembedded/all: adapt to UNPACKDIR changes 2025-06-25 06:44:52 -07:00
meta-python python3-pychromecast: Allow max version to 0.46.1 for python3-wheel 2025-07-01 23:19:38 -07:00
meta-webserver meta-openembedded/all: adapt to UNPACKDIR changes 2025-06-25 06:44:52 -07:00
meta-xfce xfce4-screenshooter: Fix build for wayland systems 2025-07-02 18:19:53 -07:00
.b4-config Add toplevel b4 config file 2025-04-10 08:31:06 -07:00
.gitignore .gitignore: add *.pyc and *.pyo 2019-06-15 16:45:33 -07:00
COPYING.MIT add README and license for this layer 2011-02-13 16:47:32 +01:00
README.md layers: Move READMEs to markdown format 2023-06-17 08:30:01 -07:00

Collection of layers for the OE-core universe

Main layer maintainer: Khem Raj raj.khem@gmail.com

This repository is a collection of layers to suppliment OE-Core with additional packages, Each layer have designated maintainer Please see the respective READMEs in the layer subdirectories