summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--recipes-support/libusbgx/files/99-toradex-usb-udc.rules1
-rw-r--r--recipes-support/libusbgx/libusbgx_%.bbappend22
2 files changed, 23 insertions, 0 deletions
diff --git a/recipes-support/libusbgx/files/99-toradex-usb-udc.rules b/recipes-support/libusbgx/files/99-toradex-usb-udc.rules
new file mode 100644
index 0000000..e535212
--- /dev/null
+++ b/recipes-support/libusbgx/files/99-toradex-usb-udc.rules
@@ -0,0 +1 @@
+ACTION=="add", SUBSYSTEM=="udc", RUN+="/usr/bin/gadget-start"
diff --git a/recipes-support/libusbgx/libusbgx_%.bbappend b/recipes-support/libusbgx/libusbgx_%.bbappend
new file mode 100644
index 0000000..e0a5ab1
--- /dev/null
+++ b/recipes-support/libusbgx/libusbgx_%.bbappend
@@ -0,0 +1,22 @@
+# When using the examples package, disable the usbgx service and instead
+# call gadget-start from udev.
+#
+# The systemd target `usb-gadget.target` is triggered by udev when a UDC
+# first comes up. The usbgx service uses this target and executes
+# gadget-start to initialize the gadget. It can happen that by the time
+# gadget-start runs, the UDC has been removed from the system again.
+#
+# Call gadget-start from udev every time a UDC comes up instead of only
+# once via the systemd service (usbgx.service). Repeated runs of this
+# script are not problematic.
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+SRC_URI:append = " file://99-toradex-usb-udc.rules"
+
+SYSTEMD_AUTO_ENABLE:${PN}-examples = "disable"
+
+do_install:append() {
+ install -d ${D}${sysconfdir}/udev/rules.d
+ install -m 0644 ${WORKDIR}/99-toradex-usb-udc.rules ${D}${sysconfdir}/udev/rules.d/
+}